Blender  V2.59
PHY_DynamicTypes.h
Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
00004 
00005 This software is provided 'as-is', without any express or implied warranty.
00006 In no event will the authors be held liable for any damages arising from the use of this software.
00007 Permission is granted to anyone to use this software for any purpose, 
00008 including commercial applications, and to alter it and redistribute it freely, 
00009 subject to the following restrictions:
00010 
00011 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.
00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00013 3. This notice may not be removed or altered from any source distribution.
00014 */
00015 
00020 #ifndef __PHY_DYNAMIC_TYPES
00021 #define __PHY_DYNAMIC_TYPES
00022 
00023 
00024 
00025 struct KX_ClientObjectInfo;
00026 class PHY_Shape;
00027 
00028 struct  PHY__Vector2
00029 {
00030         float   m_vec[2];
00031 
00032         operator const float* () const 
00033         { 
00034                 return &m_vec[0];
00035         }       
00036         operator float* () 
00037         { 
00038                 return &m_vec[0];
00039         }       
00040 };
00041 
00042 struct  PHY__Vector3
00043 {
00044         float   m_vec[4];
00045 
00046         operator const float* () const 
00047         { 
00048                 return &m_vec[0];
00049         }       
00050         operator float* () 
00051         { 
00052                 return &m_vec[0];
00053         }       
00054 };
00055 
00056 struct  PHY__Vector4
00057 {
00058         float   m_vec[4];
00059         PHY__Vector4() {}
00060         void setValue(const float *value)
00061         {
00062                 m_vec[0] = *value++;
00063                 m_vec[1] = *value++;
00064                 m_vec[2] = *value++;
00065                 m_vec[3] = *value++;
00066         }
00067         void setValue(const double *value)
00068         {
00069                 m_vec[0] = (float)(*value++);
00070                 m_vec[1] = (float)(*value++);
00071                 m_vec[2] = (float)(*value++);
00072                 m_vec[3] = (float)(*value++);
00073         }
00074 
00075         operator const float* () const 
00076         { 
00077                 return &m_vec[0];
00078         }       
00079         operator float* () 
00080         { 
00081                 return &m_vec[0];
00082         }       
00083 };
00084 
00085 //typedef       float   PHY__Vector3[4];
00086 
00087 enum
00088 {
00089         PHY_FH_RESPONSE,
00090         PHY_SENSOR_RESPONSE,    /* Touch Sensors */
00091         PHY_CAMERA_RESPONSE,    /* Visibility Culling */
00092         PHY_OBJECT_RESPONSE,    /* Object Dynamic Geometry Response */
00093         PHY_STATIC_RESPONSE,    /* Static Geometry Response */
00094         PHY_BROADPH_RESPONSE,   /* broadphase Response */
00095         
00096         PHY_NUM_RESPONSE
00097 };
00098 
00099         typedef struct PHY_CollData {
00100                 PHY__Vector3 m_point1;               /* Point in object1 in world coordinates */ 
00101                 PHY__Vector3 m_point2;               /* Point in object2 in world coordinates */
00102                 PHY__Vector3 m_normal;               /* point2 - point1 */ 
00103         } PHY_CollData;
00104 
00105 
00106         typedef bool (*PHY_ResponseCallback)(void *client_data,
00107                                                                                    void *client_object1,
00108                                                                                    void *client_object2,
00109                                                                                    const PHY_CollData *coll_data);
00110         typedef void (*PHY_CullingCallback)(KX_ClientObjectInfo* info, void* param);
00111 
00112 
00115 
00116 typedef enum PHY_PhysicsType {
00117         PHY_CONVEX_RIGIDBODY=16386,
00118         PHY_CONCAVE_RIGIDBODY=16399,
00119         PHY_CONVEX_FIXEDBODY=16388,//'collision object'
00120         PHY_CONCAVE_FIXEDBODY=16401,
00121         PHY_CONVEX_KINEMATICBODY=16387,// 
00122         PHY_CONCAVE_KINEMATICBODY=16400,
00123         PHY_CONVEX_PHANTOMBODY=16398,
00124         PHY_CONCAVE_PHANTOMBODY=16402
00125 } PHY_PhysicsType;
00126 
00128 typedef enum PHY_ConstraintType {
00129         PHY_POINT2POINT_CONSTRAINT=1,
00130         PHY_LINEHINGE_CONSTRAINT=2,
00131         PHY_ANGULAR_CONSTRAINT = 3,//hinge without ball socket
00132         PHY_CONE_TWIST_CONSTRAINT = 4,
00133         PHY_VEHICLE_CONSTRAINT=11,//complex 'constraint' that turns a rigidbody into a vehicle
00134         PHY_GENERIC_6DOF_CONSTRAINT=12,//can leave any of the 6 degree of freedom 'free' or 'locked'
00135 
00136 } PHY_ConstraintType;
00137 
00138 typedef enum PHY_ShapeType {
00139         PHY_SHAPE_NONE,
00140         PHY_SHAPE_BOX,
00141         PHY_SHAPE_SPHERE,
00142         PHY_SHAPE_CYLINDER,
00143         PHY_SHAPE_CONE,
00144         PHY_SHAPE_CAPSULE,
00145         PHY_SHAPE_MESH,
00146         PHY_SHAPE_POLYTOPE,
00147         PHY_SHAPE_COMPOUND,
00148         PHY_SHAPE_PROXY
00149 } PHY_ShapeType;
00150 
00151 
00152 typedef float   PHY_Vector3[3];
00153 
00154 #endif //__PHY_DYNAMIC_TYPES