Changeset 1561 for GTP/trunk/App/Demos/Geom
- Timestamp:
- 10/03/06 17:31:07 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Geom
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Geom/Demo_LodStrips/main.cpp
r1555 r1561 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 LODStrips model in action. The models in the scene\n" 47 "are associated to a LodStrips object that manage their level of detail.\n" 48 "The level of detail of the objects depend on the distance to the camera. When the\n" 49 "camera goes away from them, the level of detail decreases, and when the camera gets\n" 50 "closer to them the level of detail increases to restore the original geometry of the\n" 51 "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 crowd, 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"; 58 43 59 44 60 class CustomIndexData : public Geometry::IndexData … … 161 177 mCamera->setDetailLevel(SDL_WIREFRAME);*/ 162 178 179 static bool newpush = true; 180 if (!mInputDevice->isKeyDown(Ogre::KC_F1)) 181 newpush = true; 182 183 static bool showing_help = false; 184 if (mInputDevice->isKeyDown(Ogre::KC_F1) && newpush) 185 { 186 newpush = false; 187 if (showing_help = !showing_help) 188 mHelp->setCaption(HelpString); 189 else 190 mHelp->setCaption(NoHelpString); 191 } 163 192 164 193 if(mInputDevice->isKeyDown(Ogre::KC_LEFT)) … … 204 233 return true; 205 234 } 235 206 236 }; 207 237 … … 251 281 groundEntity->setCastShadows(false); 252 282 253 254 /* pEnt = mSceneMgr->createEntity( "PoolFloor", "PoolFloor.mesh" );255 myRootNode->attachObject(pEnt);256 myRootNode->scale(6.0,6.0,6.0);*/257 258 283 std::string model_file=model_name; 259 284 model_file.append(".mesh"); … … 269 294 node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); 270 295 node->attachObject( entity ); 296 node->setVisible(false); 271 297 272 298 std::string lod_file="../../media/GT/"; … … 306 332 mInfo = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Info_1"); 307 333 mInfo2 = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Info_2"); 334 mHelp = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Help"); 335 mHelp->setCaption(NoHelpString); 308 336 pOver->show(); 309 337 -
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 -
GTP/trunk/App/Demos/Geom/OgreStuff/media/materials/scripts/Example.material
r1542 r1561 778 778 pass 779 779 { 780 cull_hardware anticlockwise780 cull_hardware clockwise 781 781 texture_unit 782 782 { … … 787 787 } 788 788 789 material Examples/ML11/leaf 790 { 791 technique 792 { 793 pass 794 { 795 alpha_rejection greater 150 796 scene_blend alpha_blend 797 cull_hardware none 798 cull_software none 799 texture_unit 800 { 801 filtering linear linear none 802 texture ML11lef.tga 803 } 804 } 805 } 806 } 807 808 material Examples/ML11/trunk 809 { 810 technique 811 { 812 pass 813 { 814 cull_hardware clockwise 815 texture_unit 816 { 817 texture ML11brk.tif 818 } 819 } 820 } 821 } 822 789 823 material Examples/Rockwall 790 824 { -
GTP/trunk/App/Demos/Geom/OgreStuff/media/materials/scripts/RZR-002.material
r1092 r1561 14 14 } 15 15 } 16 17 18 material RockTerrain 19 { 20 technique 21 { 22 pass 23 { 24 25 texture_unit 26 { 27 texture terr_rock-dirt.jpg 28 } 29 } 30 } 31 } -
GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Demo_LodStrips.overlay
r1092 r1561 48 48 colour_bottom 0.3 0.5 0.3 49 49 } 50 element TextArea(Demo_LodStrips/Help) 51 { 52 metrics_mode pixels 53 left 5 54 top 50 55 width 90 56 height 50 57 font_name TrebuchetMSBold 58 char_height 16 59 colour_top 0.5 0.7 0.5 60 colour_bottom 0.3 0.5 0.3 61 } 50 62 } 51 63 }
Note: See TracChangeset
for help on using the changeset viewer.