From 75cadf21cc400b448478d91932ddef18e8830d33 Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Mon, 10 Jun 2024 22:48:52 +0300 Subject: [PATCH] Set light to uniforms --- include/Render/SalmonRender/SalmonRenderInterface.h | 3 +++ src/Render/SalmonRender/SalmonRenderInterface.cpp | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/include/Render/SalmonRender/SalmonRenderInterface.h b/include/Render/SalmonRender/SalmonRenderInterface.h index f01e4ef..c944a44 100644 --- a/include/Render/SalmonRender/SalmonRenderInterface.h +++ b/include/Render/SalmonRender/SalmonRenderInterface.h @@ -37,6 +37,7 @@ protected: float FogEndDistance; vec4 FogColor; + vec3 lightPos; void CalcCamPosVec(); @@ -100,6 +101,8 @@ public: void SetFogBeginDistance(float distance); void SetFogEndDistance(float distance); + + void SetLightPos(vec3 newLightPos); }; diff --git a/src/Render/SalmonRender/SalmonRenderInterface.cpp b/src/Render/SalmonRender/SalmonRenderInterface.cpp index 035bc39..2838c2d 100644 --- a/src/Render/SalmonRender/SalmonRenderInterface.cpp +++ b/src/Render/SalmonRender/SalmonRenderInterface.cpp @@ -64,6 +64,8 @@ void TSalmonRendererInterface::SetUniforms() RenderUniform3fv(CONST_STRING_CAMPOS_UNIFORM, GetCamPos().v); + RenderUniform3fv("lightPos", lightPos.v); + ResourceManager->LightManager.SetLightUniforms(); } @@ -976,6 +978,11 @@ void TSalmonRendererInterface::SetFogEndDistance(float distance) FogEndDistance = distance; } +void TSalmonRendererInterface::SetLightPos(vec3 newLightPos) +{ + lightPos = newLightPos; +} + } //namespace SE