Some groundwork for cubemaps.

This commit is contained in:
Tleety
2016-02-23 16:00:43 +01:00
parent 4ffb03fdd5
commit 91b0ac5fbd
13 changed files with 126 additions and 14 deletions
+1 -1
Submodule assets updated: 1e7adc749e...ba8e04f12b
+26
View File
@@ -0,0 +1,26 @@
#ifndef CubeMapPass_h__
#define CubeMapPass_h__
#include "IRenderer.h"
#include "ShaderProgram.h"
class CubeMapPass
{
public:
CubeMapPass(IRenderer* renderer);
~CubeMapPass() { }
void LoadTextures();
void FillCubeMap(glm::vec3 originPosition);
void GenerateCubeMapTexture();
//GLuint CubeMapTexture() const { return m_CubeMapTexture; }
GLuint m_CubeMapTexture;
private:
IRenderer* m_Renderer;
std::vector<Texture*> m_CubeMapTestTextures;
};
#endif
+4 -1
View File
@@ -4,6 +4,7 @@
#include "IRenderer.h" #include "IRenderer.h"
#include "DrawFinalPassState.h" #include "DrawFinalPassState.h"
#include "LightCullingPass.h" #include "LightCullingPass.h"
#include "CubeMapPass.h"
#include "FrameBuffer.h" #include "FrameBuffer.h"
#include "ShaderProgram.h" #include "ShaderProgram.h"
#include "Util/UnorderedMapVec2.h" #include "Util/UnorderedMapVec2.h"
@@ -13,7 +14,7 @@
class DrawFinalPass class DrawFinalPass
{ {
public: public:
DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass); DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass);
~DrawFinalPass() { } ~DrawFinalPass() { }
void InitializeTextures(); void InitializeTextures();
void InitializeFrameBuffers(); void InitializeFrameBuffers();
@@ -62,12 +63,14 @@ private:
GLuint m_SceneTextureLowRes; GLuint m_SceneTextureLowRes;
GLuint m_DepthBuffer; GLuint m_DepthBuffer;
GLuint m_DepthBufferLowRes; GLuint m_DepthBufferLowRes;
GLuint m_CubeMapTexture;
//maqke this component based i guess? //maqke this component based i guess?
GLuint m_ShieldPixelRate = 16; GLuint m_ShieldPixelRate = 16;
const IRenderer* m_Renderer; const IRenderer* m_Renderer;
const LightCullingPass* m_LightCullingPass; const LightCullingPass* m_LightCullingPass;
const CubeMapPass* m_CubeMapPass;
ShaderProgram* m_ForwardPlusProgram; ShaderProgram* m_ForwardPlusProgram;
ShaderProgram* m_ExplosionEffectProgram; ShaderProgram* m_ExplosionEffectProgram;
+2
View File
@@ -17,6 +17,7 @@
#include "DrawBloomPass.h" #include "DrawBloomPass.h"
#include "DrawColorCorrectionPass.h" #include "DrawColorCorrectionPass.h"
#include "SSAOPass.h" #include "SSAOPass.h"
#include "CubeMapPass.h"
#include "../Core/EventBroker.h" #include "../Core/EventBroker.h"
#include "ImGuiRenderPass.h" #include "ImGuiRenderPass.h"
#include "Camera.h" #include "Camera.h"
@@ -74,6 +75,7 @@ private:
DrawBloomPass* m_DrawBloomPass; DrawBloomPass* m_DrawBloomPass;
DrawColorCorrectionPass* m_DrawColorCorrectionPass; DrawColorCorrectionPass* m_DrawColorCorrectionPass;
SSAOPass* m_SSAOPass; SSAOPass* m_SSAOPass;
CubeMapPass* m_CubeMapPass;
//----------------------Functions----------------------// //----------------------Functions----------------------//
void InitializeWindow(); void InitializeWindow();
+1
View File
@@ -18,6 +18,7 @@ public:
void Bind(GLenum textureUnit = GL_TEXTURE0); void Bind(GLenum textureUnit = GL_TEXTURE0);
GLuint m_Texture = 0; GLuint m_Texture = 0;
unsigned char* Data = nullptr;
}; };
+5 -1
View File
@@ -22,6 +22,7 @@ layout (binding = 1) uniform sampler2D DiffuseTexture;
layout (binding = 2) uniform sampler2D NormalMapTexture; layout (binding = 2) uniform sampler2D NormalMapTexture;
layout (binding = 3) uniform sampler2D SpecularMapTexture; layout (binding = 3) uniform sampler2D SpecularMapTexture;
layout (binding = 4) uniform sampler2D GlowMapTexture; layout (binding = 4) uniform sampler2D GlowMapTexture;
layout (binding = 5) uniform samplerCube CubeMap;
#define TILE_SIZE 16 #define TILE_SIZE 16
@@ -133,6 +134,8 @@ void main()
normal = normalize(normal); normal = normalize(normal);
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0)); //vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
vec4 viewVec = normalize(-position); vec4 viewVec = normalize(-position);
vec3 R = reflect(-viewVec.xyz, normal.xyz);
vec4 reflectionColor = texture(CubeMap, R);
vec2 tilePos; vec2 tilePos;
tilePos.x = int(gl_FragCoord.x/TILE_SIZE); tilePos.x = int(gl_FragCoord.x/TILE_SIZE);
@@ -171,7 +174,8 @@ void main()
if(pos <= FillPercentage) { if(pos <= FillPercentage) {
color_result += FillColor; color_result += FillColor;
} }
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1)); //sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
sceneColor = vec4(reflectionColor.xyz, 1);
color_result += glowTexel*GlowIntensity; color_result += glowTexel*GlowIntensity;
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), clamp(color_result.a, 0, 1)); bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), clamp(color_result.a, 0, 1));
+39
View File
@@ -0,0 +1,39 @@
#include "Rendering/CubeMapPass.h"
CubeMapPass::CubeMapPass(IRenderer* renderer)
:m_Renderer(renderer)
{
LoadTextures();
GenerateCubeMapTexture();
}
/*
*/
void CubeMapPass::LoadTextures()
{
for (int i = 0; i < 6; i++){
std::string str;
str = "Textures/Test/CubeMap/CubeMapTest0" + std::to_string(i) + ".png";
Texture* img = ResourceManager::Load<Texture>(str);
m_CubeMapTestTextures.push_back(img);
}
}
void CubeMapPass::GenerateCubeMapTexture()
{
glGenTextures(1, &m_CubeMapTexture);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapTexture);
for (int i = 0; i < 6; i++) {
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA32F, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_CubeMapTestTextures[i]->Data);
}
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
GLERROR("Generate Cubemap");
}
+2
View File
@@ -52,6 +52,7 @@ void DrawBloomPass::InitializeBuffers()
void DrawBloomPass::ClearBuffer() void DrawBloomPass::ClearBuffer()
{ {
GLERROR("PRE");
m_GaussianFrameBuffer_horiz.Bind(); m_GaussianFrameBuffer_horiz.Bind();
glClearColor(0.f, 0.f, 0.f, 0.f); glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -60,6 +61,7 @@ void DrawBloomPass::ClearBuffer()
glClearColor(0.f, 0.f, 0.f, 0.f); glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_GaussianFrameBuffer_vert.Unbind(); m_GaussianFrameBuffer_vert.Unbind();
GLERROR("END");
} }
void DrawBloomPass::Draw(GLuint texture) void DrawBloomPass::Draw(GLuint texture)
+30 -3
View File
@@ -1,10 +1,11 @@
#include "Rendering/DrawFinalPass.h" #include "Rendering/DrawFinalPass.h"
DrawFinalPass::DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass) DrawFinalPass::DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass)
: m_Renderer(renderer)
, m_LightCullingPass(lightCullingPass)
, m_CubeMapPass(cubeMapPass)
{ {
//TODO: Make sure that uniforms are not sent into shader if not needed. //TODO: Make sure that uniforms are not sent into shader if not needed.
m_Renderer = renderer;
m_LightCullingPass = lightCullingPass;
m_ShieldPixelRate = 8; m_ShieldPixelRate = 8;
InitializeTextures(); InitializeTextures();
InitializeShaderPrograms(); InitializeShaderPrograms();
@@ -261,20 +262,35 @@ void DrawFinalPass::Draw(RenderScene& scene, GLuint SSAOTexture)
void DrawFinalPass::ClearBuffer() void DrawFinalPass::ClearBuffer()
{ {
GLERROR("PRE");
m_FinalPassFrameBufferLowRes.Bind(); m_FinalPassFrameBufferLowRes.Bind();
GLERROR("Bind LowRes");
glViewport(0, 0, m_Renderer->GetViewportSize().Width/m_ShieldPixelRate, m_Renderer->GetViewportSize().Height/m_ShieldPixelRate); glViewport(0, 0, m_Renderer->GetViewportSize().Width/m_ShieldPixelRate, m_Renderer->GetViewportSize().Height/m_ShieldPixelRate);
glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
GLERROR("ViewPort,Scissor LowRes");
glClearColor(0.f, 0.f, 0.f, 0.f); glClearColor(0.f, 0.f, 0.f, 0.f);
GLERROR("1");
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
GLERROR("2");
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
GLERROR("3");
m_FinalPassFrameBufferLowRes.Unbind(); m_FinalPassFrameBufferLowRes.Unbind();
GLERROR("prebind HighRes");
m_FinalPassFrameBuffer.Bind(); m_FinalPassFrameBuffer.Bind();
GLERROR("Bind HighRes");
glViewport(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); glViewport(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
GLERROR("ViewPort,Scissor LowRes");
glClearColor(0.f, 0.f, 0.f, 0.f); glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_FinalPassFrameBuffer.Unbind(); m_FinalPassFrameBuffer.Unbind();
GLERROR("END");
} }
@@ -358,12 +374,15 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
case RawModel::MaterialType::SingleTextures: case RawModel::MaterialType::SingleTextures:
{ {
if (explosionEffectJob->Model->IsSkinned()) { if (explosionEffectJob->Model->IsSkinned()) {
m_ExplosionEffectSkinnedProgram->Bind(); m_ExplosionEffectSkinnedProgram->Bind();
GLERROR("Bind ExplosionEffectSkinned program"); GLERROR("Bind ExplosionEffectSkinned program");
//bind uniforms //bind uniforms
BindExplosionUniforms(explosionSkinnedHandle, explosionEffectJob, scene); BindExplosionUniforms(explosionSkinnedHandle, explosionEffectJob, scene);
//bind textures //bind textures
BindExplosionTextures(explosionSkinnedHandle, explosionEffectJob); BindExplosionTextures(explosionSkinnedHandle, explosionEffectJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
std::vector<glm::mat4> frameBones; std::vector<glm::mat4> frameBones;
if (explosionEffectJob->AnimationOffset.animation != nullptr) { if (explosionEffectJob->AnimationOffset.animation != nullptr) {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset); frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
@@ -378,6 +397,8 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
BindExplosionUniforms(explosionHandle, explosionEffectJob, scene); BindExplosionUniforms(explosionHandle, explosionEffectJob, scene);
//bind textures //bind textures
BindExplosionTextures(explosionHandle, explosionEffectJob); BindExplosionTextures(explosionHandle, explosionEffectJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
} }
break; break;
} }
@@ -436,6 +457,8 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
BindModelUniforms(forwardSkinnedHandle, modelJob, scene); BindModelUniforms(forwardSkinnedHandle, modelJob, scene);
//bind textures //bind textures
BindModelTextures(forwardSkinnedHandle, modelJob); BindModelTextures(forwardSkinnedHandle, modelJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
std::vector<glm::mat4> frameBones; std::vector<glm::mat4> frameBones;
if (modelJob->AnimationOffset.animation != nullptr) { if (modelJob->AnimationOffset.animation != nullptr) {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
@@ -451,6 +474,8 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
BindModelUniforms(forwardHandle, modelJob, scene); BindModelUniforms(forwardHandle, modelJob, scene);
//bind textures //bind textures
BindModelTextures(forwardHandle, modelJob); BindModelTextures(forwardHandle, modelJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
} }
break; break;
} }
@@ -809,6 +834,8 @@ void DrawFinalPass::BindModelUniforms(GLuint shaderHandle, std::shared_ptr<Model
void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job) void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job)
{ {
switch (job->Type) { switch (job->Type) {
case RawModel::MaterialType::SingleTextures: case RawModel::MaterialType::SingleTextures:
case RawModel::MaterialType::Basic: case RawModel::MaterialType::Basic:
+3
View File
@@ -64,6 +64,7 @@ void PickingPass::InitializeShaderPrograms()
void PickingPass::Draw(RenderScene& scene) void PickingPass::Draw(RenderScene& scene)
{ {
GLERROR("PRE");
PickingPassState* state = new PickingPassState(m_PickingBuffer.GetHandle()); PickingPassState* state = new PickingPassState(m_PickingBuffer.GetHandle());
//TODO: Render: Add code for more jobs than modeljobs. //TODO: Render: Add code for more jobs than modeljobs.
@@ -367,6 +368,7 @@ void PickingPass::Draw(RenderScene& scene)
void PickingPass::ClearPicking() void PickingPass::ClearPicking()
{ {
GLERROR("PRE");
m_PickingColorsToEntity.clear(); m_PickingColorsToEntity.clear();
m_EntityColors.clear(); m_EntityColors.clear();
m_ColorCounter[0] = 0; m_ColorCounter[0] = 0;
@@ -376,6 +378,7 @@ void PickingPass::ClearPicking()
glClearColor(0.f, 0.f, 0.f, 0.f); glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_PickingBuffer.Unbind(); m_PickingBuffer.Unbind();
GLERROR("END");
} }
+3 -2
View File
@@ -3,9 +3,9 @@
PickingPassState::PickingPassState(GLuint frameBuffer) PickingPassState::PickingPassState(GLuint frameBuffer)
{ {
GLERROR("---2"); GLERROR("PRE");
BindFramebuffer(frameBuffer); BindFramebuffer(frameBuffer);
GLERROR("---3"); GLERROR("Bind Framebuffer");
Enable(GL_DEPTH_TEST); Enable(GL_DEPTH_TEST);
Enable(GL_CULL_FACE); Enable(GL_CULL_FACE);
Disable(GL_BLEND); Disable(GL_BLEND);
@@ -13,6 +13,7 @@ PickingPassState::PickingPassState(GLuint frameBuffer)
glm::vec4 clearColor = glm::vec4(0.f); glm::vec4 clearColor = glm::vec4(0.f);
//ClearColor(clearColor); //ClearColor(clearColor);
//Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
GLERROR("END");
} }
PickingPassState::~PickingPassState() PickingPassState::~PickingPassState()
+7 -5
View File
@@ -30,6 +30,7 @@ void Renderer::glfwFrameBufferCallback(GLFWwindow* window, int width, int height
currentRenderer->m_LightCullingPass->OnWindowResize(); currentRenderer->m_LightCullingPass->OnWindowResize();
currentRenderer->m_PickingPass->OnWindowResize(); currentRenderer->m_PickingPass->OnWindowResize();
currentRenderer->m_DrawBloomPass->OnWindowResize(); currentRenderer->m_DrawBloomPass->OnWindowResize();
//TODO: CubeMapPass->OnWindowResize //If needed
} }
void Renderer::InitializeWindow() void Renderer::InitializeWindow()
@@ -88,9 +89,6 @@ void Renderer::InitializeShaders()
//m_ExplosionEffectProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ExplosionEffect.frag.glsl"))); //m_ExplosionEffectProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ExplosionEffect.frag.glsl")));
//m_ExplosionEffectProgram->Compile(); //m_ExplosionEffectProgram->Compile();
//m_ExplosionEffectProgram->Link(); //m_ExplosionEffectProgram->Link();
} }
void Renderer::InputUpdate(double dt) void Renderer::InputUpdate(double dt)
@@ -108,6 +106,7 @@ void Renderer::Update(double dt)
void Renderer::Draw(RenderFrame& frame) void Renderer::Draw(RenderFrame& frame)
{ {
GLERROR("PRE");
ImGui::Combo("Draw textures", &m_DebugTextureToDraw, "Final\0Scene\0Bloom\0SceneLowRes\0BloomLowRes\0Gaussian\0Picking\0Ambient Occlusion"); ImGui::Combo("Draw textures", &m_DebugTextureToDraw, "Final\0Scene\0Bloom\0SceneLowRes\0BloomLowRes\0Gaussian\0Picking\0Ambient Occlusion");
ImGui::SliderFloat("SSAO sample radius", &m_SSAO_Radius, 0.01f, 5.0f); ImGui::SliderFloat("SSAO sample radius", &m_SSAO_Radius, 0.01f, 5.0f);
@@ -117,6 +116,7 @@ void Renderer::Draw(RenderFrame& frame)
ImGui::SliderInt("SSAO Number of Samples", &m_SSAO_NumOfSamples, 2, 100); ImGui::SliderInt("SSAO Number of Samples", &m_SSAO_NumOfSamples, 2, 100);
ImGui::SliderInt("SSAO Number of Turns", &m_SSAO_NumOfTurns, 0, 50); ImGui::SliderInt("SSAO Number of Turns", &m_SSAO_NumOfTurns, 0, 50);
m_SSAOPass->Setting(m_SSAO_Radius, m_SSAO_Bias, m_SSAO_Contrast, m_SSAO_IntensityScale, m_SSAO_NumOfSamples, m_SSAO_NumOfTurns); m_SSAOPass->Setting(m_SSAO_Radius, m_SSAO_Bias, m_SSAO_Contrast, m_SSAO_IntensityScale, m_SSAO_NumOfSamples, m_SSAO_NumOfTurns);
GLERROR("SSAO Settings");
//clear buffer 0 //clear buffer 0
glClearColor(0.f, 0.f, 0.f, 0.f); glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -127,6 +127,7 @@ void Renderer::Draw(RenderFrame& frame)
m_DrawFinalPass->ClearBuffer(); m_DrawFinalPass->ClearBuffer();
m_DrawBloomPass->ClearBuffer(); m_DrawBloomPass->ClearBuffer();
PerformanceTimer::StopTimer("Renderer-ClearBuffers"); PerformanceTimer::StopTimer("Renderer-ClearBuffers");
GLERROR("ClearBuffers");
for (auto scene : frame.RenderScenes) { for (auto scene : frame.RenderScenes) {
PerformanceTimer::StartTimer("Renderer-Depth"); PerformanceTimer::StartTimer("Renderer-Depth");
m_PickingPass->Draw(*scene); m_PickingPass->Draw(*scene);
@@ -239,9 +240,10 @@ void Renderer::InitializeRenderPasses()
{ {
m_PickingPass = new PickingPass(this, m_EventBroker); m_PickingPass = new PickingPass(this, m_EventBroker);
m_LightCullingPass = new LightCullingPass(this); m_LightCullingPass = new LightCullingPass(this);
m_DrawFinalPass = new DrawFinalPass(this, m_LightCullingPass); m_CubeMapPass = new CubeMapPass(this);
m_DrawFinalPass = new DrawFinalPass(this, m_LightCullingPass, m_CubeMapPass);
m_DrawScreenQuadPass = new DrawScreenQuadPass(this); m_DrawScreenQuadPass = new DrawScreenQuadPass(this);
m_DrawBloomPass = new DrawBloomPass(this); m_DrawBloomPass = new DrawBloomPass(this);
m_DrawColorCorrectionPass = new DrawColorCorrectionPass(this); m_DrawColorCorrectionPass = new DrawColorCorrectionPass(this);
m_SSAOPass = new SSAOPass(this); m_SSAOPass = new SSAOPass(this);
} }
+2
View File
@@ -18,6 +18,7 @@ Texture::Texture(std::string path)
this->Width = img->Width; this->Width = img->Width;
this->Height = img->Height; this->Height = img->Height;
this->Data = img->Data;
GLint format; GLint format;
switch (img->Format) { switch (img->Format) {
@@ -29,6 +30,7 @@ Texture::Texture(std::string path)
break; break;
} }
// Construct the OpenGL texture // Construct the OpenGL texture
glGenTextures(1, &m_Texture); glGenTextures(1, &m_Texture);
glBindTexture(GL_TEXTURE_2D, m_Texture); glBindTexture(GL_TEXTURE_2D, m_Texture);