|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NL3D::CShapeBank Class ReferenceA CShapeBank handle all the instance of the shapes and the cache management system.
More...
#include <shape_bank.h>
List of all members.
Shape/Instances. |
typedef NLMISC::CSmartPtr<
IShape > | PShape |
typedef std::map< std::string,
PShape > | TShapeMap |
typedef std::map< std::string,
CWaitingShape > | TWaitingShapesMap |
bool | processWSUploadTexture (CWaitingShape &rWS, uint32 &nTotalUploaded, ITexture *pText) |
| return true if the texture is entirely uploaded. More...
|
TShapeMap | ShapeMap |
TWaitingShapesMap | WaitingShapes |
uint32 | _MaxUploadPerFrame |
IDriver * | _pDriver |
Shape/Caches. |
typedef std::map< std::string,
std::string > | TShapeCacheNameMap |
typedef std::map< std::string,
CShapeCache > | TShapeCacheMap |
typedef std::map< IShape *,
CShapeInfo > | TShapeInfoMap |
std::string * | getShapeNameFromShapePtr (IShape *pShp) |
IShape * | getShapePtrFromShapeName (const std::string &pShpName) |
CShapeCache * | getShapeCachePtrFromShapePtr (IShape *pShp) |
CShapeCache * | getShapeCachePtrFromShapeCacheName (const std::string &shapeCacheName) |
CShapeCache * | getShapeCachePtrFromShapeName (const std::string &shapeName) |
void | checkShapeCache (CShapeCache *pShpCache) |
TShapeCacheNameMap | ShapeNameToShapeCacheName |
TShapeCacheMap | ShapeCacheNameToShapeCache |
TShapeInfoMap | ShapePtrToShapeInfo |
Public Types |
|
enum | TShapeState {
NotPresent,
Present,
AsyncLoad_Error,
AsyncLoad_Shape,
AsyncLoad_Texture,
AsyncLoad_Ready,
AsyncLoad_Delete
} |
| NotPresent : Not present in the bank Present : Present in the bank and ready to be used AsyncLoad_Error : Asynchronous loading failed AsyncLoad_Shape : Asynchronous loading is currently loading the .shape file, textures and lightmaps AsyncLoad_Texture : Asynchronous loading is currently uploading textures and lightmaps to VRAM. More...
|
Public Methods |
| CShapeBank () |
| ~CShapeBank () |
|
IShape * | addRef (const std::string &shapeName) |
| Add a reference to a shape and return the instance created. More...
|
void | release (IShape *pShp) |
| Release a reference to a shape by its instance. More...
|
TShapeState | isPresent (const std::string &shapeName) |
| Return TRUE if the shape is present in the bank. Process the waiting shapes. More...
|
void | load (const std::string &shapeName) |
| Load the corresponding file from disk and add it to the bank. More...
|
void | loadAsync (const std::string &shapeName, IDriver *pDriver, bool *bSignal=NULL) |
| Load the corresponding file from disk asynchronously and add it to the bank. More...
|
void | cancelLoadAsync (const std::string &shapeName) |
bool | isShapeWaiting () |
void | processWaitingShapes () |
| processWaitingShapes must be done one time per frame. More...
|
void | setMaxBytesToUpload (uint32 MaxUploadPerFrame) |
| Setup the maximum number of bytes to upload for a frame (texture upload from RAM to VRAM). More...
|
void | add (const std::string &shapeName, IShape *shape) |
| Add directly a shape to the bank. If the shape name is already used do nothing. More...
|
|
void | addShapeCache (const std::string &shapeCacheName) |
| Add a new ShapeCache. If already exist do nothing. More...
|
void | removeShapeCache (const std::string &shapeCacheName) |
| Remove a ShapeCache. More...
|
bool | isShapeCache (const std::string &shapeCacheName) const |
| true if the shape cache exist. More...
|
void | reset () |
| Remove all ShapeCache and suppress all links (even the link to the default cache are removed). More...
|
void | setShapeCacheSize (const std::string &shapeCacheName, sint32 maxSize) |
| Set the shapeCache shapeCacheName the new size.(delete shapes if maxsize<shapeCacheSize). More...
|
sint | getShapeCacheFreeSpace (const std::string &shapeCacheName) const |
| return free cache space (maxSize-nbCurrentInCache). More...
|
void | linkShapeToShapeCache (const std::string &shapeName, const std::string &shapeCacheName) |
| Link a shape to a ShapeCache. The ShapeCache must exist and must not contains the shape. More...
|
|
void | preLoadShapes (const std::string &shapeCacheName, const std::vector< std::string > &listFile, const std::string &wildCardNotLwr) |
| PreLoad all shapes (.shape, .ps, .skel...) files from a list of files Shapes are Loaded if not present, assigned to the given cache, and fit in the cache Size as max possible. More...
|
Detailed Description
A CShapeBank handle all the instance of the shapes and the cache management system.
There is a default cache. If the shape is not linked explicitly to any cache it is linked to the default cache. The comportement of this cache is to not do any cache. When the release is called on the last reference to a shape linked to this cache, the shape is removed instantly. This is the behavior of all newly created cache before we call the setShapeCacheSize method.
NB: ShapeCacheName is case-sensitive but shapeName are not (all entry are lwrcased)
-
Author:
-
Matthieu Besson , Nevrax France
-
Date:
-
2000
Definition at line 58 of file shape_bank.h.
Member Typedef Documentation
typedef std::map<std::string,CShapeCache> NL3D::CShapeBank::TShapeCacheMap [private]
|
|
typedef std::map<std::string,std::string> NL3D::CShapeBank::TShapeCacheNameMap [private]
|
|
typedef std::map<std::string, PShape> NL3D::CShapeBank::TShapeMap [private]
|
|
typedef std::map< std::string, CWaitingShape > NL3D::CShapeBank::TWaitingShapesMap [private]
|
|
Member Enumeration Documentation
enum NL3D::CShapeBank::TShapeState
|
|
|
NotPresent : Not present in the bank Present : Present in the bank and ready to be used AsyncLoad_Error : Asynchronous loading failed AsyncLoad_Shape : Asynchronous loading is currently loading the .shape file, textures and lightmaps AsyncLoad_Texture : Asynchronous loading is currently uploading textures and lightmaps to VRAM.
-
Enumeration values:
-
NotPresent |
|
Present |
|
AsyncLoad_Error |
|
AsyncLoad_Shape |
|
AsyncLoad_Texture |
|
AsyncLoad_Ready |
|
AsyncLoad_Delete |
|
Definition at line 70 of file shape_bank.h. |
Constructor & Destructor Documentation
NL3D::CShapeBank::CShapeBank |
( |
|
) |
|
|
NL3D::CShapeBank::~CShapeBank |
( |
|
) |
|
|
Member Function Documentation
void NL3D::CShapeBank::add |
( |
const std::string & |
shapeName, |
|
|
IShape * |
shape |
|
) |
|
|
|
Add directly a shape to the bank. If the shape name is already used do nothing.
Referenced by processWaitingShapes. |
IShape* NL3D::CShapeBank::addRef |
( |
const std::string & |
shapeName |
) |
|
|
|
Add a reference to a shape and return the instance created.
Referenced by preLoadShapes. |
void NL3D::CShapeBank::addShapeCache |
( |
const std::string & |
shapeCacheName |
) |
|
|
|
Add a new ShapeCache. If already exist do nothing.
Referenced by CShapeBank, and reset. |
void NL3D::CShapeBank::cancelLoadAsync |
( |
const std::string & |
shapeName |
) |
|
|
void NL3D::CShapeBank::checkShapeCache |
( |
CShapeCache * |
pShpCache |
) |
[private] |
|
sint NL3D::CShapeBank::getShapeCacheFreeSpace |
( |
const std::string & |
shapeCacheName |
) |
const |
|
CShapeCache* NL3D::CShapeBank::getShapeCachePtrFromShapeCacheName |
( |
const std::string & |
shapeCacheName |
) |
[private] |
|
CShapeBank::CShapeCache * NL3D::CShapeBank::getShapeCachePtrFromShapeName |
( |
const std::string & |
shapeName |
) |
[private] |
|
string * NL3D::CShapeBank::getShapeNameFromShapePtr |
( |
IShape * |
pShp |
) |
[private] |
|
IShape * NL3D::CShapeBank::getShapePtrFromShapeName |
( |
const std::string & |
pShpName |
) |
[private] |
|
TShapeState NL3D::CShapeBank::isPresent |
( |
const std::string & |
shapeName |
) |
|
|
|
Return TRUE if the shape is present in the bank. Process the waiting shapes.
Referenced by preLoadShapes. |
bool NL3D::CShapeBank::isShapeCache |
( |
const std::string & |
shapeCacheName |
) |
const |
|
bool NL3D::CShapeBank::isShapeWaiting |
( |
|
) |
|
|
void NL3D::CShapeBank::linkShapeToShapeCache |
( |
const std::string & |
shapeName, |
|
|
const std::string & |
shapeCacheName |
|
) |
|
|
|
Link a shape to a ShapeCache. The ShapeCache must exist and must not contains the shape.
Referenced by preLoadShapes. |
void NL3D::CShapeBank::load |
( |
const std::string & |
shapeName |
) |
|
|
|
Load the corresponding file from disk and add it to the bank.
Referenced by preLoadShapes. |
void NL3D::CShapeBank::loadAsync |
( |
const std::string & |
shapeName, |
|
|
IDriver * |
pDriver, |
|
|
bool * |
bSignal = NULL |
|
) |
|
|
|
Load the corresponding file from disk asynchronously and add it to the bank.
The driver passed to this function is used to know if we have to load the textures.
Definition at line 429 of file shape_bank.cpp.
References _pDriver, ShapeMap, and WaitingShapes. |
void NL3D::CShapeBank::preLoadShapes |
( |
const std::string & |
shapeCacheName, |
|
|
const std::vector< std::string > & |
listFile, |
|
|
const std::string & |
wildCardNotLwr |
|
) |
|
|
|
PreLoad all shapes (.shape, .ps, .skel...) files from a list of files Shapes are Loaded if not present, assigned to the given cache, and fit in the cache Size as max possible.
NB: crash if you try to load a non shape file (eg: a .dds etc...) -
Parameters:
-
shapeCacheName |
name of a shapeCache created with addShapeCache()/setShapeCacheSize(). no-op if don't exist |
fileList |
a list of file names. NB: CPath is used to load the shapes. |
wildcard |
a filter string like: "*.shape", "??_HOM*.shape". NB: strlwr-ed internally |
Definition at line 725 of file shape_bank.cpp.
References addRef, getShapeCacheFreeSpace, isPresent, isShapeCache, linkShapeToShapeCache, load, release, and NLMISC::testWildCard. |
void NL3D::CShapeBank::processWaitingShapes |
( |
|
) |
|
|
|
processWaitingShapes must be done one time per frame.
Definition at line 133 of file shape_bank.cpp.
References _MaxUploadPerFrame, _pDriver, add, AsyncLoad_Delete, AsyncLoad_Error, AsyncLoad_Ready, AsyncLoad_Shape, AsyncLoad_Texture, NL3D::IDRV_MAT_MAXTEXTURES, nlstop, processWSUploadTexture, and WaitingShapes. |
void NL3D::CShapeBank::release |
( |
IShape * |
pShp |
) |
|
|
void NL3D::CShapeBank::removeShapeCache |
( |
const std::string & |
shapeCacheName |
) |
|
|
void NL3D::CShapeBank::reset |
( |
|
) |
|
|
void NL3D::CShapeBank::setMaxBytesToUpload |
( |
uint32 |
MaxUploadPerFrame |
) |
|
|
void NL3D::CShapeBank::setShapeCacheSize |
( |
const std::string & |
shapeCacheName, |
|
|
sint32 |
maxSize |
|
) |
|
|
|
Set the shapeCache shapeCacheName the new size.(delete shapes if maxsize<shapeCacheSize).
|
Member Data Documentation
uint32 NL3D::CShapeBank::_MaxUploadPerFrame [private]
|
|
IDriver* NL3D::CShapeBank::_pDriver [private]
|
|
TShapeMap NL3D::CShapeBank::ShapeMap [private]
|
|
The documentation for this class was generated from the following files:
|
|