gCycleWallsDisplayListManager Class Reference

#include <gCycle.h>

Collaboration diagram for gCycleWallsDisplayListManager:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 gCycleWallsDisplayListManager ()
void RenderAll (eCamera const *camera, gCycle *cycle)
bool Walls () const
void Clear (int inhibit=0)

Static Public Member Functions

static bool CannotHaveList (REAL distance, gCycle const *cycle)
 checks whether a wall at a certain distance can have a display list

Private Attributes

gNetPlayerWallwallList_
 linked list of all walls
gNetPlayerWallwallsWithDisplayList_
 linked list of all walls with display list
rDisplayList displayList_
 combined display list
REAL wallsWithDisplayListMinDistance_
 minimal distance of the walls with display list
int wallsInDisplayList_
 number of walls in the current display list

Friends

class gNetPlayerWall


Detailed Description

Definition at line 119 of file gCycle.h.


Constructor & Destructor Documentation

gCycleWallsDisplayListManager::gCycleWallsDisplayListManager (  ) 

Definition at line 3960 of file gCycle.cpp.

03962     : wallList_(0)
03963     , wallsWithDisplayList_(0)
03964     , wallsWithDisplayListMinDistance_(0)
03965     , wallsInDisplayList_(0)
03966 {


Member Function Documentation

bool gCycleWallsDisplayListManager::CannotHaveList ( REAL  distance,
gCycle const *  cycle 
) [static]

checks whether a wall at a certain distance can have a display list

Definition at line 3968 of file gCycle.cpp.

References gCycleMovement::Alive(), eGameObject::DeathTime(), gCycleMovement::GetDistance(), se_GameTime(), gCycle::ThisWallsLength(), and gCycle::WallsStayUpDelay().

Referenced by RenderAll(), and gNetPlayerWall::RenderList().

03970 {
03971     return
03972             ( !cycle->Alive() && gCycle::WallsStayUpDelay() >= 0 && se_GameTime()-cycle->DeathTime()-gCycle::WallsStayUpDelay() > 0 ) 
03973 
03974             ||
03975 
03976             ( cycle->ThisWallsLength() > 0 && cycle->GetDistance() - cycle->ThisWallsLength() > distance );

Here is the call graph for this function:

Here is the caller graph for this function:

void gCycleWallsDisplayListManager::RenderAll ( eCamera const *  camera,
gCycle cycle 
)

Definition at line 3978 of file gCycle.cpp.

References gNetPlayerWall::BegPos(), rDisplayList::Call(), gNetPlayerWall::CanHaveDisplayList(), CannotHaveList(), rDisplayList::Clear(), gNetPlayerWall::ClearDisplayList(), dir_eWall_select(), displayList_, gNetPlayerWall::EndPos(), gCycleMovement::GetDistance(), gNetPlayerWall::gWallRenderMode_Lines, gNetPlayerWall::gWallRenderMode_Quads, tListItem< T >::Insert(), rDisplayList::IsRecording(), gCycle::MaxWallsLength(), tListItem< T >::Next(), tListItemBase::Remove(), gNetPlayerWall::Render(), RenderEnd(), gNetPlayerWall::RenderList(), sr_DepthOffset(), rTextureGroups::TEX_WALL, rTextureGroups::TextureMode, gCycle::ThisWallsLength(), wallList_, wallsInDisplayList_, wallsWithDisplayList_, and wallsWithDisplayListMinDistance_.

03980 {
03981     dir_eWall_select();
03982 
03983     glDisable(GL_CULL_FACE);
03984     
03985     gNetPlayerWall * run = 0;
03986     // transfer walls with display list into their list
03987 
03988     int wallsWithPossibleDisplayList = 0;
03989     run = wallList_;
03990     while( run )
03991     {
03992         gNetPlayerWall * next = run->Next();
03993         if ( run->CanHaveDisplayList() )
03994         {
03995             wallsWithPossibleDisplayList++;
03996         }
03997         else
03998         {
03999             // wall has expired, remove it
04000             if ( cycle->ThisWallsLength() > 0 && cycle->GetDistance() - cycle->MaxWallsLength() > run->EndPos() )
04001                 
04002             {
04003                 run->Remove();
04004             }
04005             else
04006             {
04007                 run->Render( camera );
04008             }
04009         }
04010         run = next;
04011     }
04012 
04013     // clear display list if needed
04014     bool tailExpired=false;
04015     if ( CannotHaveList( wallsWithDisplayListMinDistance_, cycle ) )
04016     {
04017         tailExpired=true;
04018         displayList_.Clear(0);
04019     }
04020     // check if enough new walls are present to warrant altering the display list
04021     else if ( wallsWithPossibleDisplayList >= 3 ||
04022          wallsWithPossibleDisplayList * 5 > wallsInDisplayList_ )
04023     {
04024         // yes? Ok, rebuild the list in this case, too
04025         displayList_.Clear(0);
04026     }
04027     else if ( wallsWithPossibleDisplayList )
04028     {
04029         // oops, at least render the newcomers normally
04030         run = wallList_;
04031         while( run )
04032         {
04033             gNetPlayerWall * next = run->Next();
04034             if ( run->CanHaveDisplayList() )
04035             {
04036                 run->Render( camera );
04037             }
04038 
04039             run = next;
04040         }
04041     }
04042 
04043     // call display list
04044     if ( displayList_.Call() )
04045     {
04046         return;
04047     }
04048 
04049     // remove and render walls without display list
04050     run = wallsWithDisplayList_;
04051     while( run )
04052     {
04053         gNetPlayerWall * next = run->Next();
04054         if ( !run->CanHaveDisplayList() || ( tailExpired && wallsWithDisplayListMinDistance_ >= run->BegPos() ) )
04055         {
04056             run->Render( camera );
04057             run->Insert( wallList_ );
04058         }
04059         run = next;
04060     }
04061 
04062     if ( wallsWithPossibleDisplayList > 0 )
04063     {
04064         run = wallList_;
04065         while( run )
04066         {
04067             gNetPlayerWall * next = run->Next();
04068             if ( run->CanHaveDisplayList() )
04069             {
04070                 run->Insert( wallsWithDisplayList_ );
04071             
04072                 // clear the wall's own display list, it will no longer be needed
04073                 run->ClearDisplayList(0, -1);
04074             }
04075         
04076             run = next;
04077         }
04078     }
04079 
04080     if ( !wallsWithDisplayList_ )
04081     {
04082         return;
04083     }
04084 
04085     // fill display list
04086     rDisplayListFiller filler( displayList_ );
04087 
04088     if ( !rDisplayList::IsRecording() )
04089     {
04090         // display list recording did not start; render traditionally
04091         run = wallsWithDisplayList_;
04092         while( run )
04093         {   
04094             gNetPlayerWall * next = run->Next();
04095             run->Render( camera );
04096             run = next;
04097         }
04098 
04099         return;
04100     }
04101 
04102     wallsWithDisplayListMinDistance_ = 1E+30;
04103     wallsInDisplayList_ = 0;
04104 
04105     // render walls;
04106     // first, render all lines
04107     sr_DepthOffset(true);
04108     if ( rTextureGroups::TextureMode[rTextureGroups::TEX_WALL] != 0 )
04109         glDisable(GL_TEXTURE_2D);
04110     
04111     run = wallsWithDisplayList_;
04112     while( run )
04113     {
04114         gNetPlayerWall * next = run->Next();
04115         if ( run->BegPos() < wallsWithDisplayListMinDistance_ )
04116         {
04117             wallsWithDisplayListMinDistance_ = run->BegPos();
04118         }
04119 
04120         wallsInDisplayList_++;
04121 
04122         run->RenderList( true, gNetPlayerWall::gWallRenderMode_Lines );
04123         run = next;
04124     }
04125 
04126     RenderEnd();
04127     sr_DepthOffset(false);
04128     if ( rTextureGroups::TextureMode[rTextureGroups::TEX_WALL] != 0 )
04129         glEnable(GL_TEXTURE_2D);
04130     
04131     run = wallsWithDisplayList_;
04132     while( run )
04133     {
04134         gNetPlayerWall * next = run->Next();
04135         run->RenderList( true, gNetPlayerWall::gWallRenderMode_Quads );
04136         run = next;
04137     }
04138 
04139     RenderEnd();

Here is the call graph for this function:

bool gCycleWallsDisplayListManager::Walls (  )  const [inline]

Definition at line 130 of file gCycle.h.

References wallList_, and wallsWithDisplayList_.

00131     {
00132         return wallList_ || wallsWithDisplayList_;
00133     }

void gCycleWallsDisplayListManager::Clear ( int  inhibit = 0  )  [inline]

Definition at line 135 of file gCycle.h.

References rDisplayList::Clear(), and displayList_.

00136     {
00137         displayList_.Clear( inhibit );
00138     }

Here is the call graph for this function:


Friends And Related Function Documentation

friend class gNetPlayerWall [friend]

Definition at line 121 of file gCycle.h.


Member Data Documentation

gNetPlayerWall* gCycleWallsDisplayListManager::wallList_ [private]

linked list of all walls

Definition at line 140 of file gCycle.h.

Referenced by RenderAll(), and Walls().

gNetPlayerWall* gCycleWallsDisplayListManager::wallsWithDisplayList_ [private]

linked list of all walls with display list

Definition at line 141 of file gCycle.h.

Referenced by RenderAll(), and Walls().

rDisplayList gCycleWallsDisplayListManager::displayList_ [private]

combined display list

Definition at line 142 of file gCycle.h.

Referenced by Clear(), and RenderAll().

REAL gCycleWallsDisplayListManager::wallsWithDisplayListMinDistance_ [private]

minimal distance of the walls with display list

Definition at line 143 of file gCycle.h.

Referenced by RenderAll().

int gCycleWallsDisplayListManager::wallsInDisplayList_ [private]

number of walls in the current display list

Definition at line 144 of file gCycle.h.

Referenced by RenderAll().


The documentation for this class was generated from the following files:
Generated on Sat Mar 15 23:38:48 2008 for Armagetron Advanced by  doxygen 1.5.4