Merge pull request #121 from teamfisk/ResolutionChange

Resolution change
This commit is contained in:
2016-02-19 13:31:06 +01:00
14 changed files with 187 additions and 49 deletions
+1
View File
@@ -6,6 +6,7 @@
#include "../Core/ResourceManager.h"
#include "../Core/Event.h"
#include "EButtonClicked.h"
#include "EButtonPressed.h"
#include "EButtonReleased.h"
+2
View File
@@ -24,6 +24,8 @@ public:
void Draw(GLuint texture);
void OnWindowResize();
//Getters
//Return the blurred result of the texture that was sent into draw
GLuint GaussianTexture() const { return m_GaussianTexture_vert; }
+1 -1
View File
@@ -20,6 +20,7 @@ public:
void InitializeShaderPrograms();
void Draw(RenderScene& scene);
void ClearBuffer();
void OnWindowResize();
//Return the texture that is used in later stages to apply the bloom effect
GLuint BloomTexture() const { return m_BloomTexture; }
@@ -31,7 +32,6 @@ public:
FrameBuffer* FinalPassFrameBuffer() { return &m_FinalPassFrameBuffer; }
FrameBuffer* FinalPassFrameBufferLowRes() { return &m_FinalPassFrameBufferLowRes; }
private:
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
void GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps) const;
@@ -21,6 +21,7 @@ public:
void SetSSBOSizes();
void CullLights(RenderScene& scene);
void FillLightList(RenderScene& scene);
void OnWindowResize();
GLuint FrustumSSBO() const { return m_FrustumSSBO; }
GLuint LightSSBO() const { return m_LightSSBO; }
+2
View File
@@ -22,6 +22,8 @@ public:
void Draw(RenderScene& scene);
void ClearPicking();
void OnWindowResize();
//Getters
const ShaderProgram& PickingProgram() const { return *m_PickingProgram; }
//const std::unordered_map<glm::ivec2, EntityID>& PickingColorsToEntity() const { return m_PickingColorsToEntity; }
+7
View File
@@ -27,6 +27,8 @@
class Renderer : public IRenderer
{
static void glfwFrameBufferCallback(GLFWwindow* window, int width, int height);
public:
Renderer(EventBroker* eventBroker)
: m_EventBroker(eventBroker)
@@ -38,8 +40,12 @@ public:
virtual PickData Pick(glm::vec2 screenCoord) override;
private:
//----------------------Variables----------------------//
static std::unordered_map <GLFWwindow*, Renderer*> m_WindowToRenderer;
EventBroker* m_EventBroker;
TextPass* m_TextPass;
@@ -51,6 +57,7 @@ private:
Model* m_UnitSphere;
int m_DebugTextureToDraw = 0;
bool m_ResizeWindow = false;
PickingPass* m_PickingPass;
LightCullingPass* m_LightCullingPass;
+70 -42
View File
@@ -40,7 +40,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="8047.93604" Z="0"/>
<Orientation X="0" Y="8433.37305" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -77,18 +77,6 @@
</Entity>
</Children>
</Entity>
<Entity name="ListenerText">
<Components>
<c:Text>
<Content>Sound Test</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
</c:Text>
<c:Transform>
<Orientation X="0" Y="3.31600022" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="DirectionalLight">
@@ -105,7 +93,7 @@
</c:RaptorCopter>
<c:Transform>
<Position X="2.1529963" Y="6.59221172" Z="0.169116676"/>
<Orientation X="4.16300011" Y="17884.6152" Z="0"/>
<Orientation X="4.16300011" Y="18271.9141" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -180,7 +168,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="2360.87744" Z="0"/>
<Orientation X="0" Y="2553.63574" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -225,7 +213,7 @@
<Axis X="1" Y="1" Z="1"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="16475.0957" Y="16475.0957" Z="16475.0957"/>
<Orientation X="16862.3945" Y="16862.3945" Z="16862.3945"/>
</c:Transform>
</Components>
<Children>
@@ -289,7 +277,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="16272.0654" Z="0"/>
<Orientation X="0" Y="16658.3906" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -321,7 +309,7 @@
<Axis X="0.699999988" Y="1" Z="0.300000012"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="11936.1904" Y="16998.502" Z="5086.18848"/>
<Orientation X="12206.665" Y="17385.8008" Z="5202.3335"/>
</c:Transform>
</Components>
<Children>
@@ -671,7 +659,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="658.550842" Z="0"/>
<Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -718,7 +706,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="658.550842" Z="0"/>
<Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -778,7 +766,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="658.550842" Z="0"/>
<Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -825,7 +813,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="658.550842" Z="0"/>
<Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -871,7 +859,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="658.550842" Z="0"/>
<Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -918,7 +906,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="658.550842" Z="0"/>
<Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -965,7 +953,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="658.550842" Z="0"/>
<Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -1379,7 +1367,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="1192.24976" Z="0"/>
<Orientation X="0" Y="1385.11243" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -1388,7 +1376,7 @@
<c:ExplosionEffect>
<ColorByDistance>true</ColorByDistance>
<Velocity X="0.800000012" Y="0.0379999988" Z="0"/>
<TimeSinceDeath>2.5333333077342104</TimeSinceDeath>
<TimeSinceDeath>0.8256214817261025</TimeSinceDeath>
<ExplosionDuration>3.7999999523162842</ExplosionDuration>
<EndColor A="0" B="23.5294113" G="11.7647057" R="0"/>
<Randomness>true</Randomness>
@@ -1435,7 +1423,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="1192.24976" Z="0"/>
<Orientation X="0" Y="1385.11243" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -1444,7 +1432,7 @@
<c:ExplosionEffect>
<Velocity X="0.5" Y="1" Z="0"/>
<ExplosionOrigin X="0" Y="0.900000036" Z="0"/>
<TimeSinceDeath>0.70455028055985736</TimeSinceDeath>
<TimeSinceDeath>1.8641349174045843</TimeSinceDeath>
</c:ExplosionEffect>
<c:Model>
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
@@ -1487,7 +1475,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="1192.24976" Z="0"/>
<Orientation X="0" Y="1385.11243" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -1498,7 +1486,7 @@
<ColorByDistance>true</ColorByDistance>
<Velocity X="0.300000012" Y="2" Z="0"/>
<ExplosionOrigin X="0" Y="1.30000007" Z="-0.200000003"/>
<TimeSinceDeath>0.70455028055985736</TimeSinceDeath>
<TimeSinceDeath>1.8641349174045843</TimeSinceDeath>
<EndColor A="0" B="0.333333343" G="0.933333337" R="3.92156863"/>
<Randomness>true</Randomness>
</c:ExplosionEffect>
@@ -1543,7 +1531,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="1200.02991" Z="0"/>
<Orientation X="0" Y="1392.89258" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -1553,7 +1541,7 @@
<ColorByDistance>true</ColorByDistance>
<Velocity X="0" Y="0.699999988" Z="0"/>
<ExplosionOrigin X="0" Y="-1.10000002" Z="0"/>
<TimeSinceDeath>9.1832418997049956</TimeSinceDeath>
<TimeSinceDeath>1.2301962937648341</TimeSinceDeath>
<ExplosionDuration>10</ExplosionDuration>
<EndColor A="1" B="0" G="0" R="1"/>
<RandomnessScalar>3</RandomnessScalar>
@@ -1601,7 +1589,7 @@
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform>
<Orientation X="0" Y="798.171265" Z="0"/>
<Orientation X="0" Y="991.007263" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -1611,7 +1599,7 @@
<ColorByDistance>true</ColorByDistance>
<Velocity X="6" Y="0.100000001" Z="0"/>
<ExplosionOrigin X="0" Y="-10" Z="0"/>
<TimeSinceDeath>1.007708532606415</TimeSinceDeath>
<TimeSinceDeath>3.4214855659573402</TimeSinceDeath>
<ExponentialAccelaration>true</ExponentialAccelaration>
<ExplosionDuration>5</ExplosionDuration>
<Randomness>true</Randomness>
@@ -1792,7 +1780,7 @@
<c:ExplosionEffect>
<ColorByDistance>true</ColorByDistance>
<Velocity X="0.800000012" Y="0.0379999988" Z="0"/>
<TimeSinceDeath>2.5333333077342104</TimeSinceDeath>
<TimeSinceDeath>0.8256214817261025</TimeSinceDeath>
<ExplosionDuration>3.7999999523162842</ExplosionDuration>
<EndColor A="0" B="23.5294113" G="11.7647057" R="0"/>
<Randomness>true</Randomness>
@@ -2349,7 +2337,7 @@
</c:Transform>
</Components>
<Children>
<Entity name="1">
<Entity name="Res1080">
<Components>
<c:Button/>
<c:Sprite>
@@ -2364,7 +2352,7 @@
<Entity name="Text">
<Components>
<c:Text>
<Content>Resolution</Content>
<Content>1920x1080</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="1" G="0.847058833" R="0"/>
</c:Text>
@@ -2377,7 +2365,7 @@
</Entity>
</Children>
</Entity>
<Entity name="2">
<Entity name="Res720">
<Components>
<c:Button/>
<c:Sprite>
@@ -2392,7 +2380,7 @@
<Entity name="Text">
<Components>
<c:Text>
<Content>Option2</Content>
<Content>1280x720</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="1" G="0.847058833" R="0"/>
</c:Text>
@@ -2405,7 +2393,7 @@
</Entity>
</Children>
</Entity>
<Entity name="3">
<Entity name="Res480">
<Components>
<c:Button/>
<c:Sprite>
@@ -2420,7 +2408,35 @@
<Entity name="Text">
<Components>
<c:Text>
<Content>Butts</Content>
<Content>854x480</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="1" G="0.847058833" R="0"/>
</c:Text>
<c:Transform>
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="FullScreen">
<Components>
<c:Button/>
<c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
</c:Sprite>
<c:Transform>
<Position X="0" Y="-0.164955258" Z="0.0627754927"/>
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
</c:Transform>
</Components>
<Children>
<Entity name="Text">
<Components>
<c:Text>
<Content>FullScreen</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="1" G="0.847058833" R="0"/>
</c:Text>
@@ -2454,6 +2470,18 @@
</Entity>
</Children>
</Entity>
<Entity name="ListenerText">
<Components>
<c:Text>
<Content>Sound Test</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
</c:Text>
<c:Transform>
<Orientation X="0" Y="3.31600022" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+13
View File
@@ -25,6 +25,19 @@ bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e)
//Run host code
} else if(e.EntityName == "Quit") {
printf("No, you stay");
} else if (e.EntityName == "Res1080") {
glfwSetWindowSize(m_Renderer->Window(), 1920, 1080);
printf("\n1080");
} else if (e.EntityName == "Res720") {
glfwSetWindowSize(m_Renderer->Window(), 1280, 720);
glViewport(0, 0, 1280, 720);
printf("\n720");
} else if (e.EntityName == "Res480") {
glfwSetWindowSize(m_Renderer->Window(), 854, 480);
glViewport(0, 0, 854, 480);
printf("\n480");
} else if (e.EntityName == "FullScreen") {
printf("No fullscreen for now");
}
return true;
+9
View File
@@ -121,6 +121,15 @@ void DrawBloomPass::Draw(GLuint texture)
GLERROR("DrawBloomPass::Draw: END");
}
void DrawBloomPass::OnWindowRezise()
{
GenerateTexture(&m_GaussianTexture_vert, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
m_GaussianFrameBuffer_vert.Generate();
GenerateTexture(&m_GaussianTexture_horiz, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
m_GaussianFrameBuffer_horiz.Generate();
}
void DrawBloomPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const
{
glGenTextures(1, texture);
+23 -2
View File
@@ -274,6 +274,27 @@ void DrawFinalPass::ClearBuffer()
m_FinalPassFrameBuffer.Unbind();
}
void DrawFinalPass::OnWindowResize()
{
//InitializeFrameBuffers();
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
GenerateTexture(&m_SceneTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
GenerateTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
m_FinalPassFrameBuffer.Generate();
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBufferLowRes);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, (int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate));
GenerateTexture(&m_SceneTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), GL_RGB16F, GL_RGB, GL_FLOAT);
GenerateTexture(&m_BloomTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), GL_RGB16F, GL_RGB, GL_FLOAT);
m_FinalPassFrameBufferLowRes.Generate();
GLERROR("Error changing texture resolutions");
}
void DrawFinalPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const
{
glGenTextures(1, texture);
@@ -702,7 +723,7 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<E
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
GLERROR("Bind 4 uniform");
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->Resolution().Width, m_Renderer->Resolution().Height);
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
GLERROR("Bind 5 uniform");
glUniform3fv(glGetUniformLocation(shaderHandle, "ExplosionOrigin"), 1, glm::value_ptr(job->ExplosionOrigin));
@@ -754,7 +775,7 @@ void DrawFinalPass::BindModelUniforms(GLuint shaderHandle, std::shared_ptr<Model
GLERROR("Bind 4 uniform");
GLint Location_ScreenDimensions = glGetUniformLocation(shaderHandle, "ScreenDimensions");
glUniform2f(Location_ScreenDimensions, m_Renderer->Resolution().Width, m_Renderer->Resolution().Height);
glUniform2f(Location_ScreenDimensions, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
GLERROR("Bind 5 uniform");
GLint Location_FillPercentage = glGetUniformLocation(shaderHandle, "FillPercentage");
+2 -2
View File
@@ -72,8 +72,8 @@ void FrameBuffer::Generate()
GLenum* bufferTextures = &attachments[0];
glDrawBuffers(attachments.size(), bufferTextures);
if(GLERROR("4")) {
printf("hello");
if (GLERROR("GLBufferAttachement error")) {
printf(": AttachmentSize %i", attachments.size());
}
if (GLenum frameBufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
+28
View File
@@ -110,6 +110,34 @@ void LightCullingPass::FillLightList(RenderScene& scene)
}
}
void LightCullingPass::OnWindowResize()
{
SetSSBOSizes();
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_FrustumSSBO);
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(Frustum)*m_NumberOfTiles, nullptr, GL_DYNAMIC_COPY);
GLERROR("m_FrustumSSBO");
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightSSBO);
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(LightSource) * 200, nullptr, GL_DYNAMIC_COPY);
GLERROR("m_LightSSBO");
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightGridSSBO);
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(LightGrid)*m_NumberOfTiles, nullptr, GL_DYNAMIC_COPY);
GLERROR("m_LightGridSSBO");
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightOffsetSSBO);
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(m_LightOffset), &m_LightOffset, GL_DYNAMIC_COPY);
GLERROR("m_LightOffsetSSBO");
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightIndexSSBO);
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(float)*m_NumberOfTiles*MAX_LIGHTS_PER_TILE, m_LightIndex, GL_DYNAMIC_COPY);
GLERROR("m_LightIndexSSBO");
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
}
void LightCullingPass::InitializeSSBOs()
{
glGenBuffers(1, &m_FrustumSSBO);
+11
View File
@@ -15,6 +15,8 @@ PickingPass::~PickingPass()
}
void PickingPass::InitializeTextures()
{
GenerateTexture(&m_PickingTexture, GL_CLAMP_TO_BORDER, GL_LINEAR,
@@ -365,6 +367,15 @@ void PickingPass::ClearPicking()
m_PickingBuffer.Unbind();
}
void PickingPass::OnWindowResize()
{
InitializeTextures();
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
m_PickingBuffer.Generate();
}
PickData PickingPass::Pick(glm::vec2 screenCoord)
{
int fbWidth;
+17 -2
View File
@@ -1,5 +1,7 @@
#include "Rendering/Renderer.h"
std::unordered_map<GLFWwindow*, Renderer*> Renderer::m_WindowToRenderer;
void Renderer::Initialize()
{
InitializeWindow();
@@ -12,7 +14,6 @@ void Renderer::Initialize()
m_TextPass = new TextPass();
m_TextPass->Initialize();
/* m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.obj");
m_UnitQuad = ResourceManager::Load<Model>("Models/Core/UnitQuad.obj");
m_UnitSphere = ResourceManager::Load<Model>("Models/Core/UnitSphere.obj");*/
@@ -20,6 +21,17 @@ void Renderer::Initialize()
m_ImGuiRenderPass = new ImGuiRenderPass(this, m_EventBroker);
}
void Renderer::glfwFrameBufferCallback(GLFWwindow* window, int width, int height)
{
glViewport(0, 0, width, height);
Renderer* currentRenderer = m_WindowToRenderer[window];
currentRenderer->m_ViewportSize = Rectangle(width, height);
currentRenderer->m_DrawFinalPass->OnWindowResize();
currentRenderer->m_LightCullingPass->OnWindowResize();
currentRenderer->m_PickingPass->OnWindowResize();
currentRenderer->m_DrawBloomPass->OnWindowRezise();
}
void Renderer::InitializeWindow()
{
// Initialize GLFW
@@ -39,6 +51,7 @@ void Renderer::InitializeWindow()
LOG_ERROR("GLFW: Failed to create window");
exit(EXIT_FAILURE);
}
glfwSetFramebufferSizeCallback(m_Window, &glfwFrameBufferCallback);
glfwMakeContextCurrent(m_Window);
// GL version info
@@ -59,8 +72,10 @@ void Renderer::InitializeWindow()
exit(EXIT_FAILURE);
}
m_WindowToRenderer[m_Window] = this;
int windowSize[2];
glfwGetWindowSize(m_Window, &windowSize[0], &windowSize[1]);
glfwGetFramebufferSize(m_Window, &windowSize[0], &windowSize[1]);
m_ViewportSize = Rectangle(windowSize[0], windowSize[1]);
}