Przeglądaj źródła

Wrong assert was used when including glm

Thomas Buck 9 lat temu
rodzic
commit
c0bb765fbf

+ 1
- 3
CMakeLists.txt Wyświetl plik

56
 
56
 
57
 # Flags for Debug build
57
 # Flags for Debug build
58
 set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -DDEBUG")
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
 # Flags for Releasae builds
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 Wyświetl plik

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

+ 0
- 3
include/Camera.h Wyświetl plik

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

+ 1
- 2
include/Log.h Wyświetl plik

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

+ 0
- 3
include/Mesh.h Wyświetl plik

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

+ 1
- 2
include/Render.h Wyświetl plik

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

+ 0
- 2
include/Room.h Wyświetl plik

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

+ 0
- 2
include/RoomData.h Wyświetl plik

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

+ 0
- 3
include/RoomMesh.h Wyświetl plik

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

+ 3
- 5
include/TextureManager.h Wyświetl plik

9
 #ifndef _TEXTURE_MANAGER_H
9
 #ifndef _TEXTURE_MANAGER_H
10
 #define _TEXTURE_MANAGER_H
10
 #define _TEXTURE_MANAGER_H
11
 
11
 
12
-#include <cstdint>
13
 #include <vector>
12
 #include <vector>
14
-#include <glm/vec2.hpp>
15
 
13
 
16
 // These are loaded into TextureStorage::SYSTEM by initialize()!
14
 // These are loaded into TextureStorage::SYSTEM by initialize()!
17
 #define TEXTURE_WHITE 0
15
 #define TEXTURE_WHITE 0
19
 
17
 
20
 class TextureTileVertex {
18
 class TextureTileVertex {
21
   public:
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
         : xCoordinate(xc), xPixel(xp), yCoordinate(yc), yPixel(yp) { }
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
 class TextureTile {
27
 class TextureTile {

+ 1
- 1
include/UI.h Wyświetl plik

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

+ 11
- 3
include/global.h Wyświetl plik

87
 #include <GL/glext.h>
87
 #include <GL/glext.h>
88
 #endif // __APPLE__
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
 // If available, use our own assert that prints the call stack
98
 // If available, use our own assert that prints the call stack
91
 #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS)
99
 #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS)
92
 
100
 
93
-#ifndef NDEBUG
101
+#ifndef NODEBUG
94
 
102
 
95
 #include <iostream>
103
 #include <iostream>
96
 #include <execinfo.h>
104
 #include <execinfo.h>
160
         assertNotEqualImplementation(#x " != " #y, assertEvalTemp, assertEvalTemp2, __FILE__, __LINE__, true); \
168
         assertNotEqualImplementation(#x " != " #y, assertEvalTemp, assertEvalTemp2, __FILE__, __LINE__, true); \
161
 }
169
 }
162
 
170
 
163
-#else // NDEBUG
171
+#else // NODEBUG
164
 
172
 
165
 #define assert(x)
173
 #define assert(x)
166
 #define assertEqual(x, y)
174
 #define assertEqual(x, y)
167
 #define assertNotEqual(x, y)
175
 #define assertNotEqual(x, y)
168
 
176
 
169
-#endif // NDEBUG
177
+#endif // NODEBUG
170
 
178
 
171
 #else // EXECINFO
179
 #else // EXECINFO
172
 
180
 

+ 0
- 1
include/system/FontTRLE.h Wyświetl plik

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

+ 0
- 3
include/system/Shader.h Wyświetl plik

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

+ 0
- 5
include/system/Window.h Wyświetl plik

8
 #ifndef _WINDOW_H_
8
 #ifndef _WINDOW_H_
9
 #define _WINDOW_H_
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
 #include <glm/gtc/type_precision.hpp>
11
 #include <glm/gtc/type_precision.hpp>
17
 
12
 
18
 class Window {
13
 class Window {

+ 0
- 1
include/system/WindowGLFW.h Wyświetl plik

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

+ 0
- 1
include/system/WindowSDL.h Wyświetl plik

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

+ 4
- 3
src/Camera.cpp Wyświetl plik

7
  */
7
  */
8
 
8
 
9
 #include <limits>
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
 #include "global.h"
11
 #include "global.h"
15
 #include "RunTime.h"
12
 #include "RunTime.h"
17
 #include "system/Window.h"
14
 #include "system/Window.h"
18
 #include "Camera.h"
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
 static bool equal(float a, float b) {
21
 static bool equal(float a, float b) {
21
     return glm::epsilonEqual(a, b, std::numeric_limits<float>::epsilon());
22
     return glm::epsilonEqual(a, b, std::numeric_limits<float>::epsilon());
22
 }
23
 }

+ 0
- 2
src/Entity.cpp Wyświetl plik

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

+ 5
- 4
src/Render.cpp Wyświetl plik

8
 
8
 
9
 #include <algorithm>
9
 #include <algorithm>
10
 #include <sstream>
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
 #include "global.h"
12
 #include "global.h"
17
 #include "Camera.h"
13
 #include "Camera.h"
24
 #include "utils/strings.h"
20
 #include "utils/strings.h"
25
 #include "Render.h"
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
 RenderMode Render::mode = RenderMode::LoadScreen;
28
 RenderMode Render::mode = RenderMode::LoadScreen;
28
 std::vector<Room*> Render::roomList;
29
 std::vector<Room*> Render::roomList;
29
 bool Render::displayViewFrustum = false;
30
 bool Render::displayViewFrustum = false;

+ 3
- 2
src/Room.cpp Wyświetl plik

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

+ 2
- 2
src/RoomData.cpp Wyświetl plik

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

+ 0
- 2
src/Sprite.cpp Wyświetl plik

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

+ 1
- 3
src/commands/CommandSet.cpp Wyświetl plik

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

+ 2
- 2
src/loader/LoaderTR2.cpp Wyświetl plik

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

+ 4
- 4
src/main.cpp Wyświetl plik

177
 }
177
 }
178
 
178
 
179
 #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS)
179
 #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS)
180
-#ifndef NDEBUG
180
+#ifndef NODEBUG
181
 
181
 
182
 #include <exception>
182
 #include <exception>
183
 #include <execinfo.h>
183
 #include <execinfo.h>
192
         char** strs = backtrace_symbols(callstack, frames);
192
         char** strs = backtrace_symbols(callstack, frames);
193
 
193
 
194
         std::cout << std::endl;
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
         delete [] strs;
198
         delete [] strs;
199
 
199
 
204
     std::terminate_handler oldTerminateHandler = std::set_terminate(terminateHandler);
204
     std::terminate_handler oldTerminateHandler = std::set_terminate(terminateHandler);
205
 }
205
 }
206
 
206
 
207
-#endif // NDEBUG
207
+#endif // NODEBUG
208
 #endif // HAVE_EXECINFO_H && HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS
208
 #endif // HAVE_EXECINFO_H && HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS
209
 
209
 

Ładowanie…
Anuluj
Zapisz