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

📄 viewcone.h

📁 <B>DirectX9.0 3D游戏编程</B>
💻 H
字号:
/*******************************************************************
 *         Advanced 3D Game Programming using DirectX 8.0
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *   Title: ViewCone.h
 *    Desc: code to handle n-sided viewing cones
 *          (for portal rendering) 
 * copyright (c) 2001 by Peter A Walsh and Adrian Perez
 * See license.txt for modification and distribution information
 ******************************************************************/

#ifndef _FRUSTUM_H
#define _FRUSTUM_H

#include "..\math3d\point3.h"
#include "..\math3d\plane3.h"

#define MAX_PLANES 32

class cViewCone  
{
	plane3	m_planes[MAX_PLANES];
	int		m_nPlanes;
	point3	m_camLoc;
	
	/**
	 * We need this functionality twice, encapsulate it
	 */
	void GenFromPoly( const point3& camLoc, const polygon< point3 >& in );

public:

	/**
	 * Default constructor/destructor
	 */
	cViewCone();

	/**
	 * Construct a frustum from an inputted polygon.  The polygon
	 * is assumed to wind clockwise from the point of view of the
	 * camera
	 */
	cViewCone( const point3& camLoc, const polygon< point3 >& in ); 

	/**
	 * Construct a frustum from the viewport data.  uses the 
	 * data to construct a cameraspace polygon, 
	 * back-transforms it to worldspace, then constructs a 
	 * frustum out of it.
	 */
	cViewCone( float fov, int width, int height, matrix4& viewMat );

	/**
	 * Clip a polygon to the frustum.  
	 * true if there was anything left
	 */
	bool Clip( 
		const polygon<point3>& in, 
		polygon<point3>* out );

	/**
	 * Get the center point of a frustum
	 * this is needed when we create frustums
	 * from other frustums
	 */
	const point3& GetLoc()
	{
		return m_camLoc;
	}

};

#endif // _FRUSTUM_H

⌨️ 快捷键说明

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