00001 /* 00002 * Newton rigid body header 00003 * 00004 * This file is part of the "SoftPixel Engine" (Copyright (c) 2008 by Lukas Hermanns) 00005 * See "SoftPixelEngine.hpp" for license information. 00006 */ 00007 00008 #ifndef __SP_PHYSICS_NEWTON_RIGIDBODY_H__ 00009 #define __SP_PHYSICS_NEWTON_RIGIDBODY_H__ 00010 00011 00012 #include "Base/spStandard.hpp" 00013 00014 #ifdef SP_COMPILE_WITH_NEWTON 00015 00016 00017 #include "Base/spDimension.hpp" 00018 #include "SceneGraph/spSceneMesh.hpp" 00019 #include "Framework/Physics/spPhysicsRigidBody.hpp" 00020 #include "Framework/Physics/Newton/spNewtonBaseObject.hpp" 00021 00022 00023 namespace sp 00024 { 00025 namespace physics 00026 { 00027 00028 00029 class SP_EXPORT NewtonRigidBody : public RigidBody, public NewtonBaseObject 00030 { 00031 00032 public: 00033 00034 NewtonRigidBody(const ERigidBodies Type, const SRigidBodyConstruction &Construct); 00035 NewtonRigidBody(scene::Mesh* MeshGeom); 00036 virtual ~NewtonRigidBody(); 00037 00038 /* === Functions === */ 00039 00040 virtual void setMass(f32 Mass); 00041 virtual void setAutoSleep(bool Enable); 00042 00043 virtual void setMassCenter(const dim::vector3df &LocalPoint); 00044 virtual dim::vector3df getMassCenter() const; 00045 00046 virtual void addVelocity(const dim::vector3df &Direction); 00047 virtual void setVelocity(const dim::vector3df &Direction); 00048 virtual dim::vector3df getVelocity() const; 00049 00050 virtual void addImpulse(const dim::vector3df &Direction, const dim::vector3df &PivotPoint); 00051 virtual void setForce(const dim::vector3df &Direction); 00052 00053 protected: 00054 00055 /* === Functions === */ 00056 00057 void createBox(); 00058 void createCone(); 00059 void createSphere(); 00060 void createCylinder(); 00061 void createChamferCylinder(); 00062 void createCapsule(); 00063 00064 void createMesh(scene::Mesh* MeshGeom); 00065 00066 void setupCollision(NewtonCollision* NtCollision); 00067 00068 }; 00069 00070 00071 } // /namespace physics 00072 00073 } // /namespace sp 00074 00075 00076 #endif 00077 00078 #endif 00079 00080 00081 00082 // ================================================================================