Skip to content

Commit 5353f45

Browse files
authored
Merge pull request #35 from cortex-command-community/glm.hpp
Reduce inclusion of glm.hpp
2 parents 3c48946 + 14988b2 commit 5353f45

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

Source/Managers/PostProcessMan.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void PostProcessMan::CreateGLBackBuffers() {
126126
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
127127
UpdatePalette();
128128
glActiveTexture(GL_TEXTURE0);
129-
m_ProjectionMatrix = glm::ortho(0.0F, static_cast<float>(g_FrameMan.GetBackBuffer8()->w), 0.0F, static_cast<float>(g_FrameMan.GetBackBuffer8()->h), -1.0F, 1.0F);
129+
m_ProjectionMatrix = std::make_unique<glm::mat4>(glm::ortho(0.0F, static_cast<float>(g_FrameMan.GetBackBuffer8()->w), 0.0F, static_cast<float>(g_FrameMan.GetBackBuffer8()->h), -1.0F, 1.0F));
130130
}
131131

132132
void PostProcessMan::UpdatePalette() {
@@ -457,7 +457,7 @@ void PostProcessMan::DrawDotGlowEffects() {
457457
transformMatrix = glm::translate(transformMatrix, glm::vec3(x + 0.5f, y + 0.5f, 0));
458458
transformMatrix = glm::scale(transformMatrix, glm::vec3(m_YellowGlow->w * 0.5f, m_YellowGlow->h * 0.5f, 1.0));
459459
m_PostProcessShader->SetInt(m_PostProcessShader->GetTextureUniform(), 0);
460-
m_PostProcessShader->SetMatrix4f(m_PostProcessShader->GetProjectionUniform(), m_ProjectionMatrix);
460+
m_PostProcessShader->SetMatrix4f(m_PostProcessShader->GetProjectionUniform(), *m_ProjectionMatrix);
461461
m_PostProcessShader->SetMatrix4f(m_PostProcessShader->GetTransformUniform(), transformMatrix);
462462
GL_CHECK(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4));
463463
}
@@ -487,7 +487,7 @@ void PostProcessMan::DrawPostScreenEffects() {
487487
glBindVertexArray(m_VertexArray);
488488
m_PostProcessShader->Use();
489489
m_PostProcessShader->SetInt(m_PostProcessShader->GetTextureUniform(), 0);
490-
m_PostProcessShader->SetMatrix4f(m_PostProcessShader->GetProjectionUniform(), m_ProjectionMatrix);
490+
m_PostProcessShader->SetMatrix4f(m_PostProcessShader->GetProjectionUniform(), *m_ProjectionMatrix);
491491

492492
for (const PostEffect& postEffect: m_PostScreenEffects) {
493493
if (postEffect.m_Bitmap) {

Source/Managers/PostProcessMan.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
#include "Singleton.h"
44
#include "Box.h"
5-
#include "SceneMan.h"
65
#include "glad/gl.h"
7-
#include <glm/glm.hpp>
6+
#include "glm/fwd.hpp"
7+
#include "SceneMan.h"
88
#include "Shader.h"
99

1010
#include <array>
1111
#include <atomic>
12+
#include <memory>
1213
#include <list>
1314
#include <vector>
1415

@@ -184,7 +185,7 @@ namespace RTE {
184185
GLuint m_BlitFramebuffer; //!< Framebuffer for blitting the 8bpp backbuffer to the 32bpp backbuffer.
185186
GLuint m_PostProcessFramebuffer; //!< Framebuffer for post-processing effects.
186187
GLuint m_PostProcessDepthBuffer; //!< Depth buffer for post-processing effects.
187-
glm::mat4 m_ProjectionMatrix; //!< Projection matrix for post-processing effects.
188+
std::unique_ptr<glm::mat4> m_ProjectionMatrix; //!< Projection matrix for post-processing effects.
188189
GLuint m_VertexBuffer; //!< Vertex buffer for post-processing effects.
189190
GLuint m_VertexArray; //!< Vertex array for post-processing effects.
190191
std::unique_ptr<Shader> m_Blit8; //!< Shader for blitting the 8bpp backbuffer to the 32bpp backbuffer.

Source/Managers/WindowMan.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ void WindowMan::Clear() {
3737

3838
m_PrimaryWindow.reset();
3939
m_BackBuffer32Texture = 0;
40-
m_PrimaryWindowProjection = glm::mat4(1);
4140
m_ScreenVAO = 0;
4241
m_ScreenVBO = 0;
4342
ClearMultiDisplayData();

Source/Managers/WindowMan.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#include "Singleton.h"
4-
#include "System/Shader.h"
4+
#include "glm/fwd.hpp"
55
#include "glad/gl.h"
66

77
#include <memory>
@@ -191,7 +191,6 @@ namespace RTE {
191191
GLuint m_BackBuffer32Texture; //!< Streaming texture for the software rendered stuff.
192192
GLuint m_ScreenBufferTexture; //!< Internal backbuffer for the final blit and sceenshots, only clear immediately before drawing.
193193
GLuint m_ScreenBufferFBO; //!< Framebuffer object for the screen buffer texture.
194-
glm::mat4 m_PrimaryWindowProjection; //!< Projection Matrix for the main window.
195194
std::unique_ptr<SDL_Rect> m_PrimaryWindowViewport; //!< Viewport for the main window.
196195

197196
std::vector<std::shared_ptr<SDL_Window>> m_MultiDisplayWindows; //!< Additional windows for multi-display fullscreen.

Source/System/Shader.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "Shader.h"
22
#include "glad/gl.h"
3+
#include "glm/glm.hpp"
34
#include "glm/gtc/type_ptr.hpp"
45
#include "GLCheck.h"
56

Source/System/Shader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#include "Serializable.h"
4-
#include "glm/glm.hpp"
4+
#include "glm/fwd.hpp"
55

66
namespace RTE {
77
class Shader {

0 commit comments

Comments
 (0)