⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 obb.h

📁 小型的3D游戏引擎
💻 H
字号:
 ////////////////////////////////////////////////////
// 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -