www.pudn.com > vessel2.rar > MODEL.H


// Model.h: interface for the Model class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_MODEL_H__E1E40BB7_CEB8_4CF8_A4F9_3B854BE7322D__INCLUDED_) 
#define AFX_MODEL_H__E1E40BB7_CEB8_4CF8_A4F9_3B854BE7322D__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
#include "Texture.h" 
 
class Model   
{ 
public: 
		//	网格 
		struct Mesh 
		{ 
			int m_materialIndex; 
			int m_numTriangles; 
			int *m_pTriangleIndices; 
		}; 
 
		//	材质属性 
		struct Material 
		{ 
			float m_ambient[4], m_diffuse[4], m_specular[4], m_emissive[4]; 
			float m_shininess; 
			GLuint m_texture; 
			char *m_pTextureFilename; 
		}; 
 
		//	三角形结构 
		struct Triangle 
		{ 
			float m_vertexNormals[3][3]; 
			float m_s[3], m_t[3]; 
			int m_vertexIndices[3]; 
		}; 
 
		//	顶点结构 
		struct Vertex 
		{ 
			char m_boneID;	 
			float m_location[3]; 
		}; 
public: 
	Model(); 
	virtual ~Model(); 
 
 
		// 将纹理数据输入到变量中 
		virtual bool loadModelData( const char *filename ) = 0; 
 
		// 绘制模型 
		void draw(); 
	 
		void reloadTextures(); 
		Texture m_texture; 
 
	protected: 
		//	使用的网格 
		int m_numMeshes; 
		Mesh *m_pMeshes; 
 
		//	使用的材质 
		int m_numMaterials; 
		Material *m_pMaterials; 
 
		//	使用的三角形 
		int m_numTriangles; 
		Triangle *m_pTriangles; 
 
		//	使用的顶点 
		int m_numVertices; 
		Vertex *m_pVertices; 
}; 
 
#endif // !defined(AFX_MODEL_H__E1E40BB7_CEB8_4CF8_A4F9_3B854BE7322D__INCLUDED_)