8 #include "Quaternions.h"
9 #include "Quaternions.h"
11 #define max_terrain_size 256
12 #define curr_terrain_size size
13 #define subdivision 64
14 #define max_patch_elements (max_terrain_size/subdivision)*(max_terrain_size/subdivision)*54
20 #define max_decals 1000
23 #define footprintdecal 1
25 #define blooddecalfast 3
26 #define shadowdecalpermanent 4
28 #define blooddecalslow 6
29 #define bodyprintdecal 7
31 #define snowyenvironment 0
32 #define grassyenvironment 1
33 #define desertenvironment 2
43 GLuint footprinttexture;
44 GLuint bodyprinttexture;
46 GLuint terraintexture;
49 int patchobjectnum[subdivision][subdivision];
50 int patchobjects[subdivision][subdivision][300];
54 float heightmap[max_terrain_size+1][max_terrain_size+1];
55 XYZ normals[max_terrain_size][max_terrain_size];
56 XYZ facenormals[max_terrain_size][max_terrain_size];
57 XYZ triangles[(max_terrain_size-1)*(max_terrain_size-1)*2][3];
58 float colors[max_terrain_size][max_terrain_size][4];
59 float opacityother[max_terrain_size][max_terrain_size];
60 float texoffsetx[max_terrain_size][max_terrain_size];
61 float texoffsety[max_terrain_size][max_terrain_size];
62 int numtris[subdivision][subdivision];
63 int textureness[subdivision][subdivision];
65 GLfloat vArray[(max_patch_elements)*subdivision*subdivision];
67 bool visible[subdivision][subdivision];
68 float avgypatch[subdivision][subdivision];
69 float maxypatch[subdivision][subdivision];
70 float minypatch[subdivision][subdivision];
71 float heightypatch[subdivision][subdivision];
75 float decaltexcoords[max_decals][3][2];
76 XYZ decalvertex[max_decals][3];
77 int decaltype[max_decals];
78 float decalopacity[max_decals];
79 float decalrotation[max_decals];
80 float decalalivetime[max_decals];
81 float decalbrightness[max_decals];
82 XYZ decalposition[max_decals];
85 void AddObject(XYZ where, float radius,int id);
86 void DeleteDecal(int which);
87 void MakeDecal(int type, XYZ where, float size, float opacity, float rotation);
88 void MakeDecalLock(int type, XYZ where, int whichx, int whichy, float size, float opacity, float rotation);
89 int lineTerrain(XYZ p1,XYZ p2, XYZ *p);
90 float getHeight(float pointx, float pointz);
91 float getHeightExtrude(float pointx, float pointz,float point2x, float point2z);
92 float getOpacity(float pointx, float pointz);
93 XYZ getLighting(float pointx, float pointz);
94 XYZ getNormal(float pointx, float pointz);
95 void UpdateVertexArray(int whichx, int whichy);
96 void UpdateTransparency(int whichx, int whichy);
97 void UpdateTransparencyother(int whichx, int whichy);
98 void UpdateTransparencyotherother(int whichx, int whichy);
99 bool load(char *fileName);
100 void CalculateNormals();
102 void draw(int layer);
103 void drawpatch(int whichx, int whichy, float opacity);
104 void drawpatchother(int whichx, int whichy, float opacity);
105 void drawpatchotherother(int whichx, int whichy, float opacity);