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/pacs/collision_surface_temp.h"
26 // ***************************************************************************
27 const uint32 StartEdgeCollideNodeSize
= 128; // mem: 48*128= 6144
28 const uint32 StartCollisionChainSize
= 128; // mem: 24*128= 3072
29 const uint32 StartEdgeChainEntrySize
= 1024; // mem: 6*1024= 6144
30 const uint32 StartCollisionDescSize
= 64; // mem: 36*64= 2304
31 const uint32 StartCollisionInstanceSize
= 64; // mem: 4*64= 256
32 // Total default memory cost by CCollisionSurfaceTemp: 18Ko + 128Ko (OChainLUT).
35 // ***************************************************************************
36 CCollisionSurfaceTemp::CCollisionSurfaceTemp()
38 memset(OChainLUT
, 0xFF, 65536*sizeof(uint16
));
39 memset(SurfaceLUT
, 0x00, 65536*sizeof(CSurfaceLUTEntry
));
40 _EdgeCollideNodes
.reserve(StartEdgeCollideNodeSize
);
41 CollisionChains
.reserve(StartCollisionChainSize
);
42 EdgeChainEntries
.reserve(StartEdgeChainEntrySize
);
43 CollisionDescs
.reserve(StartCollisionDescSize
);
44 MoveDescs
.reserve(StartCollisionDescSize
);
45 RotDescs
.reserve(StartCollisionDescSize
);
46 CollisionInstances
.reserve(StartCollisionInstanceSize
);
47 PossibleSurfaces
.reserve(32);
53 // ***************************************************************************
54 void CCollisionSurfaceTemp::resetEdgeCollideNodes()
56 _EdgeCollideNodes
.clear();
58 // ***************************************************************************
59 uint32
CCollisionSurfaceTemp::allocEdgeCollideNode(uint32 size
)
61 uint32 id
= (uint32
)_EdgeCollideNodes
.size();
62 _EdgeCollideNodes
.resize(id
+size
);
65 // ***************************************************************************
66 CEdgeCollideNode
&CCollisionSurfaceTemp::getEdgeCollideNode(uint32 id
)
68 return _EdgeCollideNodes
[id
];