Changeset 2768 for GTP/trunk/App/Demos/Vis/CHC_revisited/RenderQueue.cpp
- Timestamp:
- 06/17/08 23:08:39 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/CHC_revisited/RenderQueue.cpp
r2767 r2768 5 5 #include "Material.h" 6 6 7 8 using namespace std; 7 9 8 10 … … 13 15 inline static bool IsLower(SceneEntity *ent1, SceneEntity *ent2) 14 16 { 15 if (ent1->GetGeometry()->HasTexture() && ent2->GetGeometry()->HasTexture()) 16 { 17 Texture *t1 = ent1->GetMaterial()->GetTexture(); 18 Texture *t2 = ent1->GetMaterial()->GetTexture(); 17 Texture *t1 = ent1->GetMaterial()->GetTexture(); 18 Texture *t2 = ent2->GetMaterial()->GetTexture(); 19 19 20 return t1->GetByteSize() < t2->GetByteSize(); 21 } 22 else if (ent2->GetGeometry()->HasTexture()) 23 { 24 return true; 25 } 20 int tsize1 = t1 ? t1->GetByteSize() : 0; 21 int tsize2 = t2 ? t2->GetByteSize() : 0; 26 22 27 return false; 23 if (tsize1 == tsize2) 24 return ent1->GetMaterial() < ent2->GetMaterial(); 25 26 return tsize1 < tsize2; 28 27 } 29 30 28 31 29 … … 65 63 { 66 64 Sort(); 67 65 66 //if (!mEntities.empty()) Debug << "rendering render queue" << endl; 68 67 SceneEntityContainer::const_iterator sit, sit_end = mEntities.end(); 69 68 … … 72 71 SceneEntity *ent = *sit; 73 72 ent->Render(mState); 73 74 /*if (ent->GetMaterial()->GetTexture()) 75 Debug << " " << ent->GetMaterial()->GetTexture()->GetWidth(); 76 else 77 Debug << " 0";*/ 74 78 } 75 79 } 76 77 80 78 81 79 82 void RenderQueue::Sort() 80 83 { 81 sort(mEntities.begin(), mEntities.end()); 84 //InitTiming(); 85 //long t1, t2; 86 //t1 = GetTime(); 87 88 sort(mEntities.begin(), mEntities.end(), IsLower); 89 90 //t2 = GetTime(); 91 //cout << "sort: " << TimeDiff(t1, t2) << endl; 82 92 } 83 93
Note: See TracChangeset
for help on using the changeset viewer.