Added support for rendering multiple lights, standardized shaders to use snake case for variables and camel case for functions, stubbed PBR material shader include.

This commit is contained in:
2023-07-29 14:09:23 -05:00
parent 9a6e1df032
commit 5d1c195917
8 changed files with 97 additions and 62 deletions

View File

@@ -5,25 +5,25 @@ layout (location = 1) out vec4 fragColor;
layout (location = 2) out vec3 fragNormal;
layout (location = 3) out vec3 fragUV;
in vec3 outPosition, outColor, outNormal, outUV, outFragPos, outCameraPos;
in vec3 out_position, out_color, out_normal, out_uv, out_frag_pos, out_camera_pos;
out vec4 outputFragColor;
flat in int outHasTexture;
flat in int out_has_texture;
uniform sampler2D diffuse_texture;
void main() {
vec3 result;
if (outHasTexture == 0) {
result = outColor;
if (out_has_texture == 0) {
result = out_color;
} else {
result = texture(diffuse_texture, outUV.xy).xyz + 0.25;
result = texture(diffuse_texture, out_uv.xy).xyz + 0.25;
}
fragPosition = outPosition;
fragPosition = out_position;
fragColor = vec4(result, 1.0);
fragNormal = outNormal;
fragUV = outUV;
fragNormal = out_normal;
fragUV = out_uv;
float gamma = 2.2;
outputFragColor.rgb = pow(fragColor.rgb, vec3(1.0 / gamma));