Browse Source

Wrong assert was used when including glm

Thomas Buck 10 years ago
parent
commit
c0bb765fbf

+ 1
- 3
CMakeLists.txt View File

@@ -56,11 +56,9 @@ set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} ${WARNINGS}")
56 56
 
57 57
 # Flags for Debug build
58 58
 set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -DDEBUG")
59
-set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -DEXPERIMENTAL")
60
-set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -DMULTITEXTURE")
61 59
 
62 60
 # Flags for Releasae builds
63
-set (OpenRaider_CXX_FLAGS_RELEASE "${OpenRaider_CXX_FLAGS_RELEASE} -DNDEBUG")
61
+set (OpenRaider_CXX_FLAGS_RELEASE "${OpenRaider_CXX_FLAGS_RELEASE} -DNODEBUG")
64 62
 
65 63
 #################################################################
66 64
 

+ 1
- 0
ChangeLog.md View File

@@ -4,6 +4,7 @@
4 4
 
5 5
     [ 20140107 ]
6 6
     * Fixed problems with FontTTFs Glyph Baseline
7
+    * No longer using wrong assert() when glm is included
7 8
 
8 9
     [ 20150106 ]
9 10
     * Removed SDL2-TTF Font implementation

+ 0
- 3
include/Camera.h View File

@@ -8,9 +8,6 @@
8 8
 #ifndef _CAMERA_H_
9 9
 #define _CAMERA_H_
10 10
 
11
-#include <glm/vec2.hpp>
12
-#include <glm/vec3.hpp>
13
-#include <glm/mat4x4.hpp>
14 11
 #include <glm/gtc/quaternion.hpp>
15 12
 #include <glm/gtc/type_precision.hpp>
16 13
 

+ 1
- 2
include/Log.h View File

@@ -11,8 +11,7 @@
11 11
 #include <string>
12 12
 #include <sstream>
13 13
 #include <vector>
14
-#include <glm/vec2.hpp>
15
-#include <glm/vec3.hpp>
14
+
16 15
 #include <glm/gtc/type_precision.hpp>
17 16
 
