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

📄 frustumr.h

📁 frustumculling in c++,完整的小demo
💻 H
字号:
// FrustumG.h: Geometric version of Frustum Culling 
//
//////////////////////////////////////////////////////////////////////


#ifndef _FRUSTUMR_
#define _FRUSTUMR_

#ifndef _VEC3_
#include "Vec3.h"
#endif

class Vec3;


#endif

#ifndef _PLANE_
#include "Plane.h"
#endif

class Plane;


class FrustumR 
{
private:

	enum {
		TOP = 0,
		BOTTOM,
		LEFT,
		RIGHT,
		NEARP,
		FARP
	};


public:

	static enum {OUTSIDE, INTERSECT, INSIDE};

	Plane pl[6];


	Vec3 ntl,ntr,nbl,nbr,ftl,ftr,fbl,fbr,X,Y,Z,camPos;
	float nearD, farD, ratio, angle;
	float sphereFactorX, sphereFactorY;
	double tang;
	double nw,nh,fw,fh;

	FrustumR::FrustumR();
	FrustumR::~FrustumR();

	void setFrustum(float *m);
	void setCamInternals(float angle, float radius, float nearD, float farD);
	void setCamDef(Vec3 &p, Vec3 &l, Vec3 &u);
	int pointInFrustum(Vec3 &p);
	int sphereInFrustum(Vec3 &p, float radius);
//	int boxInFrustum(AABox &b);

	void drawPoints();
	void drawLines();
	void drawPlanes();
	void drawNormals();

	void printPlanes();

};


//#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -