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

📄 moddata.h

📁 liu7788414
💻 H
字号:
// ModData.h: interface for the CModData class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MODDATA_H__40D9908F_7B18_4585_A653_BBC7320B1592__INCLUDED_)
#define AFX_MODDATA_H__40D9908F_7B18_4585_A653_BBC7320B1592__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>
#include <list>
using namespace std;

enum ANIM_TYPE
{
	BONE_ANIMATION = 0,
		VERTEX_ANIMATION = 1,
};

enum MAX_BONE_COUNT
{
	MAX_ONE_BONE = 0,
		MAX_TWO_BONES = 1,
};

enum UNIT_TYPE
{
	UNIT_NORMAL = 0,
	UNIT_DIV16 = 1,
};

struct SampleMethod
{
	int startTime;
	int endTime;
	int FrameCount;
	char ActionName[60];
};

struct ExportOptions
{
	bool bHaveAnimation;
	bool bHaveVertexNormal;
	int iAnimationType;
//	int iAnimSamplingRate; //
	int format; //0: binary //
	bool bExport;
	bool bExportSelected;
	list <SampleMethod> m_Sample;
	SampleMethod m_curSample;
	int m_curSelect;
	int iMaxBoneCount;
	int unit;
};

struct Vertex
{
public:
	int x;
	int y;
	int z;
	
	short normal_x;
	short normal_y;
	short normal_z;

	bool operator==(const Vertex& rSrc) const 
	{ 
		return x==rSrc.x && y==rSrc.y && z==rSrc.z && normal_x==rSrc.normal_x
			&& normal_y==rSrc.normal_y && normal_z==rSrc.normal_z;
	};
	
	static Vertex VMax(Vertex & v1, Vertex & v2)
	{
		Vertex re;
		re.x = v1.x>v2.x?v1.x: v2.x;
		re.y = v1.y>v2.y?v1.y: v2.y;
		re.z = v1.z>v2.z?v1.z: v2.z;
		return re;
	};

	static Vertex VMin(Vertex & v1, Vertex & v2)
	{
		Vertex re;
		re.x = v1.x<v2.x?v1.x: v2.x;
		re.y = v1.y<v2.y?v1.y: v2.y;
		re.z = v1.z<v2.z?v1.z: v2.z;
		return re;
	};
	
};

typedef struct
{
	short u;
	short v;
}Texcoord;

typedef struct
{
	bool bAlphablend;
	char alphaBlendMode;
	char cullMode; 
	char texFileName[64];
	short texSize;
}GLMaterial;

typedef struct
{
	int ver1;
	int ver2;
	int ver3;
	int tex1;
	int tex2;
	int tex3;
	int nx;
	int ny;
	int nz;
}GLFace;

struct BBox
{
	Vertex vmin;
	Vertex vmax;
};

struct Submesh 
{
	int m_facenum;
	vector<GLFace> m_pfacelist;
	GLMaterial material;
	vector<BBox> bbox;
};

struct Bone
{
	char name[50];
	vector<Matrix3> trans;
	vector<int> vertexIndics;
	int nodeId;
	bool bUsed;
};

struct Animation
{
	int FrameNo;
	//matrix index;
};


//Current we change the max bone count to 2. 
//So we use two structs to instore bones information, which could save calculation
//time for applications. 
struct OneBoneVertex
{
	short vertexIndex;
	char boneIndex;
};

struct TwoBoneVertex
{	
	short vertexIndex;
	char boneIndex1;
	unsigned char boneWeight1; //127 reprasent 1.0f 
	char boneIndex2;
	unsigned char boneWeight2;
};

class CMesh  
{
public:
	vector<OneBoneVertex> m_oneBoneVertex;
	vector<TwoBoneVertex> m_twoBoneVertex;
	void ReleaseData();
	CMesh();
	virtual ~CMesh();

	vector<Vertex> m_pvertexlist;
	int m_vertexnum;
	
  vector<Texcoord> m_ptexcoordlist;
	int m_texcoordnum;
					
	int m_submeshCount;
	vector<Submesh> m_pSubMeshs;
	vector<Bone> m_Bones;
	
	int m_FrameCount;

	BOOL GenerateFromScene(IScene *pScene, Interface *itr, BOOL bExportSelected);
	BOOL SaveToFile(const char *fileName, ExportOptions *pOptions);
	void GetFrameVertex(int i, vector<Vertex> &tempList, int flag);
};

#endif // !defined(AFX_MODDATA_H__40D9908F_7B18_4585_A653_BBC7320B1592__INCLUDED_)

⌨️ 快捷键说明

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