Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / source / gameengine / Physics / common / PHY_DynamicTypes.h
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
4
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose, 
8 including commercial applications, and to alter it and redistribute it freely, 
9 subject to the following restrictions:
10
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15
16
17 #ifndef __PHY_DYNAMIC_TYPES
18 #define __PHY_DYNAMIC_TYPES
19
20
21
22 struct KX_ClientObjectInfo;
23 class PHY_Shape;
24
25 struct  PHY__Vector3
26 {
27         float   m_vec[4];
28
29         operator const float* () const 
30         { 
31                 return &m_vec[0];
32         }       
33         operator float* () 
34         { 
35                 return &m_vec[0];
36         }       
37 };
38
39 struct  PHY__Vector4
40 {
41         float   m_vec[4];
42         PHY__Vector4() {}
43         void setValue(const float *value)
44         {
45                 m_vec[0] = *value++;
46                 m_vec[1] = *value++;
47                 m_vec[2] = *value++;
48                 m_vec[3] = *value++;
49         }
50         void setValue(const double *value)
51         {
52                 m_vec[0] = (float)(*value++);
53                 m_vec[1] = (float)(*value++);
54                 m_vec[2] = (float)(*value++);
55                 m_vec[3] = (float)(*value++);
56         }
57
58         operator const float* () const 
59         { 
60                 return &m_vec[0];
61         }       
62         operator float* () 
63         { 
64                 return &m_vec[0];
65         }       
66 };
67
68 //typedef       float   PHY__Vector3[4];
69
70 enum
71 {
72         PHY_FH_RESPONSE,
73         PHY_SENSOR_RESPONSE,    /* Touch Sensors */
74         PHY_CAMERA_RESPONSE,    /* Visibility Culling */
75         PHY_OBJECT_RESPONSE,    /* Object Dynamic Geometry Response */
76         PHY_STATIC_RESPONSE,    /* Static Geometry Response */
77         PHY_BROADPH_RESPONSE,   /* broadphase Response */
78         
79         PHY_NUM_RESPONSE
80 };
81
82         typedef struct PHY_CollData {
83                 PHY__Vector3 m_point1;               /* Point in object1 in world coordinates */ 
84                 PHY__Vector3 m_point2;               /* Point in object2 in world coordinates */
85                 PHY__Vector3 m_normal;               /* point2 - point1 */ 
86         } PHY_CollData;
87
88
89         typedef bool (*PHY_ResponseCallback)(void *client_data,
90                                                                                    void *client_object1,
91                                                                                    void *client_object2,
92                                                                                    const PHY_CollData *coll_data);
93         typedef void (*PHY_CullingCallback)(KX_ClientObjectInfo* info, void* param);
94
95
96 /// PHY_PhysicsType enumerates all possible Physics Entities.
97 /// It is mainly used to create/add Physics Objects
98
99 typedef enum PHY_PhysicsType {
100         PHY_CONVEX_RIGIDBODY=16386,
101         PHY_CONCAVE_RIGIDBODY=16399,
102         PHY_CONVEX_FIXEDBODY=16388,//'collision object'
103         PHY_CONCAVE_FIXEDBODY=16401,
104         PHY_CONVEX_KINEMATICBODY=16387,// 
105         PHY_CONCAVE_KINEMATICBODY=16400,
106         PHY_CONVEX_PHANTOMBODY=16398,
107         PHY_CONCAVE_PHANTOMBODY=16402
108 } PHY_PhysicsType;
109
110 /// PHY_ConstraintType enumerates all supported Constraint Types
111 typedef enum PHY_ConstraintType {
112         PHY_POINT2POINT_CONSTRAINT=1,
113         PHY_LINEHINGE_CONSTRAINT=2,
114         PHY_ANGULAR_CONSTRAINT = 3,//hinge without ball socket
115         PHY_CONE_TWIST_CONSTRAINT = 4,
116         PHY_VEHICLE_CONSTRAINT=11,//complex 'constraint' that turns a rigidbody into a vehicle
117         PHY_GENERIC_6DOF_CONSTRAINT=12,//can leave any of the 6 degree of freedom 'free' or 'locked'
118
119 } PHY_ConstraintType;
120
121 typedef enum PHY_ShapeType {
122         PHY_SHAPE_NONE,
123         PHY_SHAPE_BOX,
124         PHY_SHAPE_SPHERE,
125         PHY_SHAPE_CYLINDER,
126         PHY_SHAPE_CONE,
127         PHY_SHAPE_MESH,
128         PHY_SHAPE_POLYTOPE,
129         PHY_SHAPE_COMPOUND,
130         PHY_SHAPE_PROXY
131 } PHY_ShapeType;
132
133
134 typedef float   PHY_Vector3[3];
135
136 #endif //__PHY_DYNAMIC_TYPES
137