Billboard helper class. More...
#include <bbcache.hxx>
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. |
Billboard helper class.
Definition at line 34 of file bbcache.hxx.
int SGBbCache::alloc | ( | int | cldId | ) |
Allocate a new impostor.
cldId | the cloud identifier |
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.
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.
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.
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.
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.
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.
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.
bbId | the impostor slot | |
cldId | the cloud identifier |
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
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
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.
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.
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.
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.
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.