18 17
 class Log {

+ 0
- 3
include/Mesh.h View File

@@ -9,9 +9,6 @@
9 9
 #define _MESH_H_
10 10
 
11 11
 #include <vector>
12
-#include <glm/mat4x4.hpp>
13
-#include <glm/vec2.hpp>
14
-#include <glm/vec3.hpp>
15 12
 
16 13
 #include "system/Shader.h"
17 14
 

+ 1
- 2
include/Render.h View File

@@ -10,8 +10,7 @@
10 10
 #define _RENDER_H_
11 11
 
12 12
 #include <vector>
13
-#include <glm/vec2.hpp>
14
-#include <glm/vec4.hpp>
13
+
15 14
 #include <glm/gtc/type_precision.hpp>
16 15
 
17 16
 #include "Room.h"

+ 0
- 2
include/Room.h View File

@@ -10,8 +10,6 @@
10 10
 
11 11
 #include <memory>
12 12
 #include <vector>
13
-#include <glm/mat4x4.hpp>
14
-#include <glm/vec3.hpp>
15 13
 
16 14
 #include "Sprite.h"
17 15
 #include "RoomData.h"

+ 0
- 2
include/RoomData.h View File

@@ -10,8 +10,6 @@
10 10
 
11 11
 #include <memory>
12 12
 #include <vector>
13
-#include <glm/mat4x4.hpp>
14
-#include <glm/vec3.hpp>
15 13
 
16 14
 class BoundingBox {
17 15
   public:

+ 0
- 3
include/RoomMesh.h View File

@@ -9,9 +9,6 @@
9 9
 #define _ROOM_MESH_H_
10 10
 
11 11
 #include <vector>
12
-#include <glm/mat4x4.hpp>
13
-#include <glm/vec2.hpp>
14
-#include <glm/vec3.hpp>
15 12
 
16 13
 #include "Mesh.h"
17 14
 #include "system/Shader.h"

+ 3
- 5
include/TextureManager.h View File

@@ -9,9 +9,7 @@
9 9
 #ifndef _TEXTURE_MANAGER_H
10 10
 #define _TEXTURE_MANAGER_H
11 11
 
12
-#include <cstdint>
13 12
 #include <vector>
14
-#include <glm/vec2.hpp>
15 13
 
16 14
 // These are loaded into TextureStorage::SYSTEM by initialize()!
17 15
 #define TEXTURE_WHITE 0
@@ -19,11 +17,11 @@
19 17
 
20 18
 class TextureTileVertex {
21 19
   public:
22
-    TextureTileVertex(uint8_t xc, uint8_t xp, uint8_t yc, uint8_t yp)
20
+    TextureTileVertex(int xc, int xp, int yc, int yp)
23 21
         : xCoordinate(xc), xPixel(xp), yCoordinate(yc), yPixel(yp) { }
24 22
 
25
-    uint8_t xCoordinate, xPixel;
26
-    uint8_t yCoordinate, yPixel;
23
+    int xCoordinate, xPixel;
24
+    int yCoordinate, yPixel;
27 25
 };
28 26
 
29 27
 class TextureTile {

+ 1
- 1
include/UI.h View File

@@ -12,7 +12,7 @@
12 12
 #include <list>
13 13
 #include <memory>
14 14
 #include <tuple>
15
-#include <glm/vec2.hpp>
15
+
16 16
 #include <glm/gtc/type_precision.hpp>
17 17
 
18 18
 #include "system/Shader.h"

+ 11
- 3
include/global.h View File

@@ -87,10 +87,18 @@ typedef enum {
87 87
 #include <GL/glext.h>
88 88
 #endif // __APPLE__
89 89
 
90
+/*! \todo Is there a better way to handle this?
91
+ * We wan't to use our own assert(). Unfortunately, glm includes
92
+ * <cassert> in its headers. So we need to define NDEBUG here.
93
+ * To avoid a conflict, our flag is now called NODEBUG instead.
94
+ */
95
+#define NDEBUG
96
+#include <glm/glm.hpp>
97
+
90 98
 // If available, use our own assert that prints the call stack
91 99
 #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS)
92 100
 
93
-#ifndef NDEBUG
101
+#ifndef NODEBUG
94 102
 
95 103
 #include <iostream>
96 104
 #include <execinfo.h>
@@ -160,13 +168,13 @@ template<typename T, typename U>
160 168
         assertNotEqualImplementation(#x " != " #y, assertEvalTemp, assertEvalTemp2, __FILE__, __LINE__, true); \
161 169
 }
162 170
 
163
-#else // NDEBUG
171
+#else // NODEBUG
164 172
 
165 173
 #define assert(x)
166 174
 #define assertEqual(x, y)
167 175
 #define assertNotEqual(x, y)
168 176
 
169
-#endif // NDEBUG
177
+#endif // NODEBUG
170 178
 
171 179
 #else // EXECINFO
172 180
 

+ 0
- 1
include/system/FontTRLE.h View File

@@ -9,7 +9,6 @@
9 9
 #define _FONT_TRLE_H_
10 10
 
11 11
 #include <vector>
12
-#include <glm/vec2.hpp>
13 12
 
14 13
 #include "system/Shader.h"
15 14
 

+ 0
- 3
include/system/Shader.h View File

@@ -9,9 +9,6 @@
9 9
 #define _SHADER_H_
10 10
 
11 11
 #include <vector>
12
-#include <glm/mat4x4.hpp>
13
-#include <glm/vec2.hpp>
14
-#include <glm/vec4.hpp>
15 12
 
16 13
 #include "TextureManager.h"
17 14
 

+ 0
- 5
include/system/Window.h View File

@@ -8,11 +8,6 @@
8 8
 #ifndef _WINDOW_H_
9 9
 #define _WINDOW_H_
10 10
 
11
-#include <vector>
12
-#include <glm/mat4x4.hpp>
13
-#include <glm/vec2.hpp>
14
-#include <glm/vec3.hpp>
15
-#include <glm/vec4.hpp>
16 11
 #include <glm/gtc/type_precision.hpp>
17 12
 
18 13
 class Window {

+ 0
- 1
include/system/WindowGLFW.h View File

@@ -8,7 +8,6 @@
8 8
 #ifndef _WINDOW_GLFW_H_
9 9
 #define _WINDOW_GLFW_H_
10 10
 
11
-#include <glm/vec2.hpp>
12 11
 #include <glm/gtc/type_precision.hpp>
13 12
 
14 13
 #include <GLFW/glfw3.h>

+ 0
- 1
include/system/WindowSDL.h View File

@@ -8,7 +8,6 @@
8 8
 #ifndef _WINDOW_SDL_H_
9 9
 #define _WINDOW_SDL_H_
10 10
 
11
-#include <glm/vec2.hpp>
12 11
 #include <glm/gtc/type_precision.hpp>
13 12
 
14 13
 #include "SDL.h"

+ 4
- 3
src/Camera.cpp View File

@@ -7,9 +7,6 @@
7 7
  */
8 8
 
9 9
 #include <limits>
10
-#include <glm/gtc/epsilon.hpp>
11
-#include <glm/gtc/matrix_transform.hpp>
12
-#include <glm/gtx/quaternion.hpp>
13 10
 
14 11
 #include "global.h"
15 12
 #include "RunTime.h"
@@ -17,6 +14,10 @@
17 14
 #include "system/Window.h"
18 15
 #include "Camera.h"
19 16
 
17
+#include <glm/gtc/epsilon.hpp>
18
+#include <glm/gtc/matrix_transform.hpp>
19
+#include <glm/gtx/quaternion.hpp>
20
+
20 21
 static bool equal(float a, float b) {
21 22
     return glm::epsilonEqual(a, b, std::numeric_limits<float>::epsilon());
22 23
 }

+ 0
- 2
src/Entity.cpp View File

@@ -5,8 +5,6 @@
5 5
  * \author xythobuz
6 6
  */
7 7
 
8
-#include <glm/glm.hpp>
9
-
10 8
 #include "global.h"
11 9
 #include "Log.h"
12 10
 #include "World.h"

+ 5
- 4
src/Render.cpp View File

@@ -8,10 +8,6 @@
8 8
 
9 9
 #include <algorithm>
10 10
 #include <sstream>
11
-#include <glm/gtc/matrix_transform.hpp>
12
-
13
-#include "imgui/imgui.h"
14
-#include "stb/stb_image_write.h"
15 11
 
16 12
 #include "global.h"
17 13
 #include "Camera.h"
@@ -24,6 +20,11 @@
24 20
 #include "utils/strings.h"
25 21
 #include "Render.h"
26 22
 
23
+#include <glm/gtc/matrix_transform.hpp>
24
+
25
+#include "imgui/imgui.h"
26
+#include "stb/stb_image_write.h"
27
+
27 28
 RenderMode Render::mode = RenderMode::LoadScreen;
28 29
 std::vector<Room*> Render::roomList;
29 30
 bool Render::displayViewFrustum = false;

+ 3
- 2
src/Room.cpp View File

@@ -6,8 +6,6 @@
6 6
  */
7 7
 
8 8
 #include <algorithm>
9
-#include <glm/gtc/matrix_transform.hpp>
10
-#include <glm/gtx/intersect.hpp>
11 9
 
12 10
 #include "global.h"
13 11
 #include "Game.h"
@@ -16,6 +14,9 @@
16 14
 #include "Room.h"
17 15
 #include "TextureManager.h"
18 16
 
17
+#include <glm/gtc/matrix_transform.hpp>
18
+#include <glm/gtx/intersect.hpp>
19
+
19 20
 Room::Room(glm::vec3 _pos, BoundingBox* _bbox, RoomMesh* _mesh, unsigned int f,
20 21
            int a, int x, int z) : pos(_pos), bbox(_bbox), mesh(_mesh), flags(f),
21 22
                                   alternateRoom(a), numXSectors(x), numZSectors(z) {

+ 2
- 2
src/RoomData.cpp View File

@@ -5,14 +5,14 @@
5 5
  * \author xythobuz
6 6
  */
7 7
 
8
-#include <glm/gtc/matrix_transform.hpp>
9
-
10 8
 #include "global.h"
11 9
 #include "SkeletalModel.h"
12 10
 #include "World.h"
13 11
 #include "system/Shader.h"
14 12
 #include "RoomData.h"
15 13
 
14
+#include <glm/gtc/matrix_transform.hpp>
15
+
16 16
 void BoundingBox::display(glm::mat4 VP, glm::vec3 colorLine, glm::vec3 colorDot) {
17 17
     std::vector<glm::vec3> verts;
18 18
     std::vector<glm::vec3> cols;

+ 0
- 2
src/Sprite.cpp View File

@@ -5,8 +5,6 @@
5 5
  * \author xythobuz
6 6
  */
7 7
 
8
-#include <glm/glm.hpp>
9
-
10 8
 #include "global.h"
11 9
 #include "Camera.h"
12 10
 #include "Game.h"

+ 1
- 3
src/commands/CommandSet.cpp View File

@@ -5,8 +5,6 @@
5 5
  * \author xythobuz
6 6
  */
7 7
 
8
-#include <glm/glm.hpp>
9
-
10 8
 #include "global.h"
11 9
 #include "Camera.h"
12 10
 #include "Log.h"
@@ -77,7 +75,7 @@ int CommandSet::execute(std::istream& args) {
77 75
             getLog() << "set-size-Error: Invalid value(s)" << Log::endl;
78 76
             return -2;
79 77
         }
80
-        Window::setSize(glm::vec2(w, h));
78
+        Window::setSize(glm::i32vec2(w, h));
81 79
     } else if (var.compare("fullscreen") == 0) {
82 80
         bool fullscreen = false;
83 81
         if (!(args >> fullscreen)) {

+ 2
- 2
src/loader/LoaderTR2.cpp View File

@@ -6,8 +6,6 @@
6 6
  */
7 7
 
8 8
 #include <vector>
9
-#include <glm/glm.hpp>
10
-#include <glm/gtc/matrix_transform.hpp>
11 9
 
12 10
 #include "global.h"
13 11
 #include "Game.h"
@@ -21,6 +19,8 @@
21 19
 #include "utils/pixel.h"
22 20
 #include "loader/LoaderTR2.h"
23 21
 
22
+#include <glm/gtc/matrix_transform.hpp>
23
+
24 24
 LoaderTR2::LoaderTR2() {
25 25
 }
26 26
 

+ 4
- 4
src/main.cpp View File

@@ -177,7 +177,7 @@ void renderFrame() {
177 177
 }
178 178
 
179 179
 #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS)
180
-#ifndef NDEBUG
180
+#ifndef NODEBUG
181 181
 
182 182
 #include <exception>
183 183
 #include <execinfo.h>
@@ -192,8 +192,8 @@ namespace {
192 192
         char** strs = backtrace_symbols(callstack, frames);
193 193
 
194 194
         std::cout << std::endl;
195
-        for (int i = 0; i < frames; i++)
196
-            std::cout << strs[i] << std::endl;
195
+        for (int i = frames; i > 0; i++)
196
+            std::cout << strs[i - 1] << std::endl;
197 197
 
198 198
         delete [] strs;
199 199
 
@@ -204,6 +204,6 @@ namespace {
204 204
     std::terminate_handler oldTerminateHandler = std::set_terminate(terminateHandler);
205 205
 }
206 206
 
207
-#endif // NDEBUG
207
+#endif // NODEBUG
208 208
 #endif // HAVE_EXECINFO_H && HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS
209 209
 

Loading…
Cancel
Save