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

📄 model.h

📁 <B>DirectX9.0 3D游戏编程</B>
💻 H
字号:
/*******************************************************************
 *         Advanced 3D Game Programming using DirectX 9.0
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * copyright (c) 2003 by Peter A Walsh and Adrian Perez
 * See license.txt for modification and distribution information
 ******************************************************************/

#ifndef _MODEL_H
#define _MODEL_H

#include <vector>
#include <string>
#include "..\math3d\tri.h"
#include "..\math3d\mathD3D.h"


#define FVF_TYPE ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX1 )


class cModel  
{
	struct vertex
	{
		point3 loc;
		point3 norm;
		ulong diff;
		float u, v;
	};


	typedef tri<unsigned short> sTri;

	std::vector< sTri >		m_tris;
	std::vector< vertex >	m_verts;

	std::string				m_name;



public:

	cModel( const char* filename );
	cModel( const char* name, int nVerts, int nTris );


	float GenRadius();
	void Scale( float amt );

	void Draw( const matrix4& mat );

	//==========--------------------------  Access functions.

	int NumVerts(){ return m_verts.size(); }
	int NumTris(){ return m_tris.size(); }
	const char* Name(){ return m_name.c_str(); }

	/**
	 * Some other classes may end up using cModel
	 * to assist in their file parsing.  Because of this
	 * give them a way to get at the vertex and triangle 
	 * data.
	 */
	vertex* VertData(){ return &m_verts[0]; }
	sTri* TriData(){ return &m_tris[0]; }

};

#endif // _MODEL_H

⌨️ 快捷键说明

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