#include <lod_character_shape_bank.h>
Nevrax France
Definition at line 44 of file lod_character_shape_bank.h.
Public Member Functions | |
| CLodCharacterShapeBank () | |
| Constructor. | |
| void | serial (NLMISC::IStream &f) |
| serial | |
build process | |
| uint32 | addShape () |
| Just add a shape to the bank. Use getShapeFullAcces() to fill it. return id of the shape. | |
| bool | compile () |
| uint | getNumShapes () const |
| get number of shape. This is also the MaxID+1. | |
| const CLodCharacterShape * | getShape (uint32 shapeId) const |
| Get a const ref on a shape. Ptr not valid after addShape(). NULL if not found. | |
| CLodCharacterShape * | getShapeFullAcces (uint32 shapeId) |
| sint32 | getShapeIdByName (const std::string &name) const |
| void | reset () |
| reset the shapeBank | |
Private Types | |
| typedef TStrIdMap::const_iterator | CstItStrIdMap |
| typedef TStrIdMap::iterator | ItStrIdMap |
| typedef std::map< std::string, uint32 > | TStrIdMap |
| Map name To Id. | |
Private Attributes | |
| std::vector< CLodCharacterShape > | _ShapeArray |
| Array of shape. | |
| TStrIdMap | _ShapeMap |
| Map of shape id. | |
|
|
Definition at line 93 of file lod_character_shape_bank.h. |
|
|
Definition at line 92 of file lod_character_shape_bank.h. |
|
|
Map name To Id.
Definition at line 91 of file lod_character_shape_bank.h. |
|
|
Constructor.
Definition at line 41 of file lod_character_shape_bank.cpp.
00042 {
00043 }
|
|
|
Just add a shape to the bank. Use getShapeFullAcces() to fill it. return id of the shape.
Definition at line 53 of file lod_character_shape_bank.cpp. References _ShapeArray, and uint32.
00054 {
00055 // Alloc a new shape
00056 _ShapeArray.resize(_ShapeArray.size()+1);
00057
00058 return _ShapeArray.size()-1;
00059 }
|
|
|
re-compile the shape Bank. This must be called after changing a shape, or after adding all your shapes. It return false if same names have been found, but it is still correctly builded. Definition at line 90 of file lod_character_shape_bank.cpp. References _ShapeArray, nlwarning, and uint.
00091 {
00092 bool error= false;
00093
00094 // clear the map
00095 contReset(_ShapeMap);
00096
00097 // build the map
00098 for(uint i=0; i<_ShapeArray.size(); i++)
00099 {
00100 const string &name= _ShapeArray[i].getName();
00101 ItStrIdMap it= _ShapeMap.find(name);
00102 if(it == _ShapeMap.end())
00103 _ShapeMap.insert(make_pair(name, i));
00104 else
00105 {
00106 error= true;
00107 nlwarning("Found a CLod with same name in the bank: %s", name.c_str());
00108 }
00109 }
00110
00111 return error;
00112 }
|
|
|
get number of shape. This is also the MaxID+1.
Definition at line 115 of file lod_character_shape_bank.cpp. References _ShapeArray, and uint.
00116 {
00117 return _ShapeArray.size();
00118 }
|
|
|
Get a const ref on a shape. Ptr not valid after addShape(). NULL if not found.
Definition at line 72 of file lod_character_shape_bank.cpp. References _ShapeArray, and uint32. Referenced by NL3D::CLodCharacterManager::getShape().
00073 {
00074 if(shapeId >= _ShapeArray.size())
00075 return NULL;
00076 else
00077 return &_ShapeArray[shapeId];
00078 }
|
|
|
Get a ptr on a shape. Ptr not valid after addShape(). NULL if not found May be used for example to replace the shape Definition at line 81 of file lod_character_shape_bank.cpp. References _ShapeArray, and uint32.
00082 {
00083 if(shapeId >= _ShapeArray.size())
00084 return NULL;
00085 else
00086 return &_ShapeArray[shapeId];
00087 }
|
|
|
Get a shapeId by its name. -1 if not found. Possible Values are in 0-65535 Call valid only if compile() has been correctly called Definition at line 62 of file lod_character_shape_bank.cpp. References sint32.
00063 {
00064 CstItStrIdMap it= _ShapeMap.find(name);
00065 if(it==_ShapeMap.end())
00066 return -1;
00067 else
00068 return it->second;
00069 }
|
|
|
reset the shapeBank
Definition at line 46 of file lod_character_shape_bank.cpp. References _ShapeArray.
|
|
|
serial
Definition at line 121 of file lod_character_shape_bank.cpp. References _ShapeArray, NLMISC::IStream::serialCont(), and NLMISC::IStream::serialVersion().
00122 {
00123 (void)f.serialVersion(0);
00124
00125 f.serialCont(_ShapeArray);
00126 f.serialCont(_ShapeMap);
00127 }
|
|
|
Array of shape.
Definition at line 99 of file lod_character_shape_bank.h. Referenced by addShape(), compile(), getNumShapes(), getShape(), getShapeFullAcces(), reset(), and serial(). |
|
|
Map of shape id.
Definition at line 102 of file lod_character_shape_bank.h. |
1.3.6