Changeset 1529 for GTP/trunk/App/Demos/Geom/Demo_LodTrees
- Timestamp:
- 09/28/06 19:26:26 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Geom/Demo_LodTrees
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Geom/Demo_LodTrees/main.cpp
r1321 r1529 43 43 44 44 45 void DumpDataToOgreBuffers(Ogre::Mesh *original_mesh, Geometry::LodTreeLibrary *lodTreesLib)45 /*void DumpDataToOgreBuffers(Ogre::Mesh *original_mesh, Geometry::LodTreeLibrary *lodTreesLib) 46 46 { 47 47 // Copy to Ogre buffers including the degenerated triangles … … 81 81 ibuf->unlock(); 82 82 } 83 } 83 }*/ 84 84 85 85 class FresnelFrameListener : public ExampleFrameListener … … 149 149 { 150 150 myTrees->GoToLod(lodfactor); 151 DumpDataToOgreBuffers(ogreMesh,myTrees);151 // DumpDataToOgreBuffers(ogreMesh,myTrees); 152 152 lodfactorBefore=lodfactor; 153 153 } … … 207 207 }; 208 208 209 class CustomIndexData : public Geometry::IndexData 210 { 211 private: 212 Ogre::Mesh *targetMesh; 213 Ogre::HardwareIndexBufferSharedPtr ibuf; 214 Ogre::RenderOperation mRenderOp; 215 unsigned long* pIdx; 216 public: 217 CustomIndexData(Ogre::Mesh *ogremesh):Geometry::IndexData(){ 218 targetMesh=ogremesh; 219 pIdx=NULL; 220 } 221 virtual ~CustomIndexData(void){} 222 223 virtual void Begin(unsigned int submeshid, unsigned int indexcount){ 224 targetMesh->getSubMesh(submeshid)->_getRenderOperation(mRenderOp,0); 225 ibuf = mRenderOp.indexData->indexBuffer; 226 mRenderOp.indexData->indexCount = indexcount; 227 pIdx = static_cast<unsigned long*>(ibuf->lock(Ogre::HardwareBuffer::HBL_NORMAL)); 228 } 229 virtual void SetIndex(unsigned int i, unsigned int index){ 230 pIdx[i] = index; //lodStripsLib->dataRetrievalInterface->GetIndex(k+offset); 231 } 232 virtual void End(){ 233 ibuf->unlock(); 234 } 235 236 virtual void BorrowIndexData(const Geometry::IndexData *){} 237 }; 238 239 209 240 class FresnelApplication : public ExampleApplication 210 241 { … … 274 305 OGRE_EXCEPT(1, "The loaded mesh does not contain LOD info for the foliage","LOD Demo"); 275 306 276 myTrees = new Geometry::LodTreeLibrary(meshloader->GetLodStripsData(),meshloader->GetTreeSimpSeq(),themesh); 307 myTrees = new Geometry::LodTreeLibrary( meshloader->GetLodStripsData(), 308 meshloader->GetTreeSimpSeq(), 309 themesh, 310 new CustomIndexData(ogreMesh)); 277 311 278 312 entity->setNormaliseNormals(true);
Note: See TracChangeset
for help on using the changeset viewer.