2 Copyright (C) 2003, 2010 - Wolfire Games
3 Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
5 This file is part of Lugaru.
7 Lugaru is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 Lugaru is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
24 /**> Model Loading <**/
36 #include "Quaternions.h"
51 class TexturedTriangle
58 #define max_model_decals 300
69 short vertexNum, TriangleNum;
79 TexturedTriangle* Triangles;
82 /*int possible[max_model_vertex];
83 int owner[max_textured_triangle];
84 XYZ vertex[max_model_vertex];
85 XYZ normals[max_model_vertex];
86 XYZ facenormals[max_textured_triangle];
87 TexturedTriangle Triangles[max_textured_triangle];
88 GLfloat vArray[max_textured_triangle*24];*/
91 ModelTexture modelTexture;
95 XYZ boundingspherecenter;
96 float boundingsphereradius;
98 float*** decaltexcoords;
102 float* decalrotation;
103 float* decalalivetime;
106 /*float decaltexcoords[max_model_decals][3][2];
107 XYZ decalvertex[max_model_decals][3];
108 int decaltype[max_model_decals];
109 float decalopacity[max_model_decals];
110 float decalrotation[max_model_decals];
111 float decalalivetime[max_model_decals];
112 XYZ decalposition[max_model_decals];*/
118 void DeleteDecal(int which);
119 void MakeDecal(int atype, XYZ *where, float *size, float *opacity, float *rotation);
120 void MakeDecal(int atype, XYZ where, float size, float opacity, float rotation);
121 void drawdecals(Texture shadowtexture, Texture bloodtexture, Texture bloodtexture2, Texture breaktexture);
122 int SphereCheck(XYZ *p1, float radius, XYZ *p, XYZ *move, float *rotate);
123 int SphereCheckPossible(XYZ *p1, float radius, XYZ *move, float *rotate);
124 int LineCheck(XYZ *p1, XYZ *p2, XYZ *p, XYZ *move, float *rotate);
125 int LineCheckPossible(XYZ *p1, XYZ *p2, XYZ *p, XYZ *move, float *rotate);
126 int LineCheckSlidePossible(XYZ *p1, XYZ *p2, XYZ *p, XYZ *move, float *rotate);
127 void UpdateVertexArray();
128 void UpdateVertexArrayNoTex();
129 void UpdateVertexArrayNoTexNoNorm();
130 bool loadnotex(const char *filename);
131 bool loadraw(char *filename);
132 bool load(const char *filename, bool texture);
133 bool loaddecal(const char *filename, bool texture);
134 void Scale(float xscale, float yscale, float zscale);
135 void FlipTexCoords();
136 void UniformTexCoords();
137 void ScaleTexCoords(float howmuch);
138 void ScaleNormals(float xscale, float yscale, float zscale);
139 void Translate(float xtrans, float ytrans, float ztrans);
140 void CalculateNormals(bool facenormalise);
142 void drawdifftex(GLuint texture);
143 void drawdifftex(Texture texture);
144 void drawimmediate();
145 void Rotate(float xang, float yang, float zang);