2009-04-20 15:06:46 +00:00
|
|
|
/*
|
|
|
|
Bullet Continuous Collision Detection and Physics Library
|
|
|
|
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied warranty.
|
|
|
|
In no event will the authors be held liable for any damages arising from the use of this software.
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
including commercial applications, and to alter it and redistribute it freely,
|
|
|
|
subject to the following restrictions:
|
|
|
|
|
|
|
|
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.
|
|
|
|
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
|
|
|
3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*/
|
|
|
|
|
2011-02-22 12:42:55 +00:00
|
|
|
/** \file CcdGraphicController.h
|
|
|
|
* \ingroup physbullet
|
|
|
|
*/
|
|
|
|
|
2009-04-20 15:06:46 +00:00
|
|
|
|
2012-02-23 10:41:31 +00:00
|
|
|
#ifndef __CCDGRAPHICCONTROLLER_H__
|
|
|
|
#define __CCDGRAPHICCONTROLLER_H__
|
2009-04-20 15:06:46 +00:00
|
|
|
|
|
|
|
#include "PHY_IGraphicController.h"
|
|
|
|
|
|
|
|
#include "btBulletDynamicsCommon.h"
|
|
|
|
#include "LinearMath/btTransform.h"
|
|
|
|
|
|
|
|
#include "PHY_IMotionState.h"
|
|
|
|
#include "MT_Point3.h"
|
|
|
|
|
|
|
|
class CcdPhysicsEnvironment;
|
|
|
|
class btCollisionObject;
|
|
|
|
|
|
|
|
///CcdGraphicController is a graphic object that supports view frustrum culling and occlusion
|
2012-09-16 04:58:18 +00:00
|
|
|
class CcdGraphicController : public PHY_IGraphicController
|
2009-04-20 15:06:46 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CcdGraphicController(CcdPhysicsEnvironment* phyEnv, PHY_IMotionState* motionState);
|
|
|
|
|
|
|
|
virtual ~CcdGraphicController();
|
|
|
|
|
|
|
|
void setLocalAabb(const btVector3& aabbMin,const btVector3& aabbMax);
|
|
|
|
void setLocalAabb(const MT_Point3& aabbMin,const MT_Point3& aabbMax);
|
2013-02-21 18:30:11 +00:00
|
|
|
virtual void setLocalAabb(const MT_Vector3& aabbMin,const MT_Vector3& aabbMax);
|
2009-06-08 20:08:19 +00:00
|
|
|
virtual void setLocalAabb(const float aabbMin[3],const float aabbMax[3]);
|
2009-04-20 15:06:46 +00:00
|
|
|
|
|
|
|
PHY_IMotionState* GetMotionState() { return m_motionState; }
|
|
|
|
void getAabb(btVector3& aabbMin, btVector3& aabbMax);
|
|
|
|
|
|
|
|
virtual void setBroadphaseHandle(btBroadphaseProxy* handle) { m_handle = handle; }
|
|
|
|
virtual btBroadphaseProxy* getBroadphaseHandle() { return m_handle; }
|
|
|
|
|
2009-11-15 23:58:56 +00:00
|
|
|
virtual void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment* env);
|
|
|
|
|
2009-04-20 15:06:46 +00:00
|
|
|
////////////////////////////////////
|
|
|
|
// PHY_IGraphicController interface
|
|
|
|
////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the Aabb based on the motion state
|
|
|
|
*/
|
|
|
|
virtual bool SetGraphicTransform();
|
2009-06-08 20:08:19 +00:00
|
|
|
/**
|
|
|
|
* Add/remove to environment
|
|
|
|
*/
|
|
|
|
virtual void Activate(bool active);
|
2009-04-20 15:06:46 +00:00
|
|
|
|
|
|
|
// client info for culling
|
|
|
|
virtual void* getNewClientInfo() { return m_newClientInfo; }
|
|
|
|
virtual void setNewClientInfo(void* clientinfo) { m_newClientInfo = clientinfo; }
|
|
|
|
virtual PHY_IGraphicController* GetReplica(class PHY_IMotionState* motionstate);
|
|
|
|
|
|
|
|
private:
|
|
|
|
// unscaled aabb corner
|
|
|
|
btVector3 m_localAabbMin;
|
|
|
|
btVector3 m_localAabbMax;
|
|
|
|
|
|
|
|
PHY_IMotionState* m_motionState;
|
|
|
|
CcdPhysicsEnvironment* m_phyEnv;
|
|
|
|
btBroadphaseProxy* m_handle;
|
|
|
|
void* m_newClientInfo;
|
|
|
|
|
2009-08-18 15:37:31 +00:00
|
|
|
|
|
|
|
#ifdef WITH_CXX_GUARDEDALLOC
|
2012-06-25 09:14:37 +00:00
|
|
|
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CcdGraphicController")
|
2009-08-18 15:37:31 +00:00
|
|
|
#endif
|
2009-04-20 15:06:46 +00:00
|
|
|
};
|
|
|
|
|
2012-10-09 13:36:42 +00:00
|
|
|
#endif /* BULLET2_PHYSICSCONTROLLER_H */
|