-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTankGeometryMgr.h
170 lines (138 loc) · 3.37 KB
/
TankGeometryMgr.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/* bzflag
* Copyright (c) 1993-2021 Tim Riker
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the license found in the file
* named COPYING that should have accompanied this file.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* TankGeometryMgr:
* Generates the display lists for TankSceneNodes
*/
#ifndef BZF_TANK_GEOMETRY_MGR_H
#define BZF_TANK_GEOMETRY_MGR_H
#include "glwriter.h"
#include "common.h"
//#include "SceneNode.h"
namespace TankGeometryEnums
{
enum TankShadow
{
ShadowOff = 0,
ShadowOn,
LastTankShadow
};
enum TankLOD
{
LowTankLOD = 0,
MedTankLOD,
HighTankLOD,
LastTankLOD
};
enum TankSize
{
Normal = 0,
Obese,
Tiny,
Narrow,
Thief,
LastTankSize
};
enum TankPart
{
Body = 0,
Barrel,
Turret,
LeftCasing,
RightCasing,
LeftTread, // animated parts
RightTread,
LeftWheel0,
LeftWheel1,
LeftWheel2,
LeftWheel3,
RightWheel0,
RightWheel1,
RightWheel2,
RightWheel3,
LastTankPart,
BasicTankParts = LeftTread,
LowTankParts = LeftTread,
MedTankParts = LeftTread,
HighTankParts = LastTankPart
};
}
namespace TankGeometryMgr
{
void init();
void kill();
void buildLists();
void deleteLists();
GLuint getPartList(TankGeometryEnums::TankShadow shadow,
TankGeometryEnums::TankPart part,
TankGeometryEnums::TankSize size,
TankGeometryEnums::TankLOD lod);
int getPartTriangleCount(TankGeometryEnums::TankShadow shadow,
TankGeometryEnums::TankPart part,
TankGeometryEnums::TankSize size,
TankGeometryEnums::TankLOD lod);
const float* getScaleFactor(TankGeometryEnums::TankSize size);
}
namespace TankGeometryUtils
{
enum TreadStyle
{
Covered = 0,
Exposed = 1
};
void setTreadStyle(int style);
// degrees / meter
float getWheelScale();
// texcoords / meter
float getTreadScale();
// texcoords
float getTreadTexLen();
// help to scale vertices and normals
void doVertex3f(GLfloat x, GLfloat y, GLfloat z);
void doNormal3f(GLfloat x, GLfloat y, GLfloat z);
void doTexCoord2f(GLfloat x, GLfloat y);
//
// NOTE: these all return their triangle count
//
// lowtank geometry builder
int buildLowBody (void);
int buildLowTurret (void);
int buildLowLCasing (void);
int buildLowRCasing (void);
int buildLowBarrel (void);
// medtank geometry builder
int buildMedBody (void);
int buildMedTurret (void);
int buildMedLCasing (void);
int buildMedRCasing (void);
//int buildMedBarrel (void); // Same as buildLowBarrel
// hightank geometry builder
int buildHighBody (void);
int buildHighBarrel (void);
int buildHighTurret (void);
int buildHighLCasing (void);
int buildHighRCasing (void);
// animated geometry builder
int buildHighLCasingAnim (void);
int buildHighRCasingAnim (void);
int buildHighLTread (int divs);
int buildHighRTread (int divs);
int buildHighLWheel (int wheel, float angle, int divs);
int buildHighRWheel (int wheel, float angle, int divs);
}
#endif // BZF_TANK_GEOMETRY_MGR_H
// Local Variables: ***
// mode: C++ ***
// tab-width: 4 ***
// c-basic-offset: 4 ***
// indent-tabs-mode: nil ***
// End: ***
// ex: shiftwidth=4 tabstop=4