Tizen 2.1 base
[platform/upstream/libbullet.git] / Extras / PhysicsEffects / include / physics_effects / base_level / collision / pfx_collidable.h
1 /*\r
2 Physics Effects Copyright(C) 2010 Sony Computer Entertainment Inc.\r
3 All rights reserved.\r
4 \r
5 Physics Effects is open software; you can redistribute it and/or\r
6 modify it under the terms of the BSD License.\r
7 \r
8 Physics Effects is distributed in the hope that it will be useful,\r
9 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
11 See the BSD License for more details.\r
12 \r
13 A copy of the BSD License is distributed with\r
14 Physics Effects under the filename: physics_effects_license.txt\r
15 */\r
16 \r
17 #ifndef _SCE_PFX_COLLIDABLE_H\r
18 #define _SCE_PFX_COLLIDABLE_H\r
19 \r
20 #include "pfx_shape.h"\r
21 \r
22 namespace sce {\r
23 namespace PhysicsEffects {\r
24 \r
25 #define SCE_PFX_NUMPRIMS 64\r
26 \r
27 ///////////////////////////////////////////////////////////////////////////////\r
28 // Collidable Object\r
29 \r
30 class SCE_PFX_ALIGNED(128) PfxCollidable\r
31 {\r
32 friend class PfxShapeIterator;\r
33 \r
34 private:\r
35         PfxShape *m_shapeBase;\r
36         PfxUInt16 m_shapeIds[SCE_PFX_NUMPRIMS];\r
37         PfxUInt8 m_numShapes;\r
38         PfxUInt8 m_maxShapes;\r
39         SCE_PFX_PADDING(1,2)\r
40         PfxFloat m_center[3];   // AABB center (Local)\r
41         PfxFloat m_half[3];             // AABB half (Local)\r
42         PfxShape m_defShape;\r
43         SCE_PFX_PADDING(2,32)\r
44 \r
45         inline PfxShape &getNewShape();\r
46 \r
47 public:\r
48         inline void reset();\r
49         inline void reset(PfxShape *base,PfxUInt16 *ids,int n=1);\r
50 \r
51         void finish();\r
52 \r
53         void addShape(const PfxShape &shape);\r
54 \r
55         inline PfxUInt32 getNumShapes() const;\r
56         const PfxShape& getDefShape() const {return m_defShape;}\r
57         PfxShape& getDefShape() {return m_defShape;}\r
58 \r
59         inline PfxUInt16 getShapeId(int i) const;\r
60 \r
61         inline const PfxShape& getShape(int i) const;\r
62         inline PfxShape& getShape(int i);\r
63 \r
64         inline PfxVector3 getHalf() const;\r
65         inline PfxVector3 getCenter() const;\r
66 };\r
67 \r
68 #include "pfx_collidable_implementation.h"\r
69 \r
70 } // namespace PhysicsEffects\r
71 } // namespace sce\r
72 \r
73 #endif // _SCE_PFX_COLLIDABLE_H\r
74 \r