SGBbCache Class Reference

Billboard helper class. More...

#include <bbcache.hxx>

List of all members.

Public Member Functions

void init (int cacheCount)
 Call this first to initialize the cache.
void free (int bbId, int cldId)
 Free one cache slot, usualy when the cached object is destroyed.
int alloc (int cldId)
 Allocate a new impostor.
GLuint QueryTexID (int cldId, int bbId)
 Query the texture name associated with this cloud.
void setTextureData (int bbId)
 Save the rendered texture from the current context to a new texture.
void beginCapture (void)
 Start the rendering of a billboard in the RTT context.
void setRadius (float radius, float dist_center)
 Adjust the projection matrix of the RTT context to the size of the object.
void endCapture (void)
 Forget the RTT and go back to the previous rendering context.
int queryImpostorAge (int bbId)
 For debugging only, give the number of frames since the impostor was built.
bool isBbValid (int cloudId, int bbId, float angleY, float angleX)
 Can we still use this impostor ? Check versus view angles and load.
void setReference (int cloudId, int bbId, float angleY, float angleX)
 Save view angles of this billboard.
void startNewFrame (void)
 Prepare the cache for the rendering of a new frame.
bool setCacheSize (int sizeKb)
 Alloc the impostors texture memory given the size of the memory pool.
bool setCacheSize (int count, int textureDimension)
 Alloc the impostors texture memory given the count and size of texture.
void invalidateCache (void)
 Force all impostors to be rebuilt.
void invalidate (int cldId, int bbId)
 Flag the impostor for a lazy update.
int queryCacheSize (void)
 Return the size of the memory pool used by texture impostors.

Public Attributes

int maxImpostorRegenFrame
 Maximum number of impostor to regen each frame.

Detailed Description

Billboard helper class.

Definition at line 34 of file bbcache.hxx.


Member Function Documentation

int SGBbCache::alloc ( int  cldId  ) 

Allocate a new impostor.

Parameters:
cldId the cloud identifier
Returns:
an impostor slot

Definition at line 224 of file bbcache.cxx.

void SGBbCache::free ( int  bbId,
int  cldId 
)

Free one cache slot, usualy when the cached object is destroyed.

Parameters:
bbId the impostor slot
cldId the cloud identifier

Definition at line 216 of file bbcache.cxx.

void SGBbCache::init ( int  cacheCount  ) 

Call this first to initialize the cache.

Parameters:
cacheCount the number of texture to allocate

Definition at line 109 of file bbcache.cxx.

void SGBbCache::invalidate ( int  cldId,
int  bbId 
)

Flag the impostor for a lazy update.

Parameters:
bbId the impostor slot
cldId the cloud identifier

Definition at line 367 of file bbcache.cxx.

bool SGBbCache::isBbValid ( int  cloudId,
int  bbId,
float  angleY,
float  angleX 
)

Can we still use this impostor ? Check versus view angles and load.

Parameters:
bbId the impostor slot
cloudId the cloud identifier
angleY rotation needed to face the impostor
angleX rotation needed to face the impostor

Definition at line 308 of file bbcache.cxx.

int SGBbCache::queryCacheSize ( void   ) 

Return the size of the memory pool used by texture impostors.

Returns:
size of the memory pool in Kb

Definition at line 212 of file bbcache.cxx.

int SGBbCache::queryImpostorAge ( int  bbId  ) 

For debugging only, give the number of frames since the impostor was built.

Parameters:
bbId the impostor slot

Definition at line 249 of file bbcache.cxx.

GLuint SGBbCache::QueryTexID ( int  cldId,
int  bbId 
)

Query the texture name associated with this cloud.

Parameters:
bbId the impostor slot
cldId the cloud identifier
Returns:
a texture name

Definition at line 241 of file bbcache.cxx.

bool SGBbCache::setCacheSize ( int  count,
int  textureDimension 
)

Alloc the impostors texture memory given the count and size of texture.

If count == 0 then the memory pool is freed and impostors are disabled

Parameters:
count number of texture to allocate
textureDimension size of each texture in pixels

Definition at line 159 of file bbcache.cxx.

bool SGBbCache::setCacheSize ( int  sizeKb  ) 

Alloc the impostors texture memory given the size of the memory pool.

If sizeKb == 0 then the memory pool is freed and impostors are disabled

Parameters:
sizeKb size of the texture pool in K

Definition at line 188 of file bbcache.cxx.

void SGBbCache::setRadius ( float  radius,
float  dist_center 
)

Adjust the projection matrix of the RTT context to the size of the object.

Parameters:
radius radius in meters of the object to draw
dist_center distance between viewer and object

Definition at line 265 of file bbcache.cxx.

void SGBbCache::setReference ( int  cloudId,
int  bbId,
float  angleY,
float  angleX 
)

Save view angles of this billboard.

Parameters:
bbId the impostor slot
cloudId the cloud identifier
angleY rotation needed to face the impostor
angleX rotation needed to face the impostor

Definition at line 336 of file bbcache.cxx.

void SGBbCache::setTextureData ( int  bbId  ) 

Save the rendered texture from the current context to a new texture.

Parameters:
bbId the impostor slot

Definition at line 284 of file bbcache.cxx.

void SGBbCache::startNewFrame ( void   ) 

Prepare the cache for the rendering of a new frame.

Do some garbage collect of unused impostors

Definition at line 345 of file bbcache.cxx.


Member Data Documentation

Maximum number of impostor to regen each frame.

If we can't update all of them we will do that in the next frame

Definition at line 202 of file bbcache.hxx.


The documentation for this class was generated from the following files:

Generated on 23 Feb 2010 for SimGear by  doxygen 1.6.1