Changeset 1561 for GTP/trunk/App/Demos/Geom/Demo_LodTrees
- Timestamp:
- 10/03/06 17:31:07 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Geom/Demo_LodTrees
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/ogre.cfg
r1540 r1561 1 Render System OpenGL Rendering Subsystem 2 Colour Depth 32 3 Display Frequency 60 4 FSAA 0 1 Render System Direct3D9 Rendering SubSystem 2 Anti aliasing None 3 Floating-point mode Fastest 5 4 Full Screen Yes 5 Rendering Device NVIDIA GeForce 6800 Series GPU 6 6 VSync No 7 Video Mode 1024 x 7687 Video Mode 800 x 600 @ 32-bit colour -
GTP/trunk/App/Demos/Geom/Demo_LodTrees/main.cpp
r1540 r1561 19 19 // Distance values 20 20 #define dist_min 300 21 #define dist_max 70021 #define dist_max 900 22 22 23 23 // Model name … … 41 41 OverlayElement* mInfo; 42 42 OverlayElement* mInfo2; 43 OverlayElement* mHelp; 44 45 char HelpString[]="(F1) Help\n" 46 "This demo shows an example of the LodTree model in action. The trees in the scene\n" 47 "are associated to a LodTree object that manage their level of detail of both the\n" 48 "trunk and the leaves. The level of detail of the objects depend on the distance to\n" 49 "the camera. When the camera goes away from them, the level of detail decreases, and\n" 50 "when the camera gets closer to them the level of detail increases to restore the\n" 51 "original geometry of the model.\n" 52 "The current level of detail can be seen in real-time in the top-left corner of the screen.\n" 53 "The level of detail begins to decrease at a certain distance of the forest, and stops\n" 54 "decreasing when the objects reach the their minimum LOD. This 'lodding' distance is\n" 55 "customizable from the source code of the demo."; 56 57 char NoHelpString[]="(F1) Help\n"; 43 58 44 59 … … 107 122 108 123 static float lodfactorBefore = -1.0f; 109 if (fabsf(lodfactorBefore-lodfactor)>0. 05f)124 if (fabsf(lodfactorBefore-lodfactor)>0.1f) 110 125 { 111 126 myTrees->GoToLod(lodfactor); … … 141 156 if(mInputDevice->isKeyDown(Ogre::KC_RIGHT)) 142 157 mCamera->yaw(-mRotScale); 158 159 static bool newpush = true; 160 if (!mInputDevice->isKeyDown(Ogre::KC_F1)) 161 newpush = true; 162 163 static bool showing_help = false; 164 if (mInputDevice->isKeyDown(Ogre::KC_F1) && newpush) 165 { 166 newpush = false; 167 if (showing_help = !showing_help) 168 mHelp->setCaption(HelpString); 169 else 170 mHelp->setCaption(NoHelpString); 171 } 172 143 173 144 174 if(mInputDevice->isKeyDown(Ogre::KC_ESCAPE)) … … 230 260 // Set ambient light 231 261 mSceneMgr->setAmbientLight(ColourValue(0.4, 0.4, 0.4)); 262 theCam->setNearClipDistance(0.1f); 232 263 233 264 // Create a directional light … … 260 291 261 292 //Models 262 entity = mSceneMgr->createEntity(model_name, "../../../OgreStuff/media/GT/ML1 2m.mesh");293 entity = mSceneMgr->createEntity(model_name, "../../../OgreStuff/media/GT/ML11.mesh"); 263 294 264 295 ogreMesh = entity->getMesh().getPointer(); … … 266 297 // load LOD info from the object 267 298 meshloader=new Geometry::GeoMeshLoader; 268 Geometry::Mesh *themesh = meshloader->load("../../../OgreStuff/media/GT/ML1 2m.mesh");299 Geometry::Mesh *themesh = meshloader->load("../../../OgreStuff/media/GT/ML11.mesh"); 269 300 270 301 if (!meshloader->GetLodStripsData()) … … 284 315 bool istrunk = myTrees->GetLeavesSubMesh()!=submesh; 285 316 if (istrunk) 286 entity->getSubEntity(submesh)->setMaterialName("Examples/ Populifolia/trunk");317 entity->getSubEntity(submesh)->setMaterialName("Examples/ML11/trunk"); 287 318 else 288 entity->getSubEntity(submesh)->setMaterialName("Examples/ Populifolia/leaf");319 entity->getSubEntity(submesh)->setMaterialName("Examples/ML11/leaf"); 289 320 } 290 321 291 322 forest_center=Ogre::Vector3(150.0f,0.0f,0.0f); 292 for (int i=1; i< 8; i++) // 20293 for (int j=1; j< 8; j++) // 20323 for (int i=1; i<5; i++) // 20 324 for (int j=1; j<5; j++) // 20 294 325 { 295 326 char newTreeName[16]=""; … … 301 332 auxnode->rotate(Ogre::Vector3(0,0,1),Ogre::Degree(rand()%360)); 302 333 auxnode->rotate(Ogre::Vector3(1,0,0),Ogre::Radian(-3.14159f*0.5f),Ogre::Node::TS_WORLD); 303 float randomsepx = (float)((rand()% 18)-9);304 float randomsepy = (float)((rand()% 12)-6);305 auxnode->translate(i* 30.0f+randomsepx,0.0f,-j*30.0f-randomsepx);334 float randomsepx = (float)((rand()%38)-19); 335 float randomsepy = (float)((rand()%32)-12); 336 auxnode->translate(i*80.0f+randomsepx,0.0f,-j*80.0f-randomsepx); 306 337 auxent->setNormaliseNormals(true); 307 338 } … … 315 346 mInfo = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Info_1"); 316 347 mInfo2 = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Info_2"); 348 mHelp = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Help"); 349 mHelp->setCaption(NoHelpString); 317 350 pOver->show(); 318 351
Note: See TracChangeset
for help on using the changeset viewer.