Some merge fixes, needs more work
This commit is contained in:
+1
-1
Submodule assets updated: 6b5749627c...c8e631f449
@@ -20,6 +20,15 @@ public:
|
|||||||
void SetFullscreen(bool fullscreen) { m_Fullscreen = fullscreen; }
|
void SetFullscreen(bool fullscreen) { m_Fullscreen = fullscreen; }
|
||||||
bool VSYNC() const { return m_VSYNC; }
|
bool VSYNC() const { return m_VSYNC; }
|
||||||
void SetVSYNC(bool vsync) { m_VSYNC = vsync; }
|
void SetVSYNC(bool vsync) { m_VSYNC = vsync; }
|
||||||
|
::Camera* Camera() const { return m_Camera; }
|
||||||
|
void SetCamera(::Camera* camera)
|
||||||
|
{
|
||||||
|
if (camera == nullptr) {
|
||||||
|
m_Camera = m_DefaultCamera;
|
||||||
|
} else {
|
||||||
|
m_Camera = camera;
|
||||||
|
}
|
||||||
|
}
|
||||||
virtual void Initialize() = 0;
|
virtual void Initialize() = 0;
|
||||||
virtual void Update(double dt) = 0;
|
virtual void Update(double dt) = 0;
|
||||||
virtual void Draw(RenderQueueCollection& rq) = 0;
|
virtual void Draw(RenderQueueCollection& rq) = 0;
|
||||||
@@ -31,6 +40,8 @@ protected:
|
|||||||
int m_GLVersion[2];
|
int m_GLVersion[2];
|
||||||
std::string m_GLVendor;
|
std::string m_GLVendor;
|
||||||
GLFWwindow* m_Window = nullptr;
|
GLFWwindow* m_Window = nullptr;
|
||||||
|
::Camera* m_DefaultCamera;
|
||||||
|
::Camera* m_Camera = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Renderer_h__
|
#endif // Renderer_h__
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "../GLM.h"
|
#include "../GLM.h"
|
||||||
#include "../Core/Util/Rectangle.h"
|
#include "../Core/Util/Rectangle.h"
|
||||||
#include "../Core/Entity.h"
|
#include "../Core/Entity.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
|
||||||
class Model;
|
class Model;
|
||||||
class Skeleton;
|
class Skeleton;
|
||||||
@@ -168,6 +169,7 @@ struct RenderQueueCollection
|
|||||||
{
|
{
|
||||||
RenderQueue Forward;
|
RenderQueue Forward;
|
||||||
RenderQueue Lights;
|
RenderQueue Lights;
|
||||||
|
Camera* Camera;
|
||||||
|
|
||||||
void Clear()
|
void Clear()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "Model.h"
|
#include "Model.h"
|
||||||
#include "../Core/EKeyDown.h"
|
#include "../Core/EKeyDown.h"
|
||||||
#include "../Input/EInputCommand.h"
|
#include "../Input/EInputCommand.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
|
||||||
class RenderSystem : public ImpureSystem
|
class RenderSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
@@ -27,6 +28,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
RenderQueueCollection* m_RenderQueues;
|
RenderQueueCollection* m_RenderQueues;
|
||||||
bool m_SwitchCamera = false;
|
bool m_SwitchCamera = false;
|
||||||
|
Camera* m_Camera = nullptr;
|
||||||
|
|
||||||
EventRelay<RenderSystem, Events::SetCamera> m_ESetCamera;
|
EventRelay<RenderSystem, Events::SetCamera> m_ESetCamera;
|
||||||
bool OnSetCamera(const Events::SetCamera &event);
|
bool OnSetCamera(const Events::SetCamera &event);
|
||||||
|
|||||||
@@ -12,23 +12,10 @@
|
|||||||
#include "../Core/World.h"
|
#include "../Core/World.h"
|
||||||
#include "PickingPass.h"
|
#include "PickingPass.h"
|
||||||
#include "DrawScenePass.h"
|
#include "DrawScenePass.h"
|
||||||
|
|
||||||
|
|
||||||
#define TILE_SIZE 16
|
|
||||||
#define NUM_LIGHTS 3
|
|
||||||
|
|
||||||
|
|
||||||
enum lightType
|
|
||||||
{
|
|
||||||
Point,
|
|
||||||
Spot,
|
|
||||||
Directional,
|
|
||||||
Area
|
|
||||||
};
|
|
||||||
|
|
||||||
#include "../Core/EventBroker.h"
|
#include "../Core/EventBroker.h"
|
||||||
#include "EPicking.h"
|
#include "EPicking.h"
|
||||||
#include "ImGuiRenderPass.h"
|
#include "ImGuiRenderPass.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
|
||||||
class Renderer : public IRenderer
|
class Renderer : public IRenderer
|
||||||
{
|
{
|
||||||
@@ -69,56 +56,10 @@ private:
|
|||||||
//void PickingPass(RenderQueueCollection& rq);
|
//void PickingPass(RenderQueueCollection& rq);
|
||||||
void DrawScreenQuad(GLuint textureToDraw);
|
void DrawScreenQuad(GLuint textureToDraw);
|
||||||
|
|
||||||
//----------------------Forward+-----------------------//
|
|
||||||
void CalculateFrustum();
|
|
||||||
void CullLights();
|
|
||||||
//Frustum
|
|
||||||
struct Plane {
|
|
||||||
glm::vec3 Normal;
|
|
||||||
float d;
|
|
||||||
};
|
|
||||||
struct Frustum {
|
|
||||||
Plane Planes[4];
|
|
||||||
};
|
|
||||||
Frustum m_Frustums[80*45]; //TODO: Renderer: Make this change with resolution
|
|
||||||
|
|
||||||
//Lights
|
|
||||||
void TEMPCreateLights();
|
|
||||||
//TODO: Renderer: Add Directionllights, spotlights and area lights to this as type.
|
|
||||||
struct PointLight {
|
|
||||||
glm::vec4 Position = glm::vec4(0.f);
|
|
||||||
glm::vec4 Color = glm::vec4(1.f);
|
|
||||||
float Radius = 5.f;
|
|
||||||
float Intensity = 0.8f;
|
|
||||||
float Falloff = 0.3f;
|
|
||||||
float Padding = 1337;
|
|
||||||
};
|
|
||||||
PointLight m_PointLights[NUM_LIGHTS];
|
|
||||||
|
|
||||||
struct LightGrid {
|
|
||||||
int Amount;
|
|
||||||
int Start;
|
|
||||||
glm::vec2 Padding;
|
|
||||||
};
|
|
||||||
LightGrid m_LightGrid[80*45];
|
|
||||||
|
|
||||||
int m_LightOffset = 0;
|
|
||||||
|
|
||||||
int m_LightIndex[80*45*200];
|
|
||||||
|
|
||||||
//-------------------------SSBO------------------------//
|
|
||||||
GLuint m_FrustumSSBO = 0;
|
|
||||||
GLuint m_LightSSBO = 1;
|
|
||||||
GLuint m_LightGridSSBO = 2;
|
|
||||||
GLuint m_LightOffsetSSBO = 3;
|
|
||||||
GLuint m_LightIndexSSBO = 4;
|
|
||||||
|
|
||||||
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type);
|
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type);
|
||||||
//--------------------ShaderPrograms-------------------//
|
//--------------------ShaderPrograms-------------------//
|
||||||
ShaderProgram* m_BasicForwardProgram;
|
ShaderProgram* m_BasicForwardProgram;
|
||||||
ShaderProgram* m_DrawScreenQuadProgram;
|
ShaderProgram* m_DrawScreenQuadProgram;
|
||||||
ShaderProgram* m_CalculateFrustumProgram;
|
|
||||||
ShaderProgram* m_LightCullProgram;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ bool EditorSystem::OnMouseMove(const Events::MouseMove& e)
|
|||||||
EntityID parent = m_World->GetParent(m_Selection);
|
EntityID parent = m_World->GetParent(m_Selection);
|
||||||
glm::quat inverseParentOrientation;
|
glm::quat inverseParentOrientation;
|
||||||
if (parent != 0) {
|
if (parent != 0) {
|
||||||
inverseParentOrientation = glm::inverse(RenderQueueFactory::AbsoluteOrientation(m_World, parent));
|
inverseParentOrientation = glm::inverse(RenderSystem::AbsoluteOrientation(m_World, parent));
|
||||||
}
|
}
|
||||||
(glm::vec3&)m_World->GetComponent(m_Selection, "Transform")["Position"] += inverseParentOrientation * movement;
|
(glm::vec3&)m_World->GetComponent(m_Selection, "Transform")["Position"] += inverseParentOrientation * movement;
|
||||||
} else if (m_WidgetSpace == WidgetSpace::Local) {
|
} else if (m_WidgetSpace == WidgetSpace::Local) {
|
||||||
@@ -130,7 +130,7 @@ bool EditorSystem::OnMouseMove(const Events::MouseMove& e)
|
|||||||
EntityID parent = m_World->GetParent(m_Selection);
|
EntityID parent = m_World->GetParent(m_Selection);
|
||||||
glm::quat parentOrientation;
|
glm::quat parentOrientation;
|
||||||
if (parent != 0) {
|
if (parent != 0) {
|
||||||
parentOrientation = RenderQueueFactory::AbsoluteOrientation(m_World, parent);
|
parentOrientation = RenderSystem::AbsoluteOrientation(m_World, parent);
|
||||||
}
|
}
|
||||||
glm::vec3& selectionOrientation = m_World->GetComponent(m_Selection, "Transform")["Orientation"];
|
glm::vec3& selectionOrientation = m_World->GetComponent(m_Selection, "Transform")["Orientation"];
|
||||||
//glm::quat currentOrientation = RenderQueueFactory::AbsoluteOrientation(m_World, m_Selection);
|
//glm::quat currentOrientation = RenderQueueFactory::AbsoluteOrientation(m_World, m_Selection);
|
||||||
@@ -235,10 +235,10 @@ void EditorSystem::updateWidget()
|
|||||||
|
|
||||||
if (m_Selection != 0) {
|
if (m_Selection != 0) {
|
||||||
auto widgetTransform = m_World->GetComponent(m_Widget, "Transform");
|
auto widgetTransform = m_World->GetComponent(m_Widget, "Transform");
|
||||||
glm::vec3 selectionPosition = RenderQueueFactory::AbsolutePosition(m_World, m_Selection);
|
glm::vec3 selectionPosition = RenderSystem::AbsolutePosition(m_World, m_Selection);
|
||||||
widgetTransform["Position"] = selectionPosition;
|
widgetTransform["Position"] = selectionPosition;
|
||||||
if (m_WidgetSpace == WidgetSpace::Local) {
|
if (m_WidgetSpace == WidgetSpace::Local) {
|
||||||
widgetTransform["Orientation"] = glm::eulerAngles(RenderQueueFactory::AbsoluteOrientation(m_World, m_Selection));
|
widgetTransform["Orientation"] = glm::eulerAngles(RenderSystem::AbsoluteOrientation(m_World, m_Selection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -264,7 +264,7 @@ void EditorSystem::setWidgetMode(WidgetMode newMode)
|
|||||||
if (m_Selection != 0) {
|
if (m_Selection != 0) {
|
||||||
if (m_WidgetSpace == WidgetSpace::Local) {
|
if (m_WidgetSpace == WidgetSpace::Local) {
|
||||||
auto selectionTransform = m_World->GetComponent(m_Selection, "Transform");
|
auto selectionTransform = m_World->GetComponent(m_Selection, "Transform");
|
||||||
widgetTransform["Orientation"] = glm::eulerAngles(RenderQueueFactory::AbsoluteOrientation(m_World, m_Selection));
|
widgetTransform["Orientation"] = glm::eulerAngles(RenderSystem::AbsoluteOrientation(m_World, m_Selection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (newMode == WidgetMode::Scale) {
|
} else if (newMode == WidgetMode::Scale) {
|
||||||
@@ -285,7 +285,7 @@ void EditorSystem::setWidgetMode(WidgetMode newMode)
|
|||||||
if (m_Selection != 0) {
|
if (m_Selection != 0) {
|
||||||
auto selectionTransform = m_World->GetComponent(m_Selection, "Transform");
|
auto selectionTransform = m_World->GetComponent(m_Selection, "Transform");
|
||||||
if (m_WidgetSpace == WidgetSpace::Local) {
|
if (m_WidgetSpace == WidgetSpace::Local) {
|
||||||
widgetTransform["Orientation"] = glm::eulerAngles(RenderQueueFactory::AbsoluteOrientation(m_World, m_Selection));
|
widgetTransform["Orientation"] = glm::eulerAngles(RenderSystem::AbsoluteOrientation(m_World, m_Selection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ RenderSystem::RenderSystem(EventBroker* eventBrokerer, RenderQueueCollection* re
|
|||||||
Initialize();
|
Initialize();
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &RenderSystem::OnSetCamera);
|
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &RenderSystem::OnSetCamera);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &RenderSystem::OnInputCommand);
|
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &RenderSystem::OnInputCommand);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,20 +5,26 @@ void Renderer::Initialize()
|
|||||||
{
|
{
|
||||||
InitializeWindow();
|
InitializeWindow();
|
||||||
|
|
||||||
TEMPCreateLights();
|
|
||||||
InitializeRenderPasses();
|
InitializeRenderPasses();
|
||||||
|
|
||||||
glfwSwapInterval(m_VSYNC);
|
glfwSwapInterval(m_VSYNC);
|
||||||
InitializeShaders();
|
InitializeShaders();
|
||||||
InitializeTextures();
|
InitializeTextures();
|
||||||
InitializeSSBOs();
|
|
||||||
//CalculateFrustum();
|
|
||||||
|
|
||||||
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.obj");
|
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.obj");
|
||||||
m_UnitQuad = ResourceManager::Load<Model>("Models/Core/UnitQuad.obj");
|
m_UnitQuad = ResourceManager::Load<Model>("Models/Core/UnitQuad.obj");
|
||||||
m_UnitSphere = ResourceManager::Load<Model>("Models/Core/UnitSphere.obj");
|
m_UnitSphere = ResourceManager::Load<Model>("Models/Core/UnitSphere.obj");
|
||||||
|
|
||||||
m_ImGuiRenderPass = new ImGuiRenderPass(this, m_EventBroker);
|
m_ImGuiRenderPass = new ImGuiRenderPass(this, m_EventBroker);
|
||||||
|
|
||||||
|
|
||||||
|
// Create default camera
|
||||||
|
m_DefaultCamera = new ::Camera((float)m_Resolution.Width / m_Resolution.Height, glm::radians(45.f), 0.01f, 5000.f);
|
||||||
|
m_DefaultCamera->SetPosition(glm::vec3(0, 0, 10));
|
||||||
|
if (m_Camera == nullptr) {
|
||||||
|
m_Camera = m_DefaultCamera;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::InitializeWindow()
|
void Renderer::InitializeWindow()
|
||||||
@@ -70,16 +76,6 @@ void Renderer::InitializeShaders()
|
|||||||
m_DrawScreenQuadProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/DrawScreenQuad.frag.glsl")));
|
m_DrawScreenQuadProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/DrawScreenQuad.frag.glsl")));
|
||||||
m_DrawScreenQuadProgram->Compile();
|
m_DrawScreenQuadProgram->Compile();
|
||||||
m_DrawScreenQuadProgram->Link();
|
m_DrawScreenQuadProgram->Link();
|
||||||
|
|
||||||
//m_CalculateFrustumProgram = ResourceManager::Load<ShaderProgram>("#CalculateFrustumProgram");
|
|
||||||
//m_CalculateFrustumProgram.AddShader(std::shared_ptr<Shader>(new ComputeShader("Shaders/GridFrustum.comp.glsl")));
|
|
||||||
//m_CalculateFrustumProgram.Compile();
|
|
||||||
//m_CalculateFrustumProgram.Link();
|
|
||||||
|
|
||||||
//m_LightCullProgram = ResourceManager::Load<ShaderProgram>("#LightCullProgram");
|
|
||||||
//m_LightCullProgram.AddShader(std::shared_ptr<Shader>(new ComputeShader("Shaders/cullLights.comp.glsl")));
|
|
||||||
//m_LightCullProgram.Compile();
|
|
||||||
//m_LightCullProgram.Link();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::InputUpdate(double dt)
|
void Renderer::InputUpdate(double dt)
|
||||||
@@ -98,7 +94,6 @@ void Renderer::Draw(RenderQueueCollection& rq)
|
|||||||
{
|
{
|
||||||
m_PickingPass->Draw(rq);
|
m_PickingPass->Draw(rq);
|
||||||
//DrawScreenQuad(m_PickingPass->PickingTexture());
|
//DrawScreenQuad(m_PickingPass->PickingTexture());
|
||||||
//CullLights();
|
|
||||||
|
|
||||||
glClearColor(255.f / 255, 163.f / 255, 176.f / 255, 1.f);
|
glClearColor(255.f / 255, 163.f / 255, 176.f / 255, 1.f);
|
||||||
|
|
||||||
@@ -147,94 +142,8 @@ void Renderer::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filterin
|
|||||||
GLERROR("Texture initialization failed");
|
GLERROR("Texture initialization failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::InitializeSSBOs()
|
|
||||||
{
|
|
||||||
printf("Size: %i\n", sizeof(m_Frustums));
|
|
||||||
glGenBuffers(1, &m_FrustumSSBO);
|
|
||||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_FrustumSSBO);
|
|
||||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(m_Frustums), &m_Frustums, GL_DYNAMIC_COPY);
|
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, m_FrustumSSBO);
|
|
||||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
|
|
||||||
|
|
||||||
GLERROR("m_FrustumSSBO");
|
|
||||||
|
|
||||||
glGenBuffers(1, &m_LightSSBO);
|
|
||||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightSSBO);
|
|
||||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(m_PointLights), &m_PointLights, GL_DYNAMIC_COPY);
|
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_LightSSBO);
|
|
||||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
|
|
||||||
|
|
||||||
GLERROR("m_LightSSBO");
|
|
||||||
|
|
||||||
|
|
||||||
glGenBuffers(1, &m_LightGridSSBO);
|
|
||||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightGridSSBO);
|
|
||||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(m_LightGrid), &m_LightGrid, GL_DYNAMIC_COPY);
|
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, m_LightGridSSBO);
|
|
||||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
|
|
||||||
|
|
||||||
GLERROR("m_LightGridSSBO");
|
|
||||||
|
|
||||||
|
|
||||||
glGenBuffers(1, &m_LightOffsetSSBO);
|
|
||||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightOffsetSSBO);
|
|
||||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(m_LightOffset), &m_LightOffset, GL_DYNAMIC_COPY);
|
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 3, m_LightOffsetSSBO);
|
|
||||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
|
|
||||||
|
|
||||||
GLERROR("m_LightOffsetSSBO");
|
|
||||||
|
|
||||||
|
|
||||||
glGenBuffers(1, &m_LightIndexSSBO);
|
|
||||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightIndexSSBO);
|
|
||||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(m_LightIndex), &m_LightIndex, GL_DYNAMIC_COPY);
|
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 4, m_LightIndexSSBO);
|
|
||||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
|
|
||||||
|
|
||||||
GLERROR("m_LightIndexSSBO");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Renderer::InitializeRenderPasses()
|
void Renderer::InitializeRenderPasses()
|
||||||
{
|
{
|
||||||
m_DrawScenePass = new DrawScenePass(this);
|
m_DrawScenePass = new DrawScenePass(this);
|
||||||
m_PickingPass = new PickingPass(this, m_EventBroker);
|
m_PickingPass = new PickingPass(this, m_EventBroker);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CalculateFrustum()
|
|
||||||
{
|
|
||||||
// GLERROR("CalculateFrustum Error-1");
|
|
||||||
// m_CalculateFrustumProgram->Bind();
|
|
||||||
// GLERROR("CalculateFrustum Error1");
|
|
||||||
// glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, m_FrustumSSBO);
|
|
||||||
// GLERROR("CalculateFrustum Error2");
|
|
||||||
// // glUniformMatrix4fv(glGetUniformLocation(m_CalculateFrustumProgram->GetHandle(), "P"), 1, false, glm::value_ptr(m_Camera->ProjectionMatrix()));
|
|
||||||
// GLERROR("CalculateFrustum Error3");
|
|
||||||
// // glUniform2f(glGetUniformLocation(m_CalculateFrustumProgram->GetHandle(), "ScreenDimensions"), m_Resolution.Width, m_Resolution.Height);
|
|
||||||
// GLERROR("CalculateFrustum Error4");
|
|
||||||
// //glDispatchCompute(5, 3, 1);
|
|
||||||
// GLERROR("CalculateFrustum Error5");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Renderer::TEMPCreateLights()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < NUM_LIGHTS; i++) {
|
|
||||||
m_PointLights[i].Position = glm::vec4(i, 0.f, 0.f, 0.f);
|
|
||||||
m_PointLights[i].Color = glm::vec4(1.f, 0.5f, 0.f + i*0.1f, 1.f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Renderer::CullLights()
|
|
||||||
{
|
|
||||||
m_LightCullProgram->Bind();
|
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, m_FrustumSSBO);
|
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_LightSSBO);
|
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, m_LightGridSSBO);
|
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 3, m_LightOffsetSSBO);
|
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 4, m_LightIndexSSBO);
|
|
||||||
glDispatchCompute(m_Resolution.Width / TILE_SIZE, m_Resolution.Height / TILE_SIZE, 1);
|
|
||||||
GLERROR("CullLights Error");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -14,7 +14,6 @@ Game::Game(int argc, char* argv[])
|
|||||||
// Create the core event broker
|
// Create the core event broker
|
||||||
m_EventBroker = new EventBroker();
|
m_EventBroker = new EventBroker();
|
||||||
|
|
||||||
m_RenderQueueFactory = new RenderQueueFactory();
|
|
||||||
|
|
||||||
// Create the renderer
|
// Create the renderer
|
||||||
m_Renderer = new Renderer(m_EventBroker, m_World);
|
m_Renderer = new Renderer(m_EventBroker, m_World);
|
||||||
@@ -48,6 +47,8 @@ Game::Game(int argc, char* argv[])
|
|||||||
ResourceManager::Load<EntityXMLFile>(mapToLoad)->PopulateWorld(m_World);
|
ResourceManager::Load<EntityXMLFile>(mapToLoad)->PopulateWorld(m_World);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_RenderQueues = new RenderQueueCollection();
|
||||||
|
|
||||||
// Create system pipeline
|
// Create system pipeline
|
||||||
m_SystemPipeline = new SystemPipeline(m_EventBroker);
|
m_SystemPipeline = new SystemPipeline(m_EventBroker);
|
||||||
m_SystemPipeline->AddSystem<RaptorCopterSystem>();
|
m_SystemPipeline->AddSystem<RaptorCopterSystem>();
|
||||||
|
|||||||
Reference in New Issue
Block a user