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

📄 trimesh.h

📁 3D赛车游戏源代码-用Visual Studio 2005
💻 H
字号:
//////////////////////////////////////////////////////////////////////////
//  TriMesh类,实现一个通用的三角形网孔
//
//  TriMesh.h: TriMesh类的声明
//
//////////////////////////////////////////////////////////////////////////

#ifndef __TRIMESH_H_INCLUDED__
#define __TRIMESH_H_INCLUDED__

#include "AABB3.h"

struct RenderVertex;
struct RenderTri;

//-------------------------------------------------------------------------------
// 三角形网孔
//-------------------------------------------------------------------------------
class TriMesh 
{
public:
	// 构造析构函数
	TriMesh();
	~TriMesh();

	// 存储管理
	void	AllocateMemory(int nVertexCount, int nTriCount);
	void	FreeMemory();

	// 网孔数据访问
	int		GetVertexCount() const { return m_vertexCount; }
	RenderVertex	*GetVertexList() const { return m_vertexList; }
	int		GetTriCount() const { return m_triCount; }
	RenderTri	*GetTriList() const { return m_triList; }

	// 渲染
	void	Render() const;

	// 计算轴对齐盒子,改了网孔数据后要调用本函数
	void		ComputeBoundingBox();
	// 获取轴对齐盒子
	const AABB3	&GetBoundingBox() const { return m_boundingBox; }

protected:
	int				m_vertexCount;		// 顶点数量
	RenderVertex	*m_vertexList;		// 顶点列表
	int				m_triCount;			// 三角形数量
	RenderTri		*m_triList;			// 三角形列表
	AABB3			m_boundingBox;		// 轴对齐盒子
};



#endif

⌨️ 快捷键说明

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