Ignore:
Timestamp:
06/17/08 23:08:39 (16 years ago)
Author:
mattausch
Message:

debug version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/CHC_revisited/RenderQueue.cpp

    r2767 r2768  
    55#include "Material.h" 
    66 
     7 
     8using namespace std; 
    79 
    810 
     
    1315inline static bool IsLower(SceneEntity *ent1, SceneEntity *ent2) 
    1416{ 
    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(); 
    1919 
    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; 
    2622 
    27         return false; 
     23        if (tsize1 == tsize2) 
     24                return ent1->GetMaterial() < ent2->GetMaterial(); 
     25 
     26        return tsize1 < tsize2; 
    2827} 
    29  
    3028 
    3129 
     
    6563{ 
    6664        Sort(); 
    67  
     65         
     66        //if (!mEntities.empty()) Debug << "rendering render queue" << endl; 
    6867        SceneEntityContainer::const_iterator sit, sit_end = mEntities.end(); 
    6968 
     
    7271                SceneEntity *ent = *sit; 
    7372                ent->Render(mState); 
     73 
     74                /*if (ent->GetMaterial()->GetTexture()) 
     75                        Debug << " " << ent->GetMaterial()->GetTexture()->GetWidth(); 
     76                else 
     77                        Debug << " 0";*/ 
    7478        } 
    7579} 
    76  
    7780         
    7881 
    7982void RenderQueue::Sort() 
    8083{ 
    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; 
    8292} 
    8393 
Note: See TracChangeset for help on using the changeset viewer.