Changeset 1540 for GTP/trunk/App/Demos/Geom/Demo_LodTrees
- Timestamp:
- 09/29/06 11:02:43 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Geom/Demo_LodTrees
- Files:
-
- 29 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Geom/Demo_LodTrees/main.cpp
r1529 r1540 43 43 44 44 45 /*void DumpDataToOgreBuffers(Ogre::Mesh *original_mesh, Geometry::LodTreeLibrary *lodTreesLib) 46 { 47 // Copy to Ogre buffers including the degenerated triangles 48 Ogre::HardwareIndexBufferSharedPtr ibuf; 49 Ogre::IndexData *indexes; 50 Ogre::RenderOperation mRenderOp; 51 52 for (int submesh=0; submesh < original_mesh->getNumSubMeshes(); submesh++) 53 { 54 bool istrunk = lodTreesLib->GetLeavesSubMesh()!=submesh; 55 original_mesh->getSubMesh(submesh)->_getRenderOperation(mRenderOp,0); 56 57 // we will suppose this submesh is the foliage 58 int indices_to_render = lodTreesLib->CurrentLOD_Foliage_IndexCount(); 59 int offset = 0; 60 61 if (istrunk) 62 { 63 // this submesh is the trunk 64 offset = lodTreesLib->GetValidTrunkOffset(submesh); 65 indices_to_render = lodTreesLib->GetValidTrunkIndexCount(submesh); 66 } 67 68 ibuf = mRenderOp.indexData->indexBuffer; 69 mRenderOp.indexData->indexStart = 0; 70 mRenderOp.indexData->indexCount = indices_to_render; 71 72 unsigned long* pIdx = static_cast<unsigned long*>(ibuf->lock(Ogre::HardwareBuffer::HBL_NORMAL)); 73 74 for (int k=0; k<indices_to_render; k++) 75 if (istrunk) 76 pIdx[k] = lodTreesLib->CurrentLOD_Trunk_Indices()->GetIndex(k+offset); 77 else 78 pIdx[k] = lodTreesLib->CurrentLOD_Foliage_Indices()->GetIndex(k); 79 80 81 ibuf->unlock(); 82 } 83 }*/ 84 85 class FresnelFrameListener : public ExampleFrameListener 45 46 class LodTreeFrameListener : public ExampleFrameListener 86 47 { 87 48 int manage; … … 89 50 public: 90 51 91 FresnelFrameListener(RenderWindow* win, Camera* cam)52 LodTreeFrameListener(RenderWindow* win, Camera* cam) 92 53 : ExampleFrameListener(win, cam, false, false) 93 54 { … … 153 114 } 154 115 155 // Move the node 156 if(mInputDevice->isKeyDown(Ogre::KC_UP)) 116 // Move the cam 117 if(mInputDevice->isKeyDown(Ogre::KC_UP) || 118 mInputDevice->isKeyDown(Ogre::KC_W) || 119 mInputDevice->isKeyDown(Ogre::KC_NUMPAD5)) 157 120 mTranslateVector.z = -mMoveScale; 158 121 159 160 if(mInputDevice->isKeyDown(Ogre::KC_DOWN)) 122 if(mInputDevice->isKeyDown(Ogre::KC_DOWN) || 123 mInputDevice->isKeyDown(Ogre::KC_S) || 124 mInputDevice->isKeyDown(Ogre::KC_NUMPAD2)) 161 125 mTranslateVector.z = mMoveScale; 126 127 if (mInputDevice->isKeyDown(Ogre::KC_A) || 128 mInputDevice->isKeyDown(Ogre::KC_NUMPAD1)) 129 mTranslateVector.x = -mMoveScale; 130 131 if (mInputDevice->isKeyDown(Ogre::KC_D) || 132 mInputDevice->isKeyDown(Ogre::KC_NUMPAD3)) 133 mTranslateVector.x = mMoveScale; 162 134 163 135 // Instead of moving the ship left and right, rotate it using yaw() … … 238 210 239 211 240 class FresnelApplication : public ExampleApplication212 class LodTreeApplication : public ExampleApplication 241 213 { 242 214 protected: 243 215 public: 244 FresnelApplication() 245 { 246 } 247 248 ~FresnelApplication() 249 { 250 } 216 LodTreeApplication(){} 217 ~LodTreeApplication(){} 218 251 219 protected: 252 220 … … 353 321 void createFrameListener(void) 354 322 { 355 mFrameListener= new FresnelFrameListener(mWindow, mCamera);323 mFrameListener= new LodTreeFrameListener(mWindow, mCamera); 356 324 mFrameListener->showDebugOverlay(true); 357 325 mRoot->addFrameListener(mFrameListener); … … 378 346 { 379 347 // Create application object 380 FresnelApplication app;348 LodTreeApplication app; 381 349 382 350 try {
Note: See TracChangeset
for help on using the changeset viewer.