Blender V2.61 - r43446

CcdGraphicController.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 
00021 #ifndef BULLET2_GRAPHICCONTROLLER_H
00022 #define BULLET2_GRAPHICCONTROLLER_H
00023 
00024 #include "PHY_IGraphicController.h"
00025 
00026 #include "btBulletDynamicsCommon.h"
00027 #include "LinearMath/btTransform.h"
00028 
00029 #include "PHY_IMotionState.h"
00030 #include "MT_Point3.h"
00031 
00032 class CcdPhysicsEnvironment;
00033 class btCollisionObject;
00034 
00036 class CcdGraphicController : public PHY_IGraphicController  
00037 {
00038 public:
00039     CcdGraphicController(CcdPhysicsEnvironment* phyEnv, PHY_IMotionState* motionState);
00040 
00041     virtual ~CcdGraphicController();
00042 
00043     void setLocalAabb(const btVector3& aabbMin,const btVector3& aabbMax);
00044     void setLocalAabb(const MT_Point3& aabbMin,const MT_Point3& aabbMax);
00045     virtual void setLocalAabb(const PHY__Vector3& aabbMin,const PHY__Vector3& aabbMax);
00046     virtual void setLocalAabb(const float aabbMin[3],const float aabbMax[3]);
00047 
00048     PHY_IMotionState* GetMotionState() { return m_motionState; }
00049     void getAabb(btVector3& aabbMin, btVector3& aabbMax);
00050 
00051     virtual void setBroadphaseHandle(btBroadphaseProxy* handle) { m_handle = handle; }
00052     virtual btBroadphaseProxy* getBroadphaseHandle() { return m_handle; }
00053 
00054     virtual void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment* env);
00055 
00057     // PHY_IGraphicController interface
00059 
00063     virtual bool SetGraphicTransform();
00067     virtual void Activate(bool active);
00068 
00069     // client info for culling
00070     virtual void* getNewClientInfo() { return m_newClientInfo; }
00071     virtual void setNewClientInfo(void* clientinfo) { m_newClientInfo = clientinfo; }
00072     virtual PHY_IGraphicController* GetReplica(class PHY_IMotionState* motionstate);
00073         
00074 private:
00075     // unscaled aabb corner
00076     btVector3 m_localAabbMin;
00077     btVector3 m_localAabbMax;
00078 
00079     PHY_IMotionState* m_motionState;
00080     CcdPhysicsEnvironment* m_phyEnv;
00081     btBroadphaseProxy* m_handle;
00082     void* m_newClientInfo;
00083 
00084 
00085 #ifdef WITH_CXX_GUARDEDALLOC
00086 public:
00087     void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:CcdGraphicController"); }
00088     void operator delete( void *mem ) { MEM_freeN(mem); }
00089 #endif
00090 };
00091 
00092 #endif //BULLET2_PHYSICSCONTROLLER_H