1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "nel/3d/lod_character_shape_bank.h"
20 #include "nel/3d/lod_character_shape.h"
23 using namespace NLMISC
;
35 // ***************************************************************************
36 CLodCharacterShapeBank::CLodCharacterShapeBank()
40 // ***************************************************************************
41 void CLodCharacterShapeBank::reset()
43 contReset(_ShapeArray
);
47 // ***************************************************************************
48 uint32
CLodCharacterShapeBank::addShape()
51 _ShapeArray
.resize(_ShapeArray
.size()+1);
53 return (uint32
)_ShapeArray
.size()-1;
56 // ***************************************************************************
57 sint32
CLodCharacterShapeBank::getShapeIdByName(const std::string
&name
) const
59 CstItStrIdMap it
= _ShapeMap
.find(name
);
60 if(it
==_ShapeMap
.end())
66 // ***************************************************************************
67 const CLodCharacterShape
*CLodCharacterShapeBank::getShape(uint32 shapeId
) const
69 if(shapeId
>= _ShapeArray
.size())
72 return &_ShapeArray
[shapeId
];
75 // ***************************************************************************
76 CLodCharacterShape
*CLodCharacterShapeBank::getShapeFullAcces(uint32 shapeId
)
78 if(shapeId
>= _ShapeArray
.size())
81 return &_ShapeArray
[shapeId
];
84 // ***************************************************************************
85 bool CLodCharacterShapeBank::compile()
93 for(uint i
=0; i
<_ShapeArray
.size(); i
++)
95 const string
&name
= _ShapeArray
[i
].getName();
96 ItStrIdMap it
= _ShapeMap
.find(name
);
97 if(it
== _ShapeMap
.end())
98 _ShapeMap
.insert(make_pair(name
, i
));
102 nlwarning("Found a CLod with same name in the bank: %s", name
.c_str());
109 // ***************************************************************************
110 uint
CLodCharacterShapeBank::getNumShapes() const
112 return (uint
)_ShapeArray
.size();
115 // ***************************************************************************
116 void CLodCharacterShapeBank::serial(NLMISC::IStream
&f
)
118 (void)f
.serialVersion(0);
120 f
.serialCont(_ShapeArray
);
121 f
.serialCont(_ShapeMap
);