Rewritten. Works as a charm now.
This commit is contained in:
@@ -15,17 +15,16 @@ struct DirectionalLightJob : RenderJob
|
||||
DirectionalLightJob(ComponentWrapper transformComponent, ComponentWrapper directionalLightComponent, World* m_World)
|
||||
: RenderJob()
|
||||
{
|
||||
Orientation = Transform::AbsoluteOrientation(m_World, transformComponent.EntityID);
|
||||
Direction = glm::vec4(0,0,-1,0) * glm::inverse(Orientation);
|
||||
|
||||
Direction = glm::vec4(0,0,-1,0) * glm::inverse(Transform::AbsoluteOrientation(m_World, transformComponent.EntityID));
|
||||
//Direction = glm::vec4((glm::vec3)directionalLightComponent["Direction"], 0.f);
|
||||
Color = (glm::vec4)directionalLightComponent["Color"];
|
||||
Intensity = (double)directionalLightComponent["Intensity"];
|
||||
};
|
||||
|
||||
glm::quat Orientation;
|
||||
glm::vec4 Direction;
|
||||
glm::vec4 Color;
|
||||
float Intensity;
|
||||
bool TextureAlphaShadows = false;
|
||||
|
||||
void CalculateHash() override
|
||||
{
|
||||
|
||||
@@ -64,9 +64,9 @@ private:
|
||||
|
||||
const IRenderer* m_Renderer;
|
||||
const LightCullingPass* m_LightCullingPass;
|
||||
const ShadowPass* m_ShadowPass;
|
||||
const CubeMapPass* m_CubeMapPass;
|
||||
const SSAOPass* m_SSAOPass;
|
||||
const ShadowPass* m_ShadowPass;
|
||||
|
||||
ShaderProgram* m_ForwardPlusProgram;
|
||||
ShaderProgram* m_ExplosionEffectProgram;
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
#include "../Core/Transform.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "TextPass.h"
|
||||
#include "ShadowPass.h"
|
||||
#include "Util/CommonFunctions.h"
|
||||
#include "Core/PerformanceTimer.h"
|
||||
#include "ShadowPass.h"
|
||||
|
||||
class Renderer : public IRenderer
|
||||
{
|
||||
@@ -74,9 +74,9 @@ private:
|
||||
DrawScreenQuadPass* m_DrawScreenQuadPass;
|
||||
DrawBloomPass* m_DrawBloomPass;
|
||||
DrawColorCorrectionPass* m_DrawColorCorrectionPass;
|
||||
ShadowPass* m_ShadowPass;
|
||||
SSAOPass* m_SSAOPass;
|
||||
CubeMapPass* m_CubeMapPass;
|
||||
ShadowPass* m_ShadowPass;
|
||||
|
||||
//----------------------Functions----------------------//
|
||||
void InitializeWindow();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef ShadowPass_h_
|
||||
#define ShadowPass_h_
|
||||
#ifndef ShadowPass_h__
|
||||
#define ShadowPass_h__
|
||||
|
||||
#include "IRenderer.h"
|
||||
#include "FrameBuffer.h"
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
void ClearBuffer();
|
||||
void Draw(RenderScene& scene);
|
||||
|
||||
void DebugGUI();
|
||||
|
||||
GLuint DepthMap() const { return m_DepthMap; }
|
||||
std::array<glm::mat4, MAX_SPLITS> LightP() const { return m_LightProjection; }
|
||||
std::array<glm::mat4, MAX_SPLITS> LightV() const { return m_LightView; }
|
||||
@@ -62,7 +64,6 @@ private:
|
||||
GLuint m_DepthMap;
|
||||
FrameBuffer m_DepthBuffer;
|
||||
ShaderProgram* m_ShadowProgram;
|
||||
//ShaderProgram* m_TransparentShadowProgram;
|
||||
|
||||
std::array<glm::mat4, MAX_SPLITS> m_LightProjection;
|
||||
std::array<glm::mat4, MAX_SPLITS> m_LightView;
|
||||
@@ -71,8 +72,12 @@ private:
|
||||
GLuint m_ResolutionSizeWidth = 1024 * 2;
|
||||
GLuint m_ResolutionSizeHeight = 1024 * 2;
|
||||
|
||||
bool m_TransparentObjects = false;
|
||||
bool m_TexturedShadows = false;
|
||||
bool m_EnableShadows = true;
|
||||
|
||||
int m_CurrentNrOfSplits = 4;
|
||||
float m_SplitWeight = 0.91f;
|
||||
float m_SplitWeight = 0.962f;
|
||||
|
||||
std::array<ShadowFrustum, MAX_SPLITS> m_shadowFrusta;
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
class ShadowPassState : public RenderState
|
||||
{
|
||||
public:
|
||||
ShadowPassState(GLuint frameBuffer);
|
||||
~ShadowPassState();
|
||||
ShadowPassState(GLuint frameBuffer);
|
||||
~ShadowPassState();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user