Ogre 3D 1.7 Beginner's Guide
上QQ阅读APP看书,第一时间看更新

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:
    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:
    SinbadNode->setScale(3.0f,3.0f,3.0f);
    SinbadNode->setPosition(Ogre::Vector3(0.0f,4.0f,0.0f));
    SinbadNode->attachObject(Sinbad);
    
  3. Compile and run the application.
    Time for action — finding out what's missing

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.