Skip to content
Snippets Groups Projects
Commit c8e49973 authored by Tofu Linden's avatar Tofu Linden
Browse files

fix a variety of shader errors, mostly due to my confusing glsl with C++... again

parent fcfcb186
No related branches found
No related tags found
No related merge requests found
...@@ -41,7 +41,8 @@ void main() ...@@ -41,7 +41,8 @@ void main()
calcAtmospherics(pos.xyz); calcAtmospherics(pos.xyz);
//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
vec4 col(0.0, 0.0, 0.0, gl_Color.a);
vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
// Collect normal lights (need to be divided by two, as we later multiply by 2) // Collect normal lights (need to be divided by two, as we later multiply by 2)
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a); col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
......
...@@ -47,7 +47,8 @@ void main() ...@@ -47,7 +47,8 @@ void main()
calcAtmospherics(pos.xyz); calcAtmospherics(pos.xyz);
//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
vec4 col(0.0, 0.0, 0.0, gl_Color.a);
vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
// Collect normal lights (need to be divided by two, as we later multiply by 2) // Collect normal lights (need to be divided by two, as we later multiply by 2)
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a); col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
......
...@@ -13,7 +13,7 @@ float calcDirectionalLight(vec3 n, vec3 l) ...@@ -13,7 +13,7 @@ float calcDirectionalLight(vec3 n, vec3 l)
} }
float calcPointlightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight) float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight)
{ {
//get light vector //get light vector
vec3 lv = lp.xyz-v; vec3 lv = lp.xyz-v;
......
...@@ -42,7 +42,7 @@ void main() ...@@ -42,7 +42,7 @@ void main()
calcAtmospherics(pos.xyz); calcAtmospherics(pos.xyz);
//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
vec4 col(0.0, 0.0, 0.0, gl_Color.a); vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
// Collect normal lights (need to be divided by two, as we later multiply by 2) // Collect normal lights (need to be divided by two, as we later multiply by 2)
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a); col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
......
...@@ -53,7 +53,8 @@ void main() ...@@ -53,7 +53,8 @@ void main()
calcAtmospherics(pos.xyz); calcAtmospherics(pos.xyz);
//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
vec4 col(0.0, 0.0, 0.0, gl_Color.a);
vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
// Collect normal lights (need to be divided by two, as we later multiply by 2) // Collect normal lights (need to be divided by two, as we later multiply by 2)
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a); col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
......
...@@ -15,7 +15,7 @@ vec3 scaleUpLight(vec3 light); ...@@ -15,7 +15,7 @@ vec3 scaleUpLight(vec3 light);
vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
{ {
vec4 col(0.0, 0.0, 0.0, color.a); vec4 col = vec4(0.0, 0.0, 0.0, color.a);
// Collect normal lights (need to be divided by two, as we later multiply by 2) // Collect normal lights (need to be divided by two, as we later multiply by 2)
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a); col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment