StructDef.h
上传用户:hkb425
上传日期:2007-06-16
资源大小:34191k
文件大小:3k
- /////////////////structdef.h/////////////
- //作者:吴雪平 2002-6-17日修改
- //
- #if !defined(__STRUCT__DEFINE__)
- #define __STRUCT__DEFINE__
- //////////////////////////////////////////
- #define UNKNOW -2
- #define IN_BACK_OF -1
- #define COINCIDENT 0
- #define IN_FRONT_OF 1
- #define SPANNING 2
-
- #define REVERSE 3
- #define PERPENDICULAR 4
- #define SHARP_ANGLE 5
- #define OBTUSE_ANGLE 6
- #define OUT_POLYGON -1
- #define ON_BORDER 0
- #define IN_POLYGON 1
- //////// Ammo define
- #define M16 1
- #define RIFLE 2
- #define ROCKET 3
- #define RIFLE_P 1
- #define EXPLOSION_P 2
- #define ROCKET_P 3
- #define SMOKE_P 4
- //////////////////////////////////////////
- struct VERTEX
- {
- VERTEX(){}
- VERTEX(float x,float y,float z){ xpos=x; ypos=y; zpos=z;}
- float xpos;
- float ypos;
- float zpos;
- };
- struct NORMAL
- {
- NORMAL(){}
- NORMAL(float x,float y,float z){ nx=x; ny=y; nz=z;}
- float nx;
- float ny;
- float nz;
- };
- struct TRIANGLE
- {
- TRIANGLE(){}
- TRIANGLE(VERTEX iv1,VERTEX iv2,VERTEX iv3){V1=iv1;V2=iv2;V3=iv3;}
- VERTEX V1;
- VERTEX V2;
- VERTEX V3;
- };
- struct QUAD
- {
- QUAD(){}
- QUAD(VERTEX iv1,VERTEX iv2,VERTEX iv3,VERTEX iv4){V0=iv1;V1=iv2;V2=iv3;V3=iv4;}
- VERTEX V0;
- VERTEX V1;
- VERTEX V2;
- VERTEX V3;
- };
- struct TEXCOORD
- {
- TEXCOORD(){}
- TEXCOORD(float iu,float iv){u=iu;v=iv;}
- float u;
- float v;
- };
- struct PLANE
- {
- PLANE(){}
- PLANE(float a,float b,float c,float d){A=a;B=b;C=c;D=d;}
- float A;
- float B;
- float C;
- float D;
- };
- struct TRI_FACE
- {
- VERTEX v1;
- VERTEX v2;
- VERTEX v3;
- TEXCOORD tex1;
- TEXCOORD tex2;
- TEXCOORD tex3;
- NORMAL n;
- float d; // param about face
- float powABC; // the normal length=pow (a*a+b*b+c*c ,0.5)
- float powBC;//the normal length=pow (b*b+c*c ,0.5)
- };
- struct TRI_TEX
- {
- TEXCOORD uv1;
- TEXCOORD uv2;
- TEXCOORD uv3;
- };
- struct COLOR
- {
- COLOR(){}
- COLOR(float red,float green,float blue){r=red;g=green;b=blue;}
- float r;
- float g;
- float b;
- };
- ////////////////////////////////////////////////
- struct LIGHT
- {
- VERTEX position;
- COLOR color;
- unsigned char brightness;
- unsigned char attenuation;
- unsigned char coefficient;
- };
- struct RLM_QUAD
- {
- int texid;
- PLANE plane;
- int vertindex[4];
- TEXCOORD texcoord[4];
- };
- struct BOUNDARY_3D
- {
- BOUNDARY_3D()
- {
- minx=miny=minz= 9999;
- maxx=maxy=maxz=-9999;
- }
- float minx,maxx;
- float miny,maxy;
- float minz,maxz;
- };
- struct BOUNDARY_2D
- {
- BOUNDARY_2D()
- {
- minx=minz= 9999;
- maxx=maxz=-9999;
- }
- BOUNDARY_2D(int min_x,int max_x,int min_z,int max_z)
- {
- minx=min_x;
- maxx=max_x;
- minz=min_z;
- maxz=max_z;
- }
- int minx,maxx;
- int minz,maxz;
- };
- ////////////////////////////////////////////////
- struct INPUT
- {
- bool keys[256];
- bool mouseButtons[2]; //0: left button 1:right button
- POINT mousePos;
- };
- struct TERRAIN_SKIN
- {
- unsigned char TextureIndex;
- unsigned char TextureOrder;
- };
- struct MOVE_VERTEX
- {
- unsigned char xpos;
- unsigned char zpos;
- };
- struct PARTICLE
- {
- float life; // Particle Life
- float fade; // Fade Speed
- float size; //
- VERTEX pos;
- NORMAL normal;
- float rotate; // X Rotate
- };
- ////////////////////////////////////////////////
- #endif
-