?? 3dstruct.h
字號:
#ifndef _3dStruct_h
#define _3dStruct_h
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <d3d9.h>
#include <d3dx9math.h>
const int COORDVERTEX_FVF = ( D3DFVF_XYZ | D3DFVF_DIFFUSE );
const int BASEVERTEX_FVF = D3DFVF_XYZB1 | D3DFVF_NORMAL | D3DFVF_TEX1;
const int VERTEX_FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1;
/////////////////////////////////////////////////////////////////////
//坐標軸和包圍盒的頂點結構,包含坐標和顏色
/////////////////////////////////////////////////////////////////////
struct COORDVERTEX
{
union {
D3DVECTOR p;
struct {
float x, y, z;
};
};
D3DCOLOR color;
};
///////////////////////////////////////////////////////
//普通網格屬性索引結構,包括材質索引,紋理索引
///////////////////////////////////////////////////////
struct ATTRIBUTEINDEX
{
int iMaterialIndex;
int iTextureIndex;
int iBoneId;
int iConnectedBoneId;
public:
bool operator==( ATTRIBUTEINDEX &a )
{ return ( (iBoneId == a.iBoneId) && (iConnectedBoneId == a.iConnectedBoneId) ); }
};
////////////////////////////////////////////////////////////////////
//頂點格式,用于多邊體,網格
////////////////////////////////////////////////////////////////////
struct BASEVERTEX
{
union {
D3DVECTOR p;
struct {
float x, y, z;
};
};
float weight1; //頂點權重
union {
D3DVECTOR n;
struct {
float nx, ny, nz; //法向量
};
};
float u, v;
};
struct VERTEX
{
union {
D3DVECTOR p;
struct {
float x, y, z;
};
};
union {
D3DVECTOR n;
struct {
float nx, ny, nz; //法向量
};
};
float u, v;
};
//////////////////////////////////////////////////////////////////
//骨骼頂點(只有一個權重)的定義
//////////////////////////////////////////////////////////////////
/*struct BONEVERTEX1
{
union {
D3DVECTOR p;
struct {
float x, y, z; //坐標
};
};
float weight1; //頂點權重
//DWORD matrixIndices; //矩陣索引
union {
D3DVECTOR n;
struct {
float nx, ny, nz; //法向量
};
};
float u, v; //紋理
};*/
/////////////////////////////////////////////////////////////////////////
//三角形的邊
/////////////////////////////////////////////////////////////////////////
struct EDGE
{
WORD v1;
WORD v2;
};
/////////////////////////////////////////////////////////////////////////
//三角形的邊
/////////////////////////////////////////////////////////////////////////
struct TRIANGLE
{
union {
struct {
WORD v1, v2, v3;
};
WORD v[3];
};
public:
bool operator ==( TRIANGLE &t ) { return ( (t.v1 == v1) && (t.v2 == v2) && (t.v3 == v3) ); }
};
//////////////////////////////////////////////////////////////////////////
//向量的結構
//////////////////////////////////////////////////////////////////////////
struct VECTOR {
union {
struct {
float x, y, z;
};
float v[3];
};
public:
VECTOR() {}
VECTOR( D3DXVECTOR3 &v ) { x = v.x; y = v.y; z = v.z;}
};
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -