Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion MSVC/build/ogl.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\ogl\OpenGLAPI.cxx" />
<ClCompile Include="..\..\src\ogl\OpenGLFramebuffer.cxx" />
<ClCompile Include="..\..\src\ogl\OpenGLGState.cxx">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
Expand Down Expand Up @@ -279,6 +280,7 @@
<ItemGroup>
<ClInclude Include="..\..\include\bzfgl.h" />
<ClInclude Include="..\..\include\glext.h" />
<ClInclude Include="..\..\include\OpenGLAPI.h" />
<ClInclude Include="..\..\include\OpenGLFramebuffer.h" />
<ClInclude Include="..\..\include\OpenGLGState.h" />
<ClInclude Include="..\..\include\OpenGLLight.h" />
Expand All @@ -290,4 +292,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
8 changes: 7 additions & 1 deletion MSVC/build/ogl.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<ClCompile Include="..\..\src\ogl\RenderNode.cxx">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ogl\OpenGLAPI.cxx">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ogl\OpenGLFramebuffer.cxx">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -48,6 +51,9 @@
<ClInclude Include="..\..\include\glext.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\OpenGLAPI.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\OpenGLFramebuffer.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand All @@ -60,4 +66,4 @@
<UniqueIdentifier>{8b1c786a-fe0a-4a9f-8809-6572c90a8d13}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
</Project>
4 changes: 0 additions & 4 deletions Xcode/BZFlag.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1112,8 +1112,6 @@
0305D5F0166C9DAE00557FC4 /* TextUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextUtils.h; sourceTree = "<group>"; };
0305D5F2166C9DAE00557FC4 /* TimeKeeper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeKeeper.h; sourceTree = "<group>"; };
0305D5F4166C9DAE00557FC4 /* TriWallSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TriWallSceneNode.h; sourceTree = "<group>"; };
0305D5F5166C9DAE00557FC4 /* vectors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vectors.h; sourceTree = "<group>"; };
0305D5F6166C9DAE00557FC4 /* vectors_old.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vectors_old.h; sourceTree = "<group>"; };
0305D5F7166C9DAE00557FC4 /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = "<group>"; };
0305D5F8166C9DAE00557FC4 /* ViewFrustum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewFrustum.h; sourceTree = "<group>"; };
0305D5FA166C9DAE00557FC4 /* VotingBooth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VotingBooth.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2372,8 +2370,6 @@
0305D5F0166C9DAE00557FC4 /* TextUtils.h */,
0305D5F2166C9DAE00557FC4 /* TimeKeeper.h */,
0305D5F4166C9DAE00557FC4 /* TriWallSceneNode.h */,
0305D5F5166C9DAE00557FC4 /* vectors.h */,
0305D5F6166C9DAE00557FC4 /* vectors_old.h */,
0305D5F7166C9DAE00557FC4 /* version.h */,
0305D5F8166C9DAE00557FC4 /* ViewFrustum.h */,
0305D5FA166C9DAE00557FC4 /* VotingBooth.h */,
Expand Down
15 changes: 15 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ AC_ARG_ENABLE(ubsan, [ --enable-ubsan undefined behaviour sanitize
# do we want the bzflag client?
AC_ARG_ENABLE(client, [ --disable-client server-only build])

AC_ARG_ENABLE([avx2], [AS_HELP_STRING([--enable-avx2],[enable glm use of avx2])])
AC_ARG_ENABLE([fma], [AS_HELP_STRING([--enable-fma],[enable glm use of fma])])

# enable UPnP for server
AC_ARG_ENABLE(UPnP, [ --enable-UPnP Use UPnP for server],
, [enable_UPnP=no])
Expand Down Expand Up @@ -419,6 +422,10 @@ AC_CHECK_HEADERS( \
cstdio \
cstring
)
AC_CHECK_HEADERS(
[glm/glm.hpp],
,
[AC_MSG_ERROR([glm (from https://glm.g-truc.net) is needed])])
AC_LANG(C)
AC_CHECK_HEADERS( \
SDL2/SDL.h \
Expand All @@ -439,6 +446,14 @@ AC_CHECK_HEADERS( \
values.h \
)

if test "x$enable_avx2" = "xyes"; then
AC_DEFINE(GLM_FORCE_AVX2, 1, [ Enable avx2 in glm])
AC_DEFINE(GLM_FORCE_DEFAULT_ALIGNED_GENTYPES, 1, [ Align gentypes])
fi
if test "x$enable_fma" = "xyes"; then
AC_DEFINE(GLM_FORCE_FMA, 1, [ Enable fma in glm])
fi

if test "x$enable_UPnP" = "xyes"; then
AC_CHECK_HEADERS(
[miniupnpc/miniupnpc.h],
Expand Down
3 changes: 2 additions & 1 deletion include/AnsiCodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

// System headers
#include <string>
#include <glm/vec3.hpp>

// Common headers
#include "TextUtils.h"
Expand Down Expand Up @@ -105,7 +106,7 @@ static const std::string ColorStrings[17] =
ANSI_STR_NO_UNDERLINE // 16 No Underlining
};

inline std::string rgbToAnsi(const float* color)
inline std::string rgbToAnsi(const glm::vec3 &color)
{
return TextUtils::format("%s;%u;%u;%um",
ANSI_STR_FG_RGB,
Expand Down
23 changes: 5 additions & 18 deletions include/ArcObstacle.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ArcObstacle final : public Obstacle

ArcObstacle();
ArcObstacle(const MeshTransform& transform,
const float* _pos, const float* _size,
const glm::vec3 &_pos, const glm::vec3 &_size,
float _rotation, float _angle, float _ratio,
const float _texsize[4], bool _useNormals,
int _divisions, const BzMaterial* mats[MaterialCount],
Expand All @@ -63,23 +63,10 @@ class ArcObstacle final : public Obstacle
bool isFlatTop() const override;

float intersect(const Ray&) const override;
void getNormal(const float* p, float* n) const override;
void get3DNormal(const float* p, float* n) const override;

bool inCylinder(const float* p, float radius, float height) const override;
bool inBox(const float* p, float angle,
float halfWidth, float halfBreadth, float height) const override;
bool inMovingBox(const float* oldP, float oldAngle,
const float *newP, float newAngle,
float halfWidth, float halfBreadth, float height) const override;
bool isCrossing(const float* p, float angle,
float halfWidth, float halfBreadth, float height,
float* plane) const override;

bool getHitNormal(const float* pos1, float azimuth1,
const float* pos2, float azimuth2,
float halfWidth, float halfBreadth,
float height, float* normal) const override;
void getNormal(const glm::vec3 &p, glm::vec3 &n) const override;
void get3DNormal(const glm::vec3 &p, glm::vec3 &n) const override;

bool inCylinder(const glm::vec3 &p, float radius, float height) const override;

int packSize() const override;
void *pack(void*) const override;
Expand Down
3 changes: 2 additions & 1 deletion include/BSPSceneDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

// system headers
#include <vector>
#include <glm/vec3.hpp>

// common implementation headers
#include "bzfgl.h"
Expand Down Expand Up @@ -82,7 +83,7 @@ class BSPSceneDatabase final : public SceneDatabase
Node* root;
int depth;
// the following members avoid passing parameters around
GLfloat eye[3];
glm::vec3 eye;
SceneRenderer* renderer;
const ViewFrustum* frustum;

Expand Down
14 changes: 7 additions & 7 deletions include/BaseBuilding.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ class BaseBuilding final : public BoxBuilding

public:
BaseBuilding();
BaseBuilding(const float *pos, float rotation,
const float *size, int _team, bool ricochet);
BaseBuilding(const glm::vec3 &pos, float rotation,
const glm::vec3 &size, int _team, bool ricochet);
~BaseBuilding();

Obstacle* copyWithTransform(const MeshTransform&) const override;

const char* getType() const override;
static const char* getClassName(); // const

bool inCylinder(const float* p, float radius, float height) const override;
bool inMovingBox(const float* oldP, float oldAngle,
const float *newP, float newAngle,
bool inCylinder(const glm::vec3 &p, float radius, float height) const override;
bool inMovingBox(const glm::vec3 &oldP, float oldAngle,
const glm::vec3 &newP, float newAngle,
float halfWidth, float halfBreadth, float height) const override;
bool isCrossing(const float* p, float angle,
bool isCrossing(const glm::vec3 &p, float angle,
float halfWidth, float halfBreadth, float height,
float* plane) const override;
glm::vec4 *plane) const override;

int getTeam() const;

Expand Down
10 changes: 5 additions & 5 deletions include/BillboardSceneNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class BillboardSceneNode final : public SceneNode
{
public:
BillboardSceneNode(const GLfloat pos[3]);
BillboardSceneNode(const glm::vec3 &pos);
~BillboardSceneNode();

virtual BillboardSceneNode* copy() const;
Expand All @@ -53,7 +53,7 @@ class BillboardSceneNode final : public SceneNode
void setTexture(const int);
void setTextureAnimation(int cu, int cv);

void move(const GLfloat pos[3]);
void move(const glm::vec3 &pos);
void setAngle(GLfloat);
void addLight(SceneRenderer&) override;

Expand All @@ -68,7 +68,7 @@ class BillboardSceneNode final : public SceneNode
~BillboardRenderNode();
void setColor(const GLfloat* rgba);
void render() override;
const GLfloat* getPosition() const override;
const glm::vec3 &getPosition() const override;
void setFrame(float u, float v);
void setFrameSize(float du, float dv);
private:
Expand All @@ -90,9 +90,9 @@ class BillboardSceneNode final : public SceneNode
bool lightSource;
bool groundLight;
float width, height;
GLfloat color[4];
glm::vec4 color;
GLfloat angle;
GLfloat lightColor[3];
glm::vec3 lightColor;
GLfloat lightScale;
float lightCutoffTime;
int cu, cv;
Expand Down
49 changes: 21 additions & 28 deletions include/BoltSceneNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,31 @@
// Inherits from
#include "SceneNode.h"

// System headers
#include <glm/vec4.hpp>

// Common headers
#include "OpenGLLight.h"

class BoltSceneNode final : public SceneNode
{
public:
BoltSceneNode(const GLfloat pos[3], const GLfloat vel[3], bool super);
BoltSceneNode(const glm::vec3 &pos, const glm::vec3 &vel, bool super);
~BoltSceneNode();

void setFlares(bool);
void setSize(float radius);
void setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.0f);
void setTextureColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.0f);
void setColor(const GLfloat* rgb);
void setTeamColor(const GLfloat* rgb);
void setColor(const glm::vec3 &rgb);
void setTeamColor(const glm::vec3 &rgb);
void setTexture(const int);
void setTextureAnimation(int cu, int cv);

bool getColorblind() const;
void setColorblind(bool);

bool getInvisible() const
{
return invisible;
}
void setInvisible(bool _invisible)
{
invisible = _invisible;
}

void move(const GLfloat pos[3], const GLfloat forward[3]);
void move(const glm::vec3 &pos, const glm::vec3 &forward);
void addLight(SceneRenderer&) override;

void notifyStyleChange() override;
Expand All @@ -64,10 +58,10 @@ class BoltSceneNode final : public SceneNode
public:
BoltRenderNode(const BoltSceneNode*);
~BoltRenderNode();
void setColor(const GLfloat* rgba);
void setTextureColor(const GLfloat* rgba);
void setColor(const glm::vec4 &rgba);
void setTextureColor(const glm::vec4 &rgba);
void render() override;
const GLfloat* getPosition() const override;
const glm::vec3 &getPosition() const override;
void setAnimation(int cu, int cv);

void renderGeoBolt();
Expand All @@ -78,19 +72,18 @@ class BoltSceneNode final : public SceneNode
const BoltSceneNode* sceneNode;
int u, v, cu, cv;
GLfloat du, dv;
GLfloat mainColor[4];
GLfloat innerColor[4];
GLfloat outerColor[4];
GLfloat coronaColor[4];
GLfloat flareColor[4];
GLfloat textureColor[4];
glm::vec4 mainColor;
glm::vec4 innerColor;
glm::vec4 outerColor;
glm::vec4 coronaColor;
glm::vec4 flareColor;
glm::vec4 textureColor;
int numFlares;
float theta[6];
float phi[6];

static GLfloat core[9][2];
static GLfloat corona[8][2];
static const GLfloat ring[8][2];
static glm::vec2 core[9];
static const glm::vec2 corona[8];
static const GLfloat CoreFraction;
static const GLfloat FlareSize;
static const GLfloat FlareSpread;
Expand All @@ -103,9 +96,9 @@ class BoltSceneNode final : public SceneNode
bool texturing;
bool colorblind;
float size;
float velocity[3];
GLfloat color[4];
fvec4 teamColor;
glm::vec4 color;
glm::vec4 teamColor;
glm::vec3 velocity;
OpenGLLight light;
OpenGLGState gstate;
OpenGLGState colorblindGState;
Expand Down
Loading
Loading