| 
 #include "ExampleApplication.h" 
class TutorialApplication : public ExampleApplication { protected: public:  TutorialApplication()  {  } 
 ~TutorialApplication()   {  } protected:  //virtual void createCamera(void)  //{  // mCamera = mSceneMgr->createCamera("PlayerCam");  //} 
 //virtual void createViewports(void)  //{  // Viewport* vp = mWindow->addViewport(mCamera);  // vp->setBackgroundColour(ColourValue(255,0,0));  //  mCamera->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));      //} 
 void createScene(void)  { 
     Entity *ent;   Light *light; 
  //设置电光源   //light = mSceneMgr->createLight("Light1");   //light->setType(Light: T_POINT);   //light->setPosition(Vector3(20, 550, 450));   //light->setDiffuseColour(1.0, 0.0, 0.0);   //light->setSpecularColour(1.0, 0.0, 0.0); 
  //设置一个方向光   light = mSceneMgr->createLight("Light3");   light->setType(Light: T_DIRECTIONAL);   light->setDiffuseColour(ColourValue(.25, .25, 0));   light->setSpecularColour(ColourValue(.25, .25, 0));   light->setDirection(Vector3( 0, -1, 1 ));  
  //设置一个聚光灯   //light = mSceneMgr->createLight("Light2"   //light->setType(Light: T_SPOTLIGHT);   //light->setDiffuseColour(0, 0, 1.0);   //light->setSpecularColour(0, 0, 1.0);   //light->setDirection(-1, -1, 0);   //light->setPosition(Vector3(300, 300, 0));   //light->setSpotlightRange(Degree(35), Degree(50)); 
  //设置环境光   mSceneMgr->setAmbientLight( ColourValue( 1, 1, 1 ) );   Entity *ent1 = mSceneMgr->createEntity( "Robot", "robot.mesh" );   SceneNode *node1 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "RobotNode" );   node1->attachObject( ent1 );   node1->translate( Vector3( 50, 0, 200 ) ); 
  //Entity *ent2 = mSceneMgr->createEntity( "Robot2", "robot.mesh" );   //SceneNode *node2 = mSceneMgr->getRootSceneNode()->createChildSceneNode("RobotNode2", Vector3( 50, 0, 0 ) );   //SceneNode *node2 = node1->createChildSceneNode( "RobotNode2", Vector3( 50, 0, 0 ) ); 
  //node2->attachObject( ent2 );   //node2->scale( .5, .5, .5 );   //node2->yaw( Degree( 90 ) );   //node1->translate( Vector3( 10, 0, 10 ) ); 
  //设置阴影模式   mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_MODULATIVE);   ent = mSceneMgr->createEntity("Ninja", "ninja.mesh");  //创建忍者模型   SceneNode *node2 = mSceneMgr->getRootSceneNode()->createChildSceneNode("RobotNode2", Vector3( 50, 0, 0 ) );//把忍者模型放在了场景节点中   node2->yaw(Degree( 60 ));   node2->attachObject( ent );   ent->setCastShadows(true);   //mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent); 
     //创建地面模型    lane plane(Vector3::UNIT_Y, 0);   MeshManager::getSingleton().createPlane("ground",ResourceGroupManager: EFAULT_RESOURCE_GROUP_NAME, plane, 1500,1500,20,20,true,1,5,5,Vector3::UNIT_Z); 
  ent = mSceneMgr->createEntity("GroundEntity", "ground");   mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);   ent->setMaterialName("Examples/Rockwall");   ent->setCastShadows(false); 
 } }; 
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 #define WIN32_LEAN_AND_MEAN #include "windows.h" 
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT ) #else int main(int argc, char **argv) #endif {  // Create application object  TutorialApplication app;  
 try {   app.go();  } catch( Exception& e ) { #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32    MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL); #else   fprintf(stderr, "An exception has occured: %s\n",    e.getFullDescription().c_str()); #endif  } 
 return 0; }  |