Changeset 2841 for GTP/trunk/App/Demos/Vis/FriendlyCulling
- Timestamp:
- 07/16/08 14:59:55 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.cpp
r2840 r2841 59 59 60 60 61 bool RenderQueue::FitsInBucket(Shape *ent, size_t idx) const 62 { 63 #ifdef TODO 64 Material *mat = ent->GetMaterial(); 65 #else 66 Material *mat = NULL; 67 #endif 61 bool RenderQueue::FitsInBucket(Shape *shape, size_t idx) const 62 { 63 Material *mat = shape->GetMaterial(); 64 68 65 // test if entity belongs to this bucket 69 66 // note: rather slows down the application for some reason!! 70 if ( 0 &&mat->IsAlphaTestEnabled() != mBuckets[idx]->mAlphaTestEnabled)67 if (mat->IsAlphaTestEnabled() != mBuckets[idx]->mAlphaTestEnabled) 71 68 return false; 72 69 … … 91 88 void RenderQueue::Enqueue(SceneEntity *entity) 92 89 { 90 static ShapeContainer shapes; 91 shapes.clear(); 92 93 entity->GetCurrentLODLevel(shapes) 94 95 ShapeContainer::const_iterator sit, sit_end = shapes.end(); 96 97 for (sit = shapes.begin(); sit != sit_end; ++ sit) 98 { 99 Enqueue(*sit); 100 } 101 } 102 103 104 void RenderQueue::Enqueue(Shape *shape) 105 { 93 106 RenderQueueBucket *bucket; 94 107 ++ mSize; 95 #ifdef TODO 108 96 109 if (entity->mRenderQueueBucket) 97 110 { … … 141 154 142 155 bucket->mEntities.push_back(entity); 143 #endif144 145 156 } 146 157 … … 195 206 Material *mat = shape->GetMaterial(); 196 207 int tsize = mat->GetTexture() ? mat->GetTexture()->GetByteSize() : 0; 197 #ifdef TODO 208 198 209 float dist = SqrMagnitude(shape->GetBoundingBox().Center() - mCamera->GetPosition()); 199 #else 200 float dist = -1; 201 #endif 210 202 211 Debug << "e: " << shape << " a: " << mat->IsAlphaTestEnabled() << " s: " << tsize << " d: " << dist << " " << endl; 203 212 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.h
r2839 r2841 70 70 protected: 71 71 72 void Enqueue(Shape *shape); 73 72 74 inline bool FitsInBucket(Shape *shape, size_t idx) const; 73 75 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp
r2840 r2841 22 22 23 23 24 ShapeContainer *SceneEntity::GetCurrentLOD()24 void SceneEntity::GetCurrentLODLevel(ShapeContainer &shapes) 25 25 { 26 /* if (mLODInfos->empty()) 27 return &mShapes; 26 ShapeContainer::const_iterator sit, sit_end; 27 28 if (mLODInfos->empty()) 29 { 30 sit = mShapes.begin(); sit_end = mShapes.end(); 31 } 28 32 29 33 float mDistance = 0.0f; … … 31 35 int i = 0; 32 36 33 for (int i = 0; i < mLODInfos->size(); ++ i) 37 LODInfo *info; 38 39 LODInfoContainer::const_iterator lid, lid_end = mLODInfos.end(); 40 41 for (lid = mLODInfos.begin(); lid != lid_end; ++ lid) 34 42 { 35 if ((mLODInfos*)[i].mDistance > mDistance) 36 return &(mLODInfos*)[i].mShapes; 43 info = *lid; 44 45 if (info->mDistance > mDistance) 46 { 47 sit = info->mShapes.begin(); 48 sit_end = info->mShapes.end(); 49 break; 50 } 37 51 } 38 52 39 return &(mLODInfos->last().mShapes); 40 */ 41 return NULL; 53 for (; sit != sit_end; ++ sit) 54 { 55 shapes.push_back(*sit); 56 } 42 57 } 43 58 … … 48 63 float mDistance = 0.0f; 49 64 50 ShapeContainer *shapes; 65 static ShapeContainer shapes; 66 shapes.clear(); 51 67 52 shapes = GetCurrentLOD();68 GetCurrentLODLevel(shapes); 53 69 54 for (int i = 0; i < shapes->size(); ++ i) 70 ShapeContainer::const_iterator sit, sit_end = shapes.end(); 71 72 for (; sit != sit_end; ++ sit) 55 73 { 56 (*s hapes)[i]->Render(state);74 (*sit)->Render(state); 57 75 } 58 76 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h
r2840 r2841 63 63 64 64 65 void GetCurrentLODLevel(ShapeContainer &shapes); 66 65 67 protected: 66 68 67 ShapeContainer *GetCurrentLOD();68 69 69 70 /// transform matrix
Note: See TracChangeset
for help on using the changeset viewer.