obb.h
来自「小型的3D游戏引擎」· C头文件 代码 · 共 46 行
H
46 行
////////////////////////////////////////////////////
// Oriented Bounding Box handler
// 2003-02-21
//
// 2003-04-16 Added support dynamic collision detection
////////////////////////////////////////////////////
#ifndef _OBB_H_
#define _OBB_H_
#include "../entity/trsnode.h"
#include "plane.h"
#include "triangle.h"
class GcOBB : public GcTRSNode
{
public:
GcOBB();
GcOBB( GcVector3 & extents );
GcOBB( GcVector3 & extents, GcVector3 & position );
void RenderOutlines();
const bool Intersects( const GcPlane & plane );
const bool Intersects( const GcTriangle & tri );
const bool Intersects( GcAABB & box );
const bool Intersects( GcOBB & box );
const bool Collides( GcVector3 & thisVel, GcTriangle & tri, GcVector3 & triVel, float maxT, float & first, float & last );
const bool Collides( GcVector3 & thisVel, GcOBB & box, GcVector3 & boxVel, float maxT, float & firstT, float & lastT );
float Extent( int i ) { return m_extents[i]; }
GcVector3 & Extents() { return m_extents; }
void SetExtents( GcVector3 & v ) { m_extents = v; }
GcVector3 Center() { return GetWorldTranslation(); }
//const GcVector3 & Extents() { return m_extents; }
GcVector3 * GetOrthogonal() { return m_orthogonal; }
protected:
GcVector3 m_extents;
GcVector3 m_orthogonal[3];
static bool NoIntersect( float maxT, float speed, float min0, float max0, float min1, float max1, float & firstT, float & lastT );
};
#endif /* _OBB_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?