Patched bounding box renderer to work again- in immediate mode renderer, more work on lighting rework for modern renderer

This commit is contained in:
2020-05-14 09:52:51 -05:00
parent dae950c72a
commit fbdea30015
6 changed files with 109 additions and 69 deletions

View File

@@ -7,12 +7,20 @@ const int POINT = 1;
const int SPOT = 2;
in vec2 outTexCoords;
flat in Light outLight;
flat in Light outLight[1];
uniform sampler2D diffuse, position, texcoord, normal, depth;
vec4 directionalLight(Light light) {
return vec4(0,0,0,0);
return vec4(0,0,0,1);
}
vec4 pointLight(Light light) {
return vec4(0.25, 0.25, 0.25, 1);
}
vec4 spotLight(Light light) {
return vec4(0.5, 0.5, 0.5, 1);
}
vec4 calculateLighting(Light light) {
@@ -22,6 +30,12 @@ vec4 calculateLighting(Light light) {
case DIRECTIONAL: {
result = directionalLight(light);
}
case POINT: {
result = pointLight(light);
}
case SPOT: {
result = spotLight(light);
}
default: {
result = vec4(1,1,1,1);
}
@@ -31,5 +45,5 @@ vec4 calculateLighting(Light light) {
}
void main() {
FragColor = texture(diffuse, outTexCoords) * calculateLighting(outLight);
FragColor = texture(diffuse, outTexCoords) * calculateLighting(outLight[0]);
}

View File

@@ -5,10 +5,10 @@ layout (location = 0) in vec3 inPosition;
layout (location = 1) in vec2 inTexCoords;
uniform sampler2D diffuse, position, texcoord, normal, depth;
uniform Light light;
uniform Light light[1];
out vec2 outTexCoords;
flat out Light outLight;
flat out Light outLight[1];
void main() {
gl_Position = vec4(inPosition.x, inPosition.y, inPosition.z, 1.0);