mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Fixed broken shader uniform caused by automatic casting from uint to int
This commit is contained in:
@@ -52,7 +52,7 @@ namespace Nuake {
|
||||
volumetricShader->SetUniform("u_View", view);
|
||||
volumetricShader->SetUniform("u_Depth", mDepth, 1);
|
||||
volumetricShader->SetUniform("u_CamPosition", camPos);
|
||||
volumetricShader->SetUniform("u_StepCount", mStepCount);
|
||||
volumetricShader->SetUniform("u_StepCount", static_cast<int>(mStepCount));
|
||||
volumetricShader->SetUniform("u_FogAmount", mFogAmount);
|
||||
volumetricShader->SetUniform("u_LightCount", static_cast<int>(lights.size()));
|
||||
volumetricShader->SetUniform("u_Exponant", mFogExponant);
|
||||
|
||||
@@ -301,10 +301,10 @@ namespace Nuake
|
||||
|
||||
if (light.CastShadows)
|
||||
{
|
||||
for (unsigned int i = 0; i < CSM_AMOUNT; i++)
|
||||
for (int i = 0; i < CSM_AMOUNT; i++)
|
||||
{
|
||||
light.m_Framebuffers[i]->GetTexture(GL_DEPTH_ATTACHMENT)->Bind(17 + i);
|
||||
const uint32_t shadowMapId = shadowmapAmount + i;
|
||||
const int shadowMapId = shadowmapAmount + i;
|
||||
deferredShader->SetUniform("ShadowMaps[" + std::to_string(shadowMapId) + "]", 17 + i);
|
||||
deferredShader->SetUniform("u_DirectionalLight.ShadowMapsIDs[" + std::to_string(i) + "]", shadowMapId);
|
||||
deferredShader->SetUniform("u_DirectionalLight.CascadeDepth[" + std::to_string(i) + "]", light.mCascadeSplitDepth[i]);
|
||||
|
||||
@@ -249,7 +249,7 @@ namespace Nuake
|
||||
SetUniform(name, u.value.valueInt);
|
||||
break;
|
||||
case UniformTypes::Uint:
|
||||
SetUniform(name, u.value.valueUInt);
|
||||
SetUniformUint(name, u.value.valueUInt);
|
||||
break;
|
||||
case UniformTypes::Vec2:
|
||||
SetUniform(name, u.value.valueVec2);
|
||||
@@ -282,18 +282,18 @@ namespace Nuake
|
||||
}
|
||||
}
|
||||
|
||||
void Shader::SetUniformUint(const std::string& name, uint32_t v0)
|
||||
{
|
||||
int addr = FindUniformLocation(name);
|
||||
glUniform1ui(addr, v0);
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const std::string& name, int v0)
|
||||
{
|
||||
int addr = FindUniformLocation(name);
|
||||
glUniform1i(addr, v0);
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const std::string& name, unsigned int v0)
|
||||
{
|
||||
int addr = FindUniformLocation(name);
|
||||
glUniform1ui(addr, v0);
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const std::string& name, Vector2 v0)
|
||||
{
|
||||
SetUniform(name, v0.x, v0.y);
|
||||
@@ -391,7 +391,7 @@ namespace Nuake
|
||||
glUniformMatrix4fv(uniformSlot, 1, GL_FALSE, &value[0][0]);
|
||||
}
|
||||
|
||||
void Shader::SetUniform(const std::string& uniformName, Texture* texture, uint32_t slot)
|
||||
void Shader::SetUniform(const std::string& uniformName, Texture* texture, int slot)
|
||||
{
|
||||
SetUniform(uniformName, slot);
|
||||
texture->Bind(slot);
|
||||
|
||||
@@ -133,8 +133,8 @@ namespace Nuake
|
||||
void SetUniform(const std::string& name, float v0, float v1);
|
||||
void SetUniform(const std::string& name, float v0, float v1, float v3);
|
||||
void SetUniform(const std::string& name, float v0, float v1, float v3, float v4);
|
||||
void SetUniformUint(const std::string& name, uint32_t v0);
|
||||
void SetUniform(const std::string& name, int v0);
|
||||
void SetUniform(const std::string& name, unsigned int v0);
|
||||
void SetUniformv(const std::string& name, int size, int* value);
|
||||
void SetUniform(const std::string& name, Vector2 v0);
|
||||
void SetUniform(const std::string& name, Vector3 v0);
|
||||
@@ -143,7 +143,7 @@ namespace Nuake
|
||||
void SetUniform(const std::string& name, Matrix4 v0);
|
||||
void SetUniform(const std::string& name, int size, float* value);
|
||||
void SetUniform(const std::string& name, bool value);
|
||||
void SetUniform(const std::string& name, Texture* texture, uint32_t slot = 0);
|
||||
void SetUniform(const std::string& name, Texture* texture, int slot = 0);
|
||||
|
||||
void SetUniform(uint32_t uniformSlot, int value);
|
||||
void SetUniform(uint32_t uniformSlot, Matrix4 value);
|
||||
|
||||
Reference in New Issue
Block a user