Colobot
model_io_structs.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
20 #pragma once
21 
22 #include "graphics/core/material.h"
23 
24 #include "graphics/model/model_triangle.h"
25 
26 namespace Gfx
27 {
28 
29 /*******************************************************
30  Deprecated enums/magic values
31  *******************************************************/
32 
39 enum class ModelLODLevel
40 {
41  Constant = -1,
42  Low = 1,
43  Medium = 2,
44  High = 4
45 };
46 
53 enum class ModelRenderState
54 {
55  TTextureBlack = 1,
56  TTextureWhite = 2,
57  Part1 = 256,
58  Part2 = 512,
59  Part3 = 1024,
60  TwoFace = 4096,
61  Alpha = 8192
62 };
63 
64 /*******************************************************
65  New model formats
66  *******************************************************/
67 
73 {
75  int version = 0;
77  int totalTriangles = 0;
78 };
79 
85 {
95  std::string tex1Name;
97  std::string tex2Name;
99  bool variableTex2 = true;
103  int state = 0;
104 };
105 
111 {
113  int version = 0;
115  int totalCrashSpheres = 0;
117  bool hasShadowSpot = false;
119  bool hasCameraCollisionSphere = false;
121  int totalMeshes = 0;
122 };
123 
129 {
131  int totalTriangles = 0;
133  std::string name;
135  std::string parentName;
142 };
143 
151 
152 
153 
154 /*******************************************************
155  Deprecated formats
156  *******************************************************/
157 
165 {
167  int revision = 0;
169  int version = 0;
171  int totalTriangles = 0;
173  int reserved[10] = {};
174 };
175 
176 
184 {
185  char used = 0;
186  char selected = 0;
187  Vertex p1;
188  Vertex p2;
189  Vertex p3;
190  Material material;
191  char texName[20] = {};
192  float min = 0;
193  float max = 0;
194 };
195 
203 {
204  char used = 0;
205  char selected = 0;
206  Vertex p1;
207  Vertex p2;
208  Vertex p3;
209  Material material;
210  char texName[20] = {};
211  float min = 0.0f;
212  float max = 0.0f;
213  long state = 0;
214  short reserved1 = 0;
215  short reserved2 = 0;
216  short reserved3 = 0;
217  short reserved4 = 0;
218 };
219 
227 {
228  char used = 0;
229  char selected = 0;
230  VertexTex2 p1;
231  VertexTex2 p2;
232  VertexTex2 p3;
233  Material material;
234  char texName[20] = {};
235  float min = 0.0f;
236  float max = 0.0f;
237  long state = 0;
238  short texNum2 = 0;
239  short reserved2 = 0;
240  short reserved3 = 0;
241  short reserved4 = 0;
242 };
243 
244 } // namespace Gfx
Material struct.
old ENG_RSTATE_TTEXTURE_WHITE
Vertex of a primitive.
Definition: vertex.h:52
old ENG_RSTATE_PART3
Vertex with secondary texture coordinates.
Definition: vertex.h:113
old ENG_RSTATE_TTEXTURE_BLACK
triangle is always visible, no matter at what distance
VertexTex2 p2
2nd vertex
Definition: model_io_structs.h:89
Math::Vector scale
Mesh scale.
Definition: model_io_structs.h:141
triangle is visible at closest distance (highest quality)
std::string tex2Name
Name of 2nd texture.
Definition: model_io_structs.h:97
VertexTex2 p1
1st vertex
Definition: model_io_structs.h:87
old ENG_RSTATE_ALPHA
std::string name
Mesh name.
Definition: model_io_structs.h:133
Material of a surface.
Definition: material.h:45
old ENG_RSTATE_2FACE
triangle is visible at medium distance (medium quality)
Math::Vector rotation
Mesh rotation.
Definition: model_io_structs.h:139
old ENG_RSTATE_PART2
VertexTex2 p3
3rd vertex
Definition: model_io_structs.h:91
ModelLODLevel
Old level-of-detail enum.
Definition: model_io_structs.h:39
Old Colobot binary model file version 3.
Definition: model_io_structs.h:226
Header for new model file version 3.
Definition: model_io_structs.h:110
std::string tex1Name
Name of 1st texture.
Definition: model_io_structs.h:95
Old Colobot binary model file version 2.
Definition: model_io_structs.h:202
Old Colobot binary model header info.
Definition: model_io_structs.h:164
Namespace for (new) graphics code.
Definition: app.h:49
triangle is visible at farthest distance (lowest quality)
Triangle of new model file version 1 and 2.
Definition: model_io_structs.h:84
Math::Vector position
Mesh position.
Definition: model_io_structs.h:137
Mesh triangle saved in new model file version 3.
Definition: model_io_structs.h:150
ModelRenderState
Old render state enum (values copied from EngineRenderState)
Definition: model_io_structs.h:53
Material material
Material.
Definition: model_io_structs.h:93
old ENG_RSTATE_PART1
A single triangle in mesh as saved in model file.
Definition: model_triangle.h:60
Header for new model file version 1 and 2.
Definition: model_io_structs.h:72
3D (3x1) vector
Definition: vector.h:53
Old Colobot binary model file version 1.
Definition: model_io_structs.h:183
std::string parentName
Parent mesh name.
Definition: model_io_structs.h:135
Header for mesh saved in new model file version 3.
Definition: model_io_structs.h:128