- Timestamp:
- 07/08/05 01:53:01 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r159 r160 15 15 #include <windows.h> 16 16 17 /*******************************************************/ 18 /* TestCullingTerrainApplication implementation */ 19 /*******************************************************/ 17 String currentObjectCaptions[] = 18 { 19 "robot", 20 "athene", 21 "ninja" 22 //"ogrehead" 23 }; 24 25 /*********************************************************/ 26 /* TestCullingTerrainApplication implementation */ 27 /*********************************************************/ 28 29 20 30 TestCullingTerrainApplication::TestCullingTerrainApplication(): 21 31 mTerrainContentGenerator(NULL) … … 30 40 mTerrainContentGenerator = NULL; 31 41 } 32 //if(mRenderTargetListener) delete mRenderTargetListener;33 42 } 34 43 //----------------------------------------------------------------------- … … 127 136 setupGui(); 128 137 129 130 138 /* // occluder plane to test visibility 131 Plane plane; 132 plane.normal = Vector3::UNIT_Y; 133 plane.d = -60; 139 Plane plane; plane.normal = Vector3::UNIT_Y; plane.d = -60; 134 140 MeshManager::getSingleton().createPlane("Myplane", 135 141 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane, … … 152 158 mTerrainContentGenerator = new TerrainContentGenerator(mSceneMgr); 153 159 154 // if no objects file generate yourself160 // if no objects in file, we generate new objects 155 161 if (!mTerrainContentGenerator->LoadObjects("objects.out")) 156 162 { 157 163 // to provide much occlusion, 158 // height is restricted to 50 , sono objects appear on peaks164 // height is restricted to 50 => no objects appear on peaks 159 165 mTerrainContentGenerator->SetMaxPos(Vector3(3000.0f, 50.0f, 3000.0f)); 160 166 mTerrainContentGenerator->SetOffset(0); 161 167 162 // the objects are generated on the whole terrain 163 //mTerrainContentGenerator->GenerateScene(1500, "robot"); 164 mTerrainContentGenerator->GenerateScene(1500, "athene"); 165 //mTerrainContentGenerator->GenerateScene(500, "ninja"); 168 // the objects are generated randomly distributed over the terrain 169 generateScene(1500, 0); 166 170 } 167 171 … … 169 173 // objects also on peaks of terrain 170 174 mTerrainContentGenerator->SetMaxPos(Vector3(3000.0f, 5000.0f, 3000.0f)); 175 } 176 //----------------------------------------------------------------------- 177 void TestCullingTerrainApplication::generateScene(int num, int objectType) 178 { 179 mTerrainContentGenerator->GenerateScene(num, currentObjectCaptions[objectType]); 180 181 if (objectType != 0) // from our objects, only robot has animation phases 182 return; 183 184 EntityList *entList = mTerrainContentGenerator->GetGeneratedEntities(); 185 186 //-- add animation state for new robots (located at the end of the list) 187 for (int i = entList->size() - num; i < entList->size(); ++i) 188 { 189 Entity *ent = (*entList)[i]; 190 AnimationState *st = ent->getAnimationState("Idle"); 191 st->setEnabled(true); 192 st->setLoop(true); 193 194 mAnimationStates.push_back(st); 195 mAnimationSpeed.push_back(Math::RangeRandom(0.5, 1.5)); 196 } 197 } 198 //----------------------------------------------------------------------- 199 std::vector<AnimationState *> &TestCullingTerrainApplication::getAnimationStates() 200 { 201 return mAnimationStates; 202 } 203 //----------------------------------------------------------------------- 204 std::vector<Real> &TestCullingTerrainApplication::getAnimationSpeed() 205 { 206 return mAnimationSpeed; 171 207 } 172 208 //----------------------------------------------------------------------- … … 189 225 { 190 226 mTerrainFrameListener = new TerrainFrameListener(mWindow, mCamera, mSceneMgr, 191 mGUIRenderer, mTerrainContentGenerator, mVizCamera, mCamNode, mSunLight );227 mGUIRenderer, mTerrainContentGenerator, mVizCamera, mCamNode, mSunLight, this); 192 228 193 229 mRoot->addFrameListener(mTerrainFrameListener); 194 230 } 195 231 //----------------------------------------------------------------------- 232 String TestCullingTerrainApplication::getCurrentObjectCaption(int id) 233 { 234 return currentObjectCaptions[id]; 235 } 236 //----------------------------------------------------------------------- 196 237 void TestCullingTerrainApplication::chooseSceneManager() 197 238 { 198 239 mSceneMgr = mRoot->getSceneManager(ST_EXTERIOR_CLOSE); 199 240 } 200 201 202 241 /**************************************************************/ 203 242 /* VisualizationRenderTargetListener implementation */
Note: See TracChangeset
for help on using the changeset viewer.