Blender V2.61 - r43446

KX_ConvertPhysicsObject.h

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