1
0
Fork 0

Revert "Remove ambient component of additional lights"

This reverts commit de454d1391ffc1d208dc783715524ef8eef4055f.
This commit is contained in:
Frederic Bouvier 2012-04-18 20:01:40 +02:00
parent 9ffbf7ac3c
commit c06889b3c5
4 changed files with 16 additions and 2 deletions

View file

@ -68,6 +68,11 @@
<value type="vec4d"><use>position</use></value>
<positioned type="bool">true</positioned>
</uniform>
<uniform>
<name>Ambient</name>
<type>float-vec4</type>
<value type="vec4d"><use>ambient</use></value>
</uniform>
<uniform>
<name>Diffuse</name>
<type>float-vec4</type>

View file

@ -74,6 +74,11 @@
<value type="vec4d"><use>direction</use></value>
<positioned type="bool">true</positioned>
</uniform>
<uniform>
<name>Ambient</name>
<type>float-vec4</type>
<value type="vec4d"><use>ambient</use></value>
</uniform>
<uniform>
<name>Diffuse</name>
<type>float-vec4</type>

View file

@ -6,6 +6,7 @@ uniform sampler2D normal_tex;
uniform sampler2D color_tex;
uniform sampler2D spec_emis_tex;
uniform vec4 LightPosition;
uniform vec4 Ambient;
uniform vec4 Diffuse;
uniform vec4 Specular;
uniform vec3 Attenuation;
@ -46,8 +47,9 @@ void main() {
float nDotHV = max(0.0, dot(normal, halfVector));
vec4 color = texture2D( color_tex, coords );
vec4 Iamb = Ambient * color * att;
vec4 Idiff = Diffuse * color * att * nDotVP;
vec3 Ispec = pow( nDotHV, spec_emis.y ) * spec_emis.x * att * Specular.rgb;
gl_FragColor = vec4(Idiff.rgb + Ispec, 1.0);
gl_FragColor = vec4(Iamb.rgb + Idiff.rgb + Ispec, 1.0);
}

View file

@ -7,6 +7,7 @@ uniform sampler2D color_tex;
uniform sampler2D spec_emis_tex;
uniform vec4 LightPosition;
uniform vec4 LightDirection;
uniform vec4 Ambient;
uniform vec4 Diffuse;
uniform vec4 Specular;
uniform vec3 Attenuation;
@ -58,8 +59,9 @@ void main() {
float nDotHV = max(0.0, dot(normal, halfVector));
vec4 color = texture2D( color_tex, coords );
vec4 Iamb = Ambient * color * att;
vec4 Idiff = Diffuse * color * att * nDotVP;
vec3 Ispec = pow( nDotHV, spec_emis.y ) * spec_emis.x * att * Specular.rgb;
gl_FragColor = vec4(Idiff.rgb + Ispec, 1.0);
gl_FragColor = vec4(Iamb.rgb + Idiff.rgb + Ispec, 1.0);
}