I think this is now finding the different segments of the cascade
This commit is contained in:
FakeShemp
2016-02-18 20:48:39 +01:00
parent 178402e964
commit bf376f54b6
4 changed files with 230 additions and 110 deletions
+11 -10
View File
@@ -33,9 +33,7 @@ public:
void ClearBuffer();
void Draw(RenderScene& scene);
GLuint DepthMap() const { return m_DepthMap; }
GLuint DepthMap() const { return m_DepthMap[m_ShadowLevel]; }
glm::mat4 lightSpaceMatrix() const { return m_LightSpaceMatrix; }
glm::mat4 lightP() const { return m_LightProjection; }
glm::mat4 lightV() const { return m_LightView; }
@@ -44,18 +42,20 @@ public:
private:
void CalculateFrustum(RenderScene & scene, std::shared_ptr<DirectionalLightJob> directionalLightJob);
glm::mat4 CalculateFrustum(RenderScene & scene, std::shared_ptr<DirectionalLightJob> directionalLightJob, glm::mat4& p, glm::mat4& v, ShadowCamera shad_cam);
glm::vec3 LightDirectionToPoint(glm::vec4 direction);
std::array<glm::vec3, 8> UpdateFrustumPoints(Camera* cam, glm::vec3 center, glm::vec3 view_dir);
void UpdateSplitDist(std::array<ShadowCamera, MAX_SPLITS> shadow_cams, float far_distance, float near_distance);
void InitializeLightCameras();
glm::mat4 ApplyCropMatrix(ShadowCamera& shadow_cam, glm::mat4 m, glm::mat4 v);
glm::mat4 FindNewFrustum(ShadowCamera shadow_cam);
EventBroker* m_EventBroker;
const IRenderer* m_Renderer;
GLuint m_DepthMap;
FrameBuffer m_DepthBuffer;
std::array<GLuint, MAX_SPLITS> m_DepthMap;
std::array<FrameBuffer, MAX_SPLITS> m_DepthBuffer;
ShaderProgram* m_ShadowProgram;
@@ -69,15 +69,16 @@ private:
glm::mat4 m_LightView;
glm::mat4 m_LightSpaceMatrix;
GLuint resolutionSizeWidth = 1024 * 8;
GLuint resolutionSizeHeigth = 1024 * 8;
GLuint resolutionSizeWidth = 1024 * 2;
GLuint resolutionSizeHeigth = 1024 * 2;
bool m_ShadowOn = true;
int m_ShadowLevel = 0;
int m_CurrentNrOfSplits = 3;
float m_SplitWeight = 0.75f;
std::array<ShadowCamera, MAX_SPLITS> shadCams;
std::array<ShadowCamera, MAX_SPLITS> m_shadCams;
};
#endif