Various coding style improvements

This commit is contained in:
Antoine Pilote
2023-07-02 16:35:16 -04:00
parent dfb81046bf
commit fca6b2f651
5 changed files with 16 additions and 23 deletions

View File

@@ -242,15 +242,16 @@ void main()
float distance = length(Lights[i].Position - worldPos);
float attenuation = 1.0 / (distance * distance);
if (Lights[i].Type == 0) {
if (Lights[i].Type == 0)
{
L = normalize(Lights[i].Direction);
attenuation = 1.0f;
shadow += ShadowCalculation(Lights[i], worldPos, N);
}
vec3 radiance = Lights[i].Color * attenuation ;
if (Lights[i].Type == 0) {
if (Lights[i].Type == 0)
{
radiance *= shadow;
}
@@ -281,8 +282,8 @@ void main()
vec3 kD = 1.0 - kS;
kD *= 1.0 - metallic;
vec3 ambient = (kD * albedo) * (ao);
vec3 color = (ambient * ssao) + Lo;
vec3 ambient = (kD * albedo) * (ao) * ssao;
vec3 color = (ambient) + Lo;
// Display CSM splits..
/*float depth = length(worldPos - u_EyePosition);

View File

@@ -176,11 +176,11 @@ void main() {
}
outColor = vec4(resultingColor.xyz * Fresnel, metallic) ;
outColor = vec4(resultingColor.xyz * Fresnel, 1.0) ;
}
else {
outColor = vec4(SSR(position, normalize(reflectionDirection)) * Fresnel, metallic);
outColor = vec4(SSR(position, normalize(reflectionDirection)) * Fresnel, 1.0);
if (outColor.xyz == vec3(0.f)) {
outColor = texture(textureFrame, UV);
}

View File

@@ -62,8 +62,8 @@ vec3 ComputeVolumetric(vec3 FragPos, Light light)
vec3 rayVector = FragPos - startPosition; // Ray Direction
float rayLength = length(rayVector); // Length of the raymarched
if(rayLength > 100)
return vec3(0);
if(rayLength > 1000.0)
return vec3(1.0, 1.0, 1.0);
float stepLength = rayLength / u_StepCount; // Step length
vec3 rayDirection = rayVector / rayLength;
vec3 step = rayDirection * stepLength; // Normalized to step length direction

View File

@@ -38,7 +38,7 @@ namespace Nuake {
mFinalFramebuffer->Clear();
RenderCommand::Disable(RendererEnum::FACE_CULL);
Vector3 cameraPosition = Vector3(view[3]);
auto cameraPosition = Vector3(view[3]);
Shader* volumetricShader = ShaderManager::GetShader("resources/Shaders/volumetric.shader");
volumetricShader->Bind();
volumetricShader->SetUniformMat4f("u_Projection", projection);

View File

@@ -34,8 +34,8 @@ namespace Nuake
if (!previous && controlled)
{
firstMouse = true;
mouseLastX = x;
mouseLastY = y;
//mouseLastX = x;
//mouseLastY = y;
}
}
else
@@ -61,12 +61,7 @@ namespace Nuake
if (Input::YScroll != 0.0f)
{
this->Fov += Input::YScroll;
if (Fov < 5.0f)
{
Fov = 5.0f;
}
Fov = glm::max(Fov, 5.0f);
Input::YScroll = 0.0f;
}
}
@@ -92,7 +87,6 @@ namespace Nuake
if (Speed < 0)
Speed = 0;
if (m_Type == CAMERA_TYPE::ORTHO)
{
if (Input::IsKeyDown(GLFW_KEY_RIGHT))
@@ -106,7 +100,7 @@ namespace Nuake
}
else
{
glm::vec3 movement = glm::vec3(0, 0, 0);
auto movement = Vector3(0, 0, 0);
if (Input::IsKeyDown(GLFW_KEY_D))
movement -= Right * (Speed * ts);
@@ -175,9 +169,7 @@ namespace Nuake
Translation += Vector3(Direction) * Input::YScroll;
Input::YScroll = 0.0f;
}
else
{
}
mouseLastX = x;
mouseLastY = y;
}