Blender  V2.59
KX_ConvertPhysicsObject.h
Go to the documentation of this file.
00001 /*
00002  * $Id: KX_ConvertPhysicsObject.h 35063 2011-02-22 10:33:14Z jesterking $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00021  * All rights reserved.
00022  *
00023  * The Original Code is: all of this file.
00024  *
00025  * Contributor(s): none yet.
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028  */
00029 
00034 #ifndef KX_CONVERTPHYSICSOBJECTS
00035 #define KX_CONVERTPHYSICSOBJECTS
00036 
00037 class RAS_MeshObject;
00038 class KX_Scene;
00039 struct DerivedMesh;
00040 
00041 typedef enum {
00042         KX_BOUNDBOX,
00043         KX_BOUNDSPHERE,
00044         KX_BOUNDCYLINDER,
00045         KX_BOUNDCONE,
00046         KX_BOUNDMESH,
00047         KX_BOUNDPOLYTOPE,
00048         KX_BOUND_DYN_MESH,
00049         KX_BOUNDCAPSULE
00050 } KX_BoundBoxClass;
00051 
00052 struct KX_BoxBounds
00053 {
00054         float m_center[3];
00055         float m_extends[3];
00056 };
00057 
00058 /* Cone/Cylinder */
00059 struct KX_CBounds
00060 {
00061         float m_radius;
00062         float m_height;
00063 };
00064 
00065 
00066 struct KX_ObjectProperties
00067 {
00068         bool    m_dyna;
00069         bool    m_softbody;
00070         double m_radius;
00071         bool    m_angular_rigidbody;
00072         bool    m_in_active_layer;
00073         bool    m_ghost;
00074         class KX_GameObject*    m_dynamic_parent;
00075         bool    m_isactor;
00076         bool    m_sensor;
00077         bool    m_concave;
00078         bool    m_isdeformable;
00079         bool    m_disableSleeping;
00080         bool    m_hasCompoundChildren;
00081         bool    m_isCompoundChild;
00082 
00084 
00085         int             m_gamesoftFlag;
00086         float   m_soft_linStiff;                        /* linear stiffness 0..1 */
00087         float   m_soft_angStiff;                /* angular stiffness 0..1 */
00088         float   m_soft_volume;                  /* volume preservation 0..1 */
00089 
00090         int             m_soft_viterations;             /* Velocities solver iterations */
00091         int             m_soft_piterations;             /* Positions solver iterations */
00092         int             m_soft_diterations;             /* Drift solver iterations */
00093         int             m_soft_citerations;             /* Cluster solver iterations */
00094 
00095         float   m_soft_kSRHR_CL;                /* Soft vs rigid hardness [0,1] (cluster only) */
00096         float   m_soft_kSKHR_CL;                /* Soft vs kinetic hardness [0,1] (cluster only) */
00097         float   m_soft_kSSHR_CL;                /* Soft vs soft hardness [0,1] (cluster only) */
00098         float   m_soft_kSR_SPLT_CL;     /* Soft vs rigid impulse split [0,1] (cluster only) */
00099 
00100         float   m_soft_kSK_SPLT_CL;     /* Soft vs rigid impulse split [0,1] (cluster only) */
00101         float   m_soft_kSS_SPLT_CL;     /* Soft vs rigid impulse split [0,1] (cluster only) */
00102         float   m_soft_kVCF;                    /* Velocities correction factor (Baumgarte) */
00103         float   m_soft_kDP;                     /* Damping coefficient [0,1] */
00104 
00105         float   m_soft_kDG;                     /* Drag coefficient [0,+inf] */
00106         float   m_soft_kLF;                     /* Lift coefficient [0,+inf] */
00107         float   m_soft_kPR;                     /* Pressure coefficient [-inf,+inf] */
00108         float   m_soft_kVC;                     /* Volume conversation coefficient [0,+inf] */
00109 
00110         float   m_soft_kDF;                     /* Dynamic friction coefficient [0,1] */
00111         float   m_soft_kMT;                     /* Pose matching coefficient [0,1] */
00112         float   m_soft_kCHR;                    /* Rigid contacts hardness [0,1] */
00113         float   m_soft_kKHR;                    /* Kinetic contacts hardness [0,1] */
00114 
00115         float   m_soft_kSHR;                    /* Soft contacts hardness [0,1] */
00116         float   m_soft_kAHR;                    /* Anchors hardness [0,1] */
00117         int             m_soft_collisionflags;  /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */
00118         int             m_soft_numclusteriterations;    /* number of iterations to refine collision clusters*/
00119         float   m_soft_welding;                 /*   threshold to remove duplicate/nearby vertices */
00120 
00122         
00123         bool    m_lockXaxis;
00124         bool    m_lockYaxis;
00125         bool    m_lockZaxis;
00126         bool    m_lockXRotaxis;
00127         bool    m_lockYRotaxis;
00128         bool    m_lockZRotaxis;
00129 
00131         double  m_margin;
00132         float   m_contactProcessingThreshold;
00133 
00134         KX_BoundBoxClass        m_boundclass;
00135         union {
00136                 KX_BoxBounds    box;
00137                 KX_CBounds      c;
00138         } m_boundobject;
00139 };
00140 
00141 void    KX_ConvertDynamoObject(KX_GameObject* gameobj,
00142         RAS_MeshObject* meshobj,
00143         KX_Scene* kxscene,
00144         struct  PHY_ShapeProps* shapeprops,
00145         struct  PHY_MaterialProps*      smmaterial,
00146         struct  KX_ObjectProperties*    objprop);
00147 
00148 
00149 #ifdef USE_BULLET
00150 
00151 void    KX_ConvertBulletObject( class   KX_GameObject* gameobj,
00152         class   RAS_MeshObject* meshobj,
00153         struct  DerivedMesh* dm,
00154         class   KX_Scene* kxscene,
00155         struct  PHY_ShapeProps* shapeprops,
00156         struct  PHY_MaterialProps*      smmaterial,
00157         struct  KX_ObjectProperties*    objprop);
00158         
00159 void    KX_ClearBulletSharedShapes();
00160 bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *from_gameobj, RAS_MeshObject* from_meshobj);
00161 
00162 #endif
00163 #endif //KX_CONVERTPHYSICSOBJECTS