Change Encyclo button name and macros icon
[ryzomcore.git] / nel / src / 3d / shape.cpp
blob93e0cccd76b0f233da0ae5cd799b01f3dfd9254d
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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/>.
17 #include "std3d.h"
19 #include "nel/3d/shape.h"
20 #include "nel/3d/transform_shape.h"
21 #include "nel/3d/scene.h"
23 #include <string>
26 using namespace NLMISC;
28 #ifdef DEBUG_NEW
29 #define new DEBUG_NEW
30 #endif
32 namespace NL3D
36 // ***************************************************************************
37 // ***************************************************************************
38 // IShape
39 // ***************************************************************************
40 // ***************************************************************************
43 // ***************************************************************************
44 CTransformShape *IShape::createInstance(CScene &scene)
46 CTransformShape *mo= (CTransformShape*)scene.createModel(NL3D::TransformShapeId);
47 mo->Shape= this;
48 return mo;
52 // ***************************************************************************
53 IShape::IShape()
55 /* ***********************************************
56 * WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance
57 * It can be loaded/called through CAsyncFileManager for instance
58 * ***********************************************/
60 _DistMax= -1;
64 // ***************************************************************************
65 void IShape::setDistMax(float distMax)
67 _DistMax= distMax;
68 // normalize infinite setup.
69 if(distMax<0)
70 _DistMax= -1;
74 // ***************************************************************************
75 void IShape::getAABBox(CAABBox &bbox) const
77 bbox.setCenter(CVector::Null);
78 bbox.setHalfSize(CVector::Null);
82 // ***************************************************************************
83 // ***************************************************************************
84 // CShapeStream
85 // ***************************************************************************
86 // ***************************************************************************
89 // ***************************************************************************
90 CShapeStream::CShapeStream ()
92 _Shape=NULL;
96 // ***************************************************************************
97 CShapeStream::CShapeStream (IShape* shape)
99 // Set the pointer
100 setShapePointer (shape);
104 // ***************************************************************************
105 void CShapeStream::setShapePointer (IShape* shape)
107 _Shape=shape;
111 // ***************************************************************************
112 IShape* CShapeStream::getShapePointer () const
114 return _Shape;
118 // ***************************************************************************
119 void CShapeStream::serial(NLMISC::IStream &f)
121 // First, serial an header or checking if it is correct
122 f.serialCheck (NELID("PAHS"));
124 // Then, serial the shape
125 f.serialPolyPtr (_Shape);
127 // Ok, it's done
130 } // NL3D