![]() |
PURE API 0.5
PR00F's Ultimate Rendering Engine full documentation
|
3D object manager class. More...
3D object manager class.
Besides the usual PureManager way of iterating over its managed instances, a few more functions are available for iterating:
Definition at line 223 of file PureObject3DManager.h.
#include <PureObject3DManager.h>
Classes | |
class | PureObject3DManagerImpl |
Public Member Functions | |
PureObject3DManager (PureTextureManager &texMgr, PureMaterialManager &matMgr) | |
virtual | ~PureObject3DManager () |
virtual void | Attach (PureManaged &m) |
Adds the given managed to the manager, if the managed has no manager yet. | |
virtual void | Detach (PureManaged &m) |
Removes the given managed from the manager, so the managed will have no manager. | |
CConsole & | getConsole () const |
Returns access to console preset with logger module name as this class. | |
TPureBool | isInitialized () const |
Tells whether the manager is correctly initialized or not. | |
std::deque< PureObject3D * > & | getOccluders () |
Get a list of occluders. | |
const std::deque< PureObject3D * > & | getOccluders () const |
Get a list of occluders. | |
std::deque< PureObject3D * > & | get3dOpaqueOccludees () |
Get a list of 3D (non-sticked) opaque (non-blended) occludees. | |
const std::deque< PureObject3D * > & | get3dOpaqueOccludees () const |
Get a list of 3D (non-sticked) opaque (non-blended) occludees. | |
std::deque< PureObject3D * > & | get3dBlendedOccludees () |
Get a list of 3D (non-sticked) blended occludees. | |
const std::deque< PureObject3D * > & | get3dBlendedOccludees () const |
Get a list of 3D (non-sticked) blended occludees. | |
std::deque< PureObject3D * > & | get2dOpaqueOccludees () |
Get a list of 2D (sticked) opaque (non-blended) occludees. | |
const std::deque< PureObject3D * > & | get2dOpaqueOccludees () const |
Get a list of 2D (sticked) opaque (non-blended) occludees. | |
std::deque< PureObject3D * > & | get2dBlendedOccludees () |
Get a list of 2D (sticked) blended occludees. | |
const std::deque< PureObject3D * > & | get2dBlendedOccludees () const |
Get a list of 2D (sticked) blended occludees. | |
PureObject3D * | createPlane (TPureFloat a, TPureFloat b, TPURE_VERTEX_MODIFYING_HABIT vmod=PURE_VMOD_STATIC, TPURE_VERTEX_REFERENCING_MODE vref=PURE_VREF_DIRECT, TPureBool bForceUseClientMemory=false) |
Creates a new plane with the given sizes. | |
PureObject3D * | createBox (TPureFloat a, TPureFloat b, TPureFloat c, TPURE_VERTEX_MODIFYING_HABIT vmod=PURE_VMOD_STATIC, TPURE_VERTEX_REFERENCING_MODE vref=PURE_VREF_DIRECT, TPureBool bForceUseClientMemory=false) |
Creates a new box with the given sizes. | |
PureObject3D * | createCube (TPureFloat a, TPURE_VERTEX_MODIFYING_HABIT vmod=PURE_VMOD_STATIC, TPURE_VERTEX_REFERENCING_MODE vref=PURE_VREF_DIRECT, TPureBool bForceUseClientMemory=false) |
Creates a new cube with the given sizes. | |
PureObject3D * | createFromFile (const char *filename, TPURE_VERTEX_MODIFYING_HABIT vmod, TPURE_VERTEX_REFERENCING_MODE vref, TPureBool bForceUseClientMemory=false) |
Creates object from the given file. | |
PureObject3D * | createFromFile (const char *filename) |
Creates object from the given file. | |
PureObject3D * | createCloned (PureObject3D &referredobj) |
Creates a new object by cloning an already existing object. | |
void | UpdateOccluderStates () |
Iterates over its manageds and updates their occluder states. | |
TPureFloat | getOccluderSelectionBias () const |
Gets the occluder selection bias. | |
void | SetOccluderSelectionBias (TPureFloat fBias) |
Sets the occluder selection bias. | |
TPureUInt | getMaxOccluderCount () const |
Gets the maximum number of occluders. | |
void | SetMaxOccluderCount (TPureUInt nMax) |
Sets the maximum number of occluders. | |
virtual void | HandleManagedPropertyChanged (PureManaged &m) |
Should be invoked when a managed's property got changed from a different kind of manager or managed. | |
void | ResetStatistics () |
Resets any kind of statistics collected during its lifetime. | |
TPureUInt | getUsedVideoMemory () const |
Gets the amount of allocated video memory for all objects owner by this manager. | |
virtual void | WriteList () const |
From PureMesh3DManager, adding logging vertex transfer and object data, including some occlusion query stats. | |
![]() | |
PureMesh3DManager (PureMaterialManager &matMgr) | |
virtual | ~PureMesh3DManager () |
CConsole & | getConsole () const |
Returns access to console preset with logger module name as this class. | |
TPureBool | isInitialized () const |
Tells whether the object is correctly initialized or not. | |
TPureBool | isMinimalIndexStorageEnabled () const |
Tells whether storage of indices is minimalized or not. | |
void | SetMinimalIndexStorageEnabled (TPureBool state) |
Sets whether storage of indices is minimalized or not. | |
PureMesh3D * | createPlane (TPureFloat a, TPureFloat b) |
Creates a new plane with the given sizes. | |
PureMesh3D * | createBox (TPureFloat a, TPureFloat b, TPureFloat c) |
Creates a new box with the given sizes. | |
PureMesh3D * | createCube (TPureFloat a) |
Creates a new cube with the given sizes. | |
![]() | |
PureFiledManager () | |
virtual | ~PureFiledManager () |
CConsole & | getConsole () const |
Returns access to console preset with logger module name as this class. | |
PureFiledManaged * | getByFilename (const char *filename) const |
Gets the FiledManaged by the specified filename. | |
![]() | |
PureManager () | |
virtual | ~PureManager () |
CConsole & | getConsole () const |
Returns access to console preset with logger module name as this class. | |
TPureInt | getCount () const |
Gets the number of managed objects. | |
TPureBool | isEmpty () const |
Is the number of manageds 0? | |
TPureInt | getSize () const |
Gets the number of allocated slots for managed objects; getSize() >= getCount(). | |
PureManaged * | getAttachedAt (TPureInt ind) const |
Gets the pointer to the managed at the given index. | |
TPureInt | getAttachedIndex (const PureManaged &m) const |
Gets the index of the given managed. | |
void | PreAlloc (TPureInt count) |
Allocates count free slots for manageds. | |
TPureBool | hasAttached (const PureManaged &m) const |
Gets whether the given managed is managed by this manager. | |
void | DeleteAttachedInstance (PureManaged &m) |
Removes the given managed from the manager and destructs it. | |
void | DeleteAll () |
Removes and destructs every managed element in the manager. | |
virtual TPureUInt | getUsedSystemMemory () const |
Gets the amount of allocated system memory for all manageds owner by this manager. | |
Static Public Member Functions | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
![]() | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
![]() | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
![]() | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
Protected Member Functions | |
PureObject3DManager () | |
PureObject3DManager (const PureObject3DManager &) | |
PureObject3DManager & | operator= (const PureObject3DManager &) |
virtual void | WriteListCallback (const PureManaged &mngd) const |
From PureManager, printing filename. | |
![]() | |
PureMesh3DManager () | |
PureMesh3DManager (const PureMesh3DManager &) | |
PureMesh3DManager & | operator= (const PureMesh3DManager &) |
![]() | |
PureFiledManager (const PureFiledManager &) | |
PureFiledManager & | operator= (const PureFiledManager &) |
![]() | |
PureManager (const PureManager &other) | |
PureManager & | operator= (const PureManager &) |
Private Attributes | |
PureObject3DManagerImpl * | pImpl |
PureObject3DManager::PureObject3DManager | ( | PureTextureManager & | texMgr, |
PureMaterialManager & | matMgr ) |
texMgr | A TextureManager instance to be used for loading textures used by Object3D instances. |
matMgr | A MaterialManager instance to be used for creating materials used by Object3D instances. |
std::bad_alloc | - This class or its ancestor dynamically allocates memory with operator new, in case of failure the exception is not handled but propagated to caller. |
Definition at line 234 of file PureObject3DManager.cpp.
|
virtual |
Definition at line 241 of file PureObject3DManager.cpp.
|
protected |
std::bad_alloc | - This class or its ancestor dynamically allocates memory with operator new, in case of failure the exception is not handled but propagated to caller. |
Definition at line 1259 of file PureObject3DManager.cpp.
|
protected |
Definition at line 1265 of file PureObject3DManager.cpp.
|
virtual |
Adds the given managed to the manager, if the managed has no manager yet.
No effect if given managed already has a manager. The object will be present in get3dOpaqueOccludees() or get2dOpaqueOccludees() list based on its sticked-to-screen property since it will be attached as non-blended.
Reimplemented from PureManager.
Definition at line 253 of file PureObject3DManager.cpp.
PureObject3D * PureObject3DManager::createBox | ( | TPureFloat | a, |
TPureFloat | b, | ||
TPureFloat | c, | ||
TPURE_VERTEX_MODIFYING_HABIT | vmod = PURE_VMOD_STATIC, | ||
TPURE_VERTEX_REFERENCING_MODE | vref = PURE_VREF_DIRECT, | ||
TPureBool | bForceUseClientMemory = false ) |
Creates a new box with the given sizes.
This box consists of quads instead of triangles and has 24 vertices. Every vertex has a normal, a color, and texture uvw-coordinates in separate arrays. All faces are defined counter-clockwise starting from the lower left vertex, thus the order of texture uvw-coordinates are the same for each face. Order of faces is: front face towards the viewer, back, left, right, top, bottom.
a | Length of box (size on X-axis). |
b | Height of box (size on Y-axis). |
c | Depth of box (size on Z-axis). |
vmod | What vertex modifying habit to be set for the new Object3D instance. |
vref | What vertex referencing mode to be set for the new Object3D instance. |
bForceUseClientMemory | Force-select a vertex transfer mode storing geometry in client memory instead of server memory. Please note that this is considered only if dynamic modifying habit is specified. Specifying static modifying habit will always select a mode which places geometry data into server memory. |
Definition at line 572 of file PureObject3DManager.cpp.
PureObject3D * PureObject3DManager::createCloned | ( | PureObject3D & | referredobj | ) |
Creates a new object by cloning an already existing object.
The clone will have its own properties such as position, visibility, etc. but the geometry will not be cloned, just referenced. Useful for saving memory on geometry data on both client and server side. Note that it is the user's responsibility to delete all clones of an object before trying to delete the original object.
Definition at line 860 of file PureObject3DManager.cpp.
PureObject3D * PureObject3DManager::createCube | ( | TPureFloat | a, |
TPURE_VERTEX_MODIFYING_HABIT | vmod = PURE_VMOD_STATIC, | ||
TPURE_VERTEX_REFERENCING_MODE | vref = PURE_VREF_DIRECT, | ||
TPureBool | bForceUseClientMemory = false ) |
Creates a new cube with the given sizes.
Equivalent to createBox(a, a, a).
a | Length of edges. |
vmod | What vertex modifying habit to be set for the new Object3D instance. |
vref | What vertex referencing mode to be set for the new Object3D instance. |
bForceUseClientMemory | Force-select a vertex transfer mode storing geometry in client memory instead of server memory. Please note that this is considered only if dynamic modifying habit is specified. Specifying static modifying habit will always select a mode which places geometry data into server memory. |
Definition at line 653 of file PureObject3DManager.cpp.
|
virtual |
Creates object from the given file.
Equals to calling createFromFile(filename, PURE_VMOD_STATIC, PURE_VREF_INDEXED, false).
filename | The model file to be loaded to be an Object3D instance. |
Reimplemented from PureMesh3DManager.
Definition at line 845 of file PureObject3DManager.cpp.
PureObject3D * PureObject3DManager::createFromFile | ( | const char * | filename, |
TPURE_VERTEX_MODIFYING_HABIT | vmod, | ||
TPURE_VERTEX_REFERENCING_MODE | vref, | ||
TPureBool | bForceUseClientMemory = false ) |
Creates object from the given file.
filename | The model file to be loaded to be an Object3D instance. |
vmod | What vertex modifying habit to be set for the new Object3D instance. |
vref | What vertex referencing mode to be set for the new Object3D instance. |
bForceUseClientMemory | Force-select a vertex transfer mode storing geometry in client memory instead of server memory. Please note that this is considered only if dynamic modifying habit is specified. Specifying static modifying habit will always select a mode which places geometry data into server memory. |
Definition at line 688 of file PureObject3DManager.cpp.
PureObject3D * PureObject3DManager::createPlane | ( | TPureFloat | a, |
TPureFloat | b, | ||
TPURE_VERTEX_MODIFYING_HABIT | vmod = PURE_VMOD_STATIC, | ||
TPURE_VERTEX_REFERENCING_MODE | vref = PURE_VREF_DIRECT, | ||
TPureBool | bForceUseClientMemory = false ) |
Creates a new plane with the given sizes.
a | Length of plane (size on X-axis). |
b | Height of plane (size on Y-axis). |
vmod | What vertex modifying habit to be set for the new Object3D instance. |
vref | What vertex referencing mode to be set for the new Object3D instance. |
bForceUseClientMemory | Force-select a vertex transfer mode storing geometry in client memory instead of server memory. Please note that this is considered only if dynamic modifying habit is specified. Specifying static modifying habit will always select a mode which places geometry data into server memory. |
Definition at line 485 of file PureObject3DManager.cpp.
|
virtual |
Removes the given managed from the manager, so the managed will have no manager.
The object will not be occlusion tested, and won't be an occluder, and actually it will NOT be present in any of the following lists: getOccluders(), get3dOpaqueOccludees(), get3dBlendedOccludees(), get2dOpaqueOccludees() and get2dBlendedOccludees().
Reimplemented from PureManager.
Definition at line 280 of file PureObject3DManager.cpp.
std::deque< PureObject3D * > & PureObject3DManager::get2dBlendedOccludees | ( | ) |
Get a list of 2D (sticked) blended occludees.
If you want to get all the 2D (sticked) blended occludees, this way is faster than iterating over all objects and checking their properties.
Definition at line 453 of file PureObject3DManager.cpp.
const std::deque< PureObject3D * > & PureObject3DManager::get2dBlendedOccludees | ( | ) | const |
Get a list of 2D (sticked) blended occludees.
If you want to get all the 2D (sticked) blended occludees, this way is faster than iterating over all objects and checking their properties.
Definition at line 465 of file PureObject3DManager.cpp.
std::deque< PureObject3D * > & PureObject3DManager::get2dOpaqueOccludees | ( | ) |
Get a list of 2D (sticked) opaque (non-blended) occludees.
If you want to get all the 2D (sticked) opaque occludees, this way is faster than iterating over all objects and checking their properties.
Definition at line 429 of file PureObject3DManager.cpp.
const std::deque< PureObject3D * > & PureObject3DManager::get2dOpaqueOccludees | ( | ) | const |
Get a list of 2D (sticked) opaque (non-blended) occludees.
If you want to get all the 2D (sticked) opaque occludees, this way is faster than iterating over all objects and checking their properties.
Definition at line 441 of file PureObject3DManager.cpp.
std::deque< PureObject3D * > & PureObject3DManager::get3dBlendedOccludees | ( | ) |
Get a list of 3D (non-sticked) blended occludees.
If you want to get all the 3D (non-sticked) blended occludees, this way is faster than iterating over all objects and checking their properties.
Definition at line 405 of file PureObject3DManager.cpp.
const std::deque< PureObject3D * > & PureObject3DManager::get3dBlendedOccludees | ( | ) | const |
Get a list of 3D (non-sticked) blended occludees.
If you want to get all the 3D (non-sticked) blended occludees, this way is faster than iterating over all objects and checking their properties.
Definition at line 417 of file PureObject3DManager.cpp.
std::deque< PureObject3D * > & PureObject3DManager::get3dOpaqueOccludees | ( | ) |
Get a list of 3D (non-sticked) opaque (non-blended) occludees.
If you want to get all the 3D (non-sticked) opaque occludees, this way is faster than iterating over all objects and checking their properties.
Definition at line 381 of file PureObject3DManager.cpp.
const std::deque< PureObject3D * > & PureObject3DManager::get3dOpaqueOccludees | ( | ) | const |
Get a list of 3D (non-sticked) opaque (non-blended) occludees.
If you want to get all the 3D (non-sticked) opaque occludees, this way is faster than iterating over all objects and checking their properties.
Definition at line 393 of file PureObject3DManager.cpp.
CConsole & PureObject3DManager::getConsole | ( | ) | const |
Returns access to console preset with logger module name as this class.
Intentionally not virtual, so the getConsole() in derived class should hide this instead of overriding.
Definition at line 322 of file PureObject3DManager.cpp.
|
static |
Returns the logger module name of this class.
Intentionally not virtual, so derived class should hide this instead of overriding. Not even private, so user can also access this from outside, for any reason like controlling log filtering per logger module name.
Definition at line 335 of file PureObject3DManager.cpp.
TPureUInt PureObject3DManager::getMaxOccluderCount | ( | ) | const |
Gets the maximum number of occluders.
See details at SetMaxOccluderCount().
Definition at line 1103 of file PureObject3DManager.cpp.
std::deque< PureObject3D * > & PureObject3DManager::getOccluders | ( | ) |
Get a list of occluders.
If you want to get all the occluders, this way is faster than iterating over all objects and checking if they are occluders.
Definition at line 357 of file PureObject3DManager.cpp.
const std::deque< PureObject3D * > & PureObject3DManager::getOccluders | ( | ) | const |
Get a list of occluders.
If you want to get all the occluders, this way is faster than iterating over all objects and checking if they are occluders.
Definition at line 369 of file PureObject3DManager.cpp.
TPureFloat PureObject3DManager::getOccluderSelectionBias | ( | ) | const |
Gets the occluder selection bias.
See details at SetOccluderSelectionBias().
Definition at line 1073 of file PureObject3DManager.cpp.
TPureUInt PureObject3DManager::getUsedVideoMemory | ( | ) | const |
Gets the amount of allocated video memory for all objects owner by this manager.
Gets the amount of allocated video memory for all objects owned by this manager.
Definition at line 1203 of file PureObject3DManager.cpp.
|
virtual |
Should be invoked when a managed's property got changed from a different kind of manager or managed.
PureObject3DManager is interested in some property changes related to its managed PureObject3D instances, e.g. blend mode that might change in a PureMaterial instance.
Reimplemented from PureManager.
Definition at line 1129 of file PureObject3DManager.cpp.
TPureBool PureObject3DManager::isInitialized | ( | ) | const |
Tells whether the manager is correctly initialized or not.
Definition at line 345 of file PureObject3DManager.cpp.
|
protected |
Definition at line 1271 of file PureObject3DManager.cpp.
void PureObject3DManager::ResetStatistics | ( | ) |
Resets any kind of statistics collected during its lifetime.
Saves and resets current statistics.
Useful if you want to restart measurements. The saved statistics can be logged logged by WriteList() anytime later.
Definition at line 1166 of file PureObject3DManager.cpp.
void PureObject3DManager::SetMaxOccluderCount | ( | TPureUInt | nMax | ) |
Sets the maximum number of occluders.
In some circumstances you might change the maximum number of occluders because for different scenes you might need different number of occluders to achieve higher rendering performance. Without this limit, UpdateOccluderStates() might choose too many objects as occluder based on their sizes, however those objects won't be checked for occlusion, but you might want them to act as occludees instead of occluders. Objects with biggest scaled area will be set for occluders. This means that if you set this maximum number to 2, then the 2 objects having the 2 biggest scaled area will be selected as occluder. Setting this value to 0 means there won't be any occluder selected. Default value is 4.
Definition at line 1119 of file PureObject3DManager.cpp.
void PureObject3DManager::SetOccluderSelectionBias | ( | TPureFloat | fBias | ) |
Sets the occluder selection bias.
By default objects are selected as occluders if their biggest scaled area size is bigger than the average scaled area size of all objects. If for any reason this is not suitable for your scene, you can set a bias value with this function. This bias will be multiplied by the average scaled area size of all objects when comparison will happen. So, if you want fewer objects to be selected as occluder, set a bigger bias value. If you want more objects to be selected as occluder, set a lower bias value. The default value is 1.0f.
fBias | The new occluder selection bias. |
Definition at line 1090 of file PureObject3DManager.cpp.
void PureObject3DManager::UpdateOccluderStates | ( | ) |
Iterates over its manageds and updates their occluder states.
It uses their getBiggestAreaScaled() values to determine which should be occluder. It sets states on and off, based on how their getBiggestAreaScaled() compare to others'. Objects having any of the following properties are ignored during calculation since they cannot even be occluders:
A renderer might invoke this function periodically based on its configuration.
Definition at line 959 of file PureObject3DManager.cpp.
|
virtual |
From PureMesh3DManager, adding logging vertex transfer and object data, including some occlusion query stats.
Reimplemented from PureMesh3DManager.
Definition at line 1219 of file PureObject3DManager.cpp.
|
protectedvirtual |
From PureManager, printing filename.
Reimplemented from PureMesh3DManager.
Definition at line 1277 of file PureObject3DManager.cpp.
|
private |
Definition at line 311 of file PureObject3DManager.h.