Skip to content

Commit 48b6c18

Browse files
committed
replace vectors.h with glm
1 parent 2269be8 commit 48b6c18

23 files changed

+225
-1274
lines changed

include/BoltSceneNode.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
// Inherits from
2121
#include "SceneNode.h"
2222

23+
// System headers
24+
#include <glm/vec4.hpp>
25+
2326
// Common headers
2427
#include "OpenGLLight.h"
2528

@@ -108,7 +111,7 @@ class BoltSceneNode : public SceneNode
108111
float size;
109112
float velocity[3];
110113
GLfloat color[4];
111-
fvec4 teamColor;
114+
glm::vec4 teamColor;
112115
OpenGLLight light;
113116
OpenGLGState gstate;
114117
OpenGLGState colorblindGState;

include/LaserSceneNode.h

+6-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
#ifndef BZF_LASER_SCENE_NODE_H
1818
#define BZF_LASER_SCENE_NODE_H
1919

20-
#include "common.h"
20+
// Inherits from
2121
#include "SceneNode.h"
2222

23+
// System headers
24+
#include <glm/vec4.hpp>
25+
2326
class LaserSceneNode : public SceneNode
2427
{
2528
public:
@@ -58,8 +61,8 @@ class LaserSceneNode : public SceneNode
5861
const LaserSceneNode* sceneNode;
5962
static GLfloat geom[6][2];
6063
};
61-
fvec4 color;
62-
fvec4 centerColor;
64+
glm::vec4 color;
65+
glm::vec4 centerColor;
6366
bool first;
6467
friend class LaserRenderNode;
6568

include/Makefile.am

-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ noinst_HEADERS = \
144144
messages.h \
145145
multicast.h \
146146
network.h \
147-
vectors.h \
148147
version.h \
149148
win32.h
150149

include/OpenGLUtils.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
#include <string>
2020
#include <map>
2121
#include <vector>
22+
#include <glm/vec4.hpp>
2223

2324
// common headers
2425
#include "bzfgl.h"
25-
#include "vectors.h"
2626

2727

2828
class BzMaterial;
@@ -33,7 +33,7 @@ class OpenGLGState;
3333

3434

3535
extern void bzMat2gstate(const BzMaterial* bzmat, OpenGLGState& gstate,
36-
fvec4& color, const fvec4*& colorPtr);
36+
glm::vec4 &color, const glm::vec4 *&colorPtr);
3737

3838
extern bool parseBlendFactors(const std::string& s, GLenum& src, GLenum& dst);
3939

include/SceneNode.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@
2727
#ifndef BZF_SCENE_NODE_H
2828
#define BZF_SCENE_NODE_H
2929

30+
// top include
3031
#include "common.h"
32+
33+
// System headers
34+
#include <vector>
35+
36+
// Common headers
3137
#include "bzfgl.h"
3238
#include "bzfio.h"
3339
#include "OpenGLGState.h"
3440
#include "RenderNode.h"
3541
#include "Extents.h"
36-
#include "vectors.h"
37-
#include <vector>
3842

3943
#if !defined(_WIN32)
4044
// bonehead win32 cruft. just make it go away on other platforms.

include/SceneRenderer.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424
#include "Singleton.h"
2525

2626
/* system interface headers */
27+
#include <string>
2728
#include <vector>
29+
#include <glm/vec4.hpp>
30+
#include <glm/gtc/type_ptr.hpp>
2831

2932
/* common interface headers */
3033
#include "OpenGLLight.h"
3134
#include "ViewFrustum.h"
3235
#include "RenderNode.h"
33-
#include "vectors.h"
3436

3537
#define RENDERER (SceneRenderer::instance())
3638

@@ -161,13 +163,13 @@ class SceneRenderer : public Singleton<SceneRenderer>
161163
fogActive = b;
162164
}
163165

164-
const fvec4& getFogColor() const
166+
const glm::vec4 &getFogColor() const
165167
{
166168
return fogColor;
167169
}
168170
void setFogColor( float *color)
169171
{
170-
fogColor = color;
172+
fogColor = glm::make_vec4(color);
171173
}
172174

173175

@@ -258,7 +260,7 @@ class SceneRenderer : public Singleton<SceneRenderer>
258260
bool needStyleUpdate;
259261
bool rebuildTanks;
260262
bool fogActive;
261-
fvec4 fogColor;
263+
glm::vec4 fogColor;
262264

263265
std::vector<FlareLight> flareLightList;
264266
RenderNodeList shadowList;

include/TankSceneNode.h

+15-9
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@
1717
#ifndef BZF_TANK_SCENE_NODE_H
1818
#define BZF_TANK_SCENE_NODE_H
1919

20-
#include "common.h"
20+
// Inherits
2121
#include "SceneNode.h"
22+
23+
// System headers
24+
#include <glm/vec3.hpp>
25+
#include <glm/vec4.hpp>
26+
27+
// Common headers
2228
#include "OpenGLLight.h"
2329
#include "TankGeometryMgr.h"
2430

@@ -32,26 +38,26 @@ class TankDeathOverride
3238
class DeathParams
3339
{
3440
public:
35-
DeathParams( float param, fvec4 c): part()
41+
DeathParams( float param, const glm::vec4 &c): part()
3642
{
37-
scale = fvec3(1,1,1);
43+
scale = glm::vec3(1);
3844
explodeParam = param;
3945
color = c;
4046
draw = true;
4147
}
4248

4349
TankGeometryEnums::TankPart part;
44-
fvec3 pos;
45-
fvec3 rot;
46-
fvec3 scale;
50+
glm::vec3 pos;
51+
glm::vec3 rot;
52+
glm::vec3 scale;
4753
float explodeParam;
48-
fvec4 color;
54+
glm::vec4 color;
4955
bool draw;
5056
};
5157

5258
virtual bool SetDeathRenderParams ( DeathParams &/*params*/ ) = 0;
5359
virtual bool ShowExplosion ( void ) = 0;
54-
virtual bool GetDeathVector ( fvec3 &/*vel*/ ) = 0;
60+
virtual bool GetDeathVector (glm::vec3 &/*vel*/) = 0;
5561
};
5662

5763
class TankIDLSceneNode : public SceneNode
@@ -156,7 +162,7 @@ class TankSceneNode : public SceneNode
156162
return deathOverride;
157163
}
158164

159-
fvec3 explodePos;
165+
glm::vec3 explodePos;
160166
protected:
161167
TankDeathOverride *deathOverride;
162168

0 commit comments

Comments
 (0)