Changeset 1879 for GTP/trunk/App/Demos/Illum/Ogre/src/HierarchicalSystem
- Timestamp:
- 12/11/06 16:30:08 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/src/HierarchicalSystem/include/HierarchicalSystem.h
r1834 r1879 27 27 28 28 29 int scene = 2; 30 29 31 // Listener class for frame updates 30 32 class ParticleDemoFrameListener : public ExampleFrameListener … … 32 34 protected: 33 35 34 unsigned long framecount;35 36 SceneNode* lightNode; 36 37 … … 40 41 41 42 { 42 this->lightNode = lightNode; 43 framecount = 0; 43 this->lightNode = lightNode; 44 44 } 45 45 … … 48 48 bool result = ExampleFrameListener::frameStarted(evt); 49 49 50 Timer* timer = Root::getSingleton().getTimer(); 51 52 float t = (float) timer->getMilliseconds() / 2000.0; 53 float r = 150; 54 lightNode->setPosition( r * sin(t), r * sin(5 * t) + 200 , r * cos(t)); 55 56 framecount++; 50 if(scene == 1) 51 { 52 Timer* timer = Root::getSingleton().getTimer(); 53 54 float t = (float) timer->getMilliseconds() / 2000.0; 55 float r = 150; 56 lightNode->setPosition( r * sin(t), r * sin(5 * t) + 200 , r * cos(t)); 57 } 57 58 return result; 58 59 } … … 82 83 virtual void chooseSceneManager(void) 83 84 { 84 ExampleApplication::chooseSceneManager(); 85 // Get the SceneManager, in this case a generic one 86 // mSceneMgr = mRoot->createSceneManager("TerrainSceneManager"); 85 if(scene == 1) 86 ExampleApplication::chooseSceneManager(); 87 else if(scene == 2) 88 mSceneMgr = mRoot->createSceneManager("TerrainSceneManager"); 87 89 } 88 90 … … 94 96 OgreIlluminationManager::getSingleton().setMainViewport(mWindow->getViewport(0)); 95 97 96 //std::string terrain_cfg("terrain.cfg"); 97 //mSceneMgr -> setWorldGeometry( terrain_cfg ); 98 98 99 99 Root::getSingleton()._setCurrentSceneManager(mSceneMgr); 100 mCamera->setPosition(0,150,100); 101 mCamera->setDirection(0,0,-1); 100 102 101 mCamera->setFOVy(Radian(Degree(80))); 103 mCamera->setFarClipDistance( 1000);102 mCamera->setFarClipDistance(5000); 104 103 // Set ambient light 105 104 mSceneMgr->setAmbientLight(ColourValue(1, 1, 1)); … … 107 106 // Skybox 108 107 mSceneMgr->setSkyBox(true, "Examples/EveningSkyBox", 10); 109 SceneNode* rootNode = mSceneMgr->getRootSceneNode(); 110 111 /* 112 //init objects 113 Entity* kupola = mSceneMgr->createEntity("kupola", "kupola.mesh"); 114 115 //init nodes 116 kupolaNode = rootNode->createChildSceneNode( "kupola" ); 117 kupolaNode->rotate(Vector3(0,1,0),Radian(Degree(90))); 118 //kupolaNode->setPosition(0, -150, 0); 119 kupolaNode->attachObject( kupola ); 120 kupolaNode->scale(50,50,50); 121 kupolaNode->_updateBounds(); 122 MeshPtr kmesh = kupola->getMesh(); 123 kmesh->buildTangentVectors(0,1);*/ 108 109 124 110 125 Entity* head = mSceneMgr->createEntity("head", "athene.mesh"); 126 SceneNode* headNode = rootNode->createChildSceneNode("head"); 127 head->setMaterialName("GameTools/Standard"); 128 headNode->attachObject(head); 129 //headNode->setScale(1.5,1.5,1.5); 130 AxisAlignedBox bbox = head->getBoundingBox(); 131 headNode->setPosition(0,80,20); 132 headNode->_updateBounds(); 111 133 112 134 ParticleSystem* pSys1 = mSceneMgr->createParticleSystem("psys1", "GameTools/Big"); 135 pSys1->setKeepParticlesInLocalSpace(false); 136 SceneNode *pSysNode = rootNode->createChildSceneNode("psys1"); 137 pSysNode->attachObject(pSys1); 138 pSysNode->setPosition(0,0,0); 113 // OgreIlluminationManager::getSingleton().createGlobalRun(ILLUMRUN_PHASE_TEXTURE); 114 // OgreIlluminationManager::getSingleton().updateGlobalRun(ILLUMRUN_PHASE_TEXTURE, 1); 115 // OgreIlluminationManager::getSingleton().savePhaseTextureToFile("phase.dds"); 116 117 118 if(scene == 1) 119 createScene1(); 120 else if(scene == 2) 121 createScene2(); 122 123 124 OgreIlluminationManager::getSingleton().initTechniques(); 125 126 } 127 128 void createScene1() 129 { 130 mCamera->setPosition(0,150,100); 131 mCamera->setDirection(0,0,-1); 132 133 SceneNode* rootNode = mSceneMgr->getRootSceneNode(); 134 135 Entity* head = mSceneMgr->createEntity("head", "athene.mesh"); 136 SceneNode* headNode = rootNode->createChildSceneNode("head"); 137 head->setMaterialName("GameTools/Standard"); 138 headNode->attachObject(head); 139 //headNode->setScale(1.5,1.5,1.5); 140 AxisAlignedBox bbox = head->getBoundingBox(); 141 headNode->setPosition(0,80,20); 142 headNode->_updateBounds(); 143 144 145 ParticleSystem* pSys1 = mSceneMgr->createParticleSystem("psys1", "GameTools/Big"); 146 pSys1->setKeepParticlesInLocalSpace(false); 147 SceneNode *pSysNode = rootNode->createChildSceneNode("psys1"); 148 pSysNode->attachObject(pSys1); 149 pSysNode->setPosition(0,0,0); 139 150 140 151 //Init lights … … 151 162 bbs->setMaterialName("Flare"); 152 163 mainLightNode->attachObject(bbs); 164 } 153 165 154 // OgreIlluminationManager::getSingleton().createGlobalRun(ILLUMRUN_PHASE_TEXTURE); 155 // OgreIlluminationManager::getSingleton().updateGlobalRun(ILLUMRUN_PHASE_TEXTURE, 1); 156 // OgreIlluminationManager::getSingleton().savePhaseTextureToFile("phase.dds"); 166 void createScene2() 167 { 168 mCamera->setPosition(0,150,100); 169 mCamera->setDirection(0,0,-1); 157 170 158 OgreIlluminationManager::getSingleton().initTechniques(); 171 SceneNode* rootNode = mSceneMgr->getRootSceneNode(); 172 std::string terrain_cfg("terrain.cfg"); 173 mSceneMgr -> setWorldGeometry( terrain_cfg ); 174 175 ParticleSystem* pSys1 = mSceneMgr->createParticleSystem("psys1", "GameTools/FogBig"); 176 pSys1->setKeepParticlesInLocalSpace(false); 177 SceneNode *pSysNode = rootNode->createChildSceneNode("psys1"); 178 pSysNode->attachObject(pSys1); 179 pSysNode->setPosition(600,-50,600); 159 180 160 181 } … … 169 190 mRoot->addFrameListener(mFrameListener); 170 191 mRoot->addFrameListener(&OgreIlluminationManager::getSingleton()); 192 193 171 194 172 195 }
Note: See TracChangeset
for help on using the changeset viewer.