English

ogre 3d 1.7 beginner’s guide 第三章 第五小节 中文翻译 遗漏的东西

2011/2/24

The missing thing

【 遗漏的东西 】

We already have added light to our scene, but something is missing. What's missing will be

shown in the next example.

【 我们已经添加光源到我们的场景中,但是却遗漏了一些东西。在下个例子中我们将会显示出到底是遗漏了什么。】

Time for action – finding out what's missing

【 实践时刻 —— 找出到底遗漏了什么 】

We are using the previously suggested code to find out what is missing in our scene.

【 我们使用之前推荐的代码来找出在场景中遗漏了什么东西。】

1.  After the creation of the light, add code to create an instance of Sinbad.mesh and

also create a node and attach the model to it:

【 1. 在创建光源完成后,添加代码以创建一个Sinbad.mesh的实例并创建一个节点用以关联模型。】

Ogre::Entity* Sinbad = mSceneMgr->createEntity("Sinbad", "Sinbad.mesh");

Ogre::SceneNode* SinbadNode = node->createChildSceneNode("SinbadNode");

2.  Then scale Sinbad to three times his size and move him a bit upwards; otherwise, he

will be stuck in the plane. Also add him to the scene node, so he will be rendered:

【 2. 然后按三倍的大小来设置Sinabad的缩放比例,并把它稍往上移动一点。否则,它将卡在平面上。同样的,添加它到场景,这样它就可以被渲染了。】

SinbadNode->setScale(3.0f,3.0f,3.0f);

SinbadNode->setPosition(Ogre::Vector3(0.0f,4.0f,0.0f));

SinbadNode->attachObject(Sinbad);

    • Compile and run the application.

【 4. 编译运行程序。】

What just happened?

【 刚刚发生了什么?】

We added an instance of Sinbad into our scene. Our scene is still lit, but we see that Sinbad

doesn't throw a shadow, which is rather unrealistic. The next step is to add shadows to

our scene.

【 我们在场景中添加了一个Sinbad的实例。我们的场景仍然是发亮的,但是我们看到Sinbad却不投射出影子,这就相当的不切实际了。下一步就是添加阴影到我们的场景。】