Removed DrawScenePass, since it doesn't seem to be used
This commit is contained in:
@@ -1,42 +0,0 @@
|
|||||||
#ifndef DrawScenePass_h__
|
|
||||||
#define DrawScenePass_h__
|
|
||||||
|
|
||||||
#include "IRenderer.h"
|
|
||||||
#include "DrawScenePassState.h"
|
|
||||||
#include "FrameBuffer.h"
|
|
||||||
#include "ShaderProgram.h"
|
|
||||||
#include "Util/UnorderedMapVec2.h"
|
|
||||||
#include "Texture.h"
|
|
||||||
|
|
||||||
class DrawScenePass
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DrawScenePass(IRenderer* renderer);
|
|
||||||
~DrawScenePass() { }
|
|
||||||
void InitializeTextures();
|
|
||||||
void InitializeFrameBuffers();
|
|
||||||
void InitializeShaderPrograms();
|
|
||||||
|
|
||||||
void Draw(RenderScene& scene);
|
|
||||||
|
|
||||||
//Getters
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
|
|
||||||
|
|
||||||
static bool DepthSort(const std::shared_ptr<RenderJob> &i, const std::shared_ptr<RenderJob> &j)
|
|
||||||
{
|
|
||||||
return (i->Depth < j->Depth);
|
|
||||||
};
|
|
||||||
|
|
||||||
Texture* m_WhiteTexture;
|
|
||||||
|
|
||||||
const IRenderer* m_Renderer;
|
|
||||||
|
|
||||||
ShaderProgram* m_BasicForwardProgram;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#ifndef DrawScenePassState_h__
|
|
||||||
#define DrawScenePassState_h__
|
|
||||||
|
|
||||||
#include "Rendering/RenderState.h"
|
|
||||||
|
|
||||||
class DrawScenePassState : public RenderState
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DrawScenePassState();
|
|
||||||
~DrawScenePassState();
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "FrameBuffer.h"
|
#include "FrameBuffer.h"
|
||||||
#include "../Core/World.h"
|
#include "../Core/World.h"
|
||||||
#include "PickingPass.h"
|
#include "PickingPass.h"
|
||||||
#include "DrawScenePass.h"
|
|
||||||
#include "LightCullingPass.h"
|
#include "LightCullingPass.h"
|
||||||
#include "DrawFinalPass.h"
|
#include "DrawFinalPass.h"
|
||||||
#include "../Core/EventBroker.h"
|
#include "../Core/EventBroker.h"
|
||||||
@@ -45,7 +44,6 @@ private:
|
|||||||
Model* m_UnitQuad;
|
Model* m_UnitQuad;
|
||||||
Model* m_UnitSphere;
|
Model* m_UnitSphere;
|
||||||
|
|
||||||
DrawScenePass* m_DrawScenePass;
|
|
||||||
PickingPass* m_PickingPass;
|
PickingPass* m_PickingPass;
|
||||||
LightCullingPass* m_LightCullingPass;
|
LightCullingPass* m_LightCullingPass;
|
||||||
ImGuiRenderPass* m_ImGuiRenderPass;
|
ImGuiRenderPass* m_ImGuiRenderPass;
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
#include "Rendering/DrawScenePass.h"
|
|
||||||
|
|
||||||
DrawScenePass::DrawScenePass(IRenderer* renderer)
|
|
||||||
{
|
|
||||||
m_Renderer = renderer;
|
|
||||||
InitializeTextures();
|
|
||||||
InitializeShaderPrograms();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawScenePass::InitializeTextures()
|
|
||||||
{
|
|
||||||
m_WhiteTexture = ResourceManager::Load<Texture>("Textures/Core/Blank.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawScenePass::InitializeShaderPrograms()
|
|
||||||
{
|
|
||||||
m_BasicForwardProgram = ResourceManager::Load<ShaderProgram>("#BasicForwardProgram");
|
|
||||||
|
|
||||||
m_BasicForwardProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/BasicForward.vert.glsl")));
|
|
||||||
m_BasicForwardProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/BasicForward.frag.glsl")));
|
|
||||||
m_BasicForwardProgram->Compile();
|
|
||||||
m_BasicForwardProgram->Link();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawScenePass::Draw(RenderScene& scene)
|
|
||||||
{
|
|
||||||
//glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
|
||||||
GLERROR("DrawScenePass::Draw: Pre");
|
|
||||||
|
|
||||||
DrawScenePassState state = DrawScenePassState();
|
|
||||||
m_BasicForwardProgram->Bind();
|
|
||||||
|
|
||||||
for (auto &job : scene.ForwardJobs) {
|
|
||||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
|
||||||
if (modelJob) {
|
|
||||||
GLuint ShaderHandle = m_BasicForwardProgram->GetHandle();
|
|
||||||
|
|
||||||
//TODO: Kolla upp "header/include/common" shader saken så man slipper skicka in asmycket uniforms
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(ShaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(ShaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(ShaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
|
||||||
glUniform4fv(glGetUniformLocation(ShaderHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
|
||||||
|
|
||||||
//TODO: Renderer: bättre textur felhantering samt fler texturer stöd
|
|
||||||
if (modelJob->DiffuseTexture != nullptr) {
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture->m_Texture);
|
|
||||||
} else {
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
glBindVertexArray(modelJob->Model->VAO);
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
|
||||||
glDrawElementsBaseVertex(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, 0, modelJob->StartIndex);
|
|
||||||
|
|
||||||
//continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
GLERROR("DrawScenePass::Draw: End");
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#include "Rendering/DrawScenePassState.h"
|
|
||||||
|
|
||||||
|
|
||||||
DrawScenePassState::DrawScenePassState()
|
|
||||||
{
|
|
||||||
GLERROR("---");
|
|
||||||
BindFramebuffer(0);
|
|
||||||
GLERROR("---");
|
|
||||||
Enable(GL_DEPTH_TEST);
|
|
||||||
Enable(GL_CULL_FACE);
|
|
||||||
Enable(GL_BLEND);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
// ClearColor(glm::vec4(255.f / 255, 163.f / 255, 176.f / 255, 0.f));
|
|
||||||
// Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawScenePassState::~DrawScenePassState()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -161,7 +161,6 @@ void Renderer::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filterin
|
|||||||
|
|
||||||
void Renderer::InitializeRenderPasses()
|
void Renderer::InitializeRenderPasses()
|
||||||
{
|
{
|
||||||
m_DrawScenePass = new DrawScenePass(this);
|
|
||||||
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_DrawFinalPass = new DrawFinalPass(this, m_LightCullingPass);
|
||||||
|
|||||||
Reference in New Issue
Block a user