Revert "Remove ambient component of additional lights"
This reverts commit de454d1391ffc1d208dc783715524ef8eef4055f.
This commit is contained in:
parent
9ffbf7ac3c
commit
c06889b3c5
4 changed files with 16 additions and 2 deletions
|
@ -68,6 +68,11 @@
|
||||||
<value type="vec4d"><use>position</use></value>
|
<value type="vec4d"><use>position</use></value>
|
||||||
<positioned type="bool">true</positioned>
|
<positioned type="bool">true</positioned>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>Ambient</name>
|
||||||
|
<type>float-vec4</type>
|
||||||
|
<value type="vec4d"><use>ambient</use></value>
|
||||||
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>Diffuse</name>
|
<name>Diffuse</name>
|
||||||
<type>float-vec4</type>
|
<type>float-vec4</type>
|
||||||
|
|
|
@ -74,6 +74,11 @@
|
||||||
<value type="vec4d"><use>direction</use></value>
|
<value type="vec4d"><use>direction</use></value>
|
||||||
<positioned type="bool">true</positioned>
|
<positioned type="bool">true</positioned>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>Ambient</name>
|
||||||
|
<type>float-vec4</type>
|
||||||
|
<value type="vec4d"><use>ambient</use></value>
|
||||||
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>Diffuse</name>
|
<name>Diffuse</name>
|
||||||
<type>float-vec4</type>
|
<type>float-vec4</type>
|
||||||
|
|
|
@ -6,6 +6,7 @@ uniform sampler2D normal_tex;
|
||||||
uniform sampler2D color_tex;
|
uniform sampler2D color_tex;
|
||||||
uniform sampler2D spec_emis_tex;
|
uniform sampler2D spec_emis_tex;
|
||||||
uniform vec4 LightPosition;
|
uniform vec4 LightPosition;
|
||||||
|
uniform vec4 Ambient;
|
||||||
uniform vec4 Diffuse;
|
uniform vec4 Diffuse;
|
||||||
uniform vec4 Specular;
|
uniform vec4 Specular;
|
||||||
uniform vec3 Attenuation;
|
uniform vec3 Attenuation;
|
||||||
|
@ -46,8 +47,9 @@ void main() {
|
||||||
float nDotHV = max(0.0, dot(normal, halfVector));
|
float nDotHV = max(0.0, dot(normal, halfVector));
|
||||||
|
|
||||||
vec4 color = texture2D( color_tex, coords );
|
vec4 color = texture2D( color_tex, coords );
|
||||||
|
vec4 Iamb = Ambient * color * att;
|
||||||
vec4 Idiff = Diffuse * color * att * nDotVP;
|
vec4 Idiff = Diffuse * color * att * nDotVP;
|
||||||
vec3 Ispec = pow( nDotHV, spec_emis.y ) * spec_emis.x * att * Specular.rgb;
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ uniform sampler2D color_tex;
|
||||||
uniform sampler2D spec_emis_tex;
|
uniform sampler2D spec_emis_tex;
|
||||||
uniform vec4 LightPosition;
|
uniform vec4 LightPosition;
|
||||||
uniform vec4 LightDirection;
|
uniform vec4 LightDirection;
|
||||||
|
uniform vec4 Ambient;
|
||||||
uniform vec4 Diffuse;
|
uniform vec4 Diffuse;
|
||||||
uniform vec4 Specular;
|
uniform vec4 Specular;
|
||||||
uniform vec3 Attenuation;
|
uniform vec3 Attenuation;
|
||||||
|
@ -58,8 +59,9 @@ void main() {
|
||||||
float nDotHV = max(0.0, dot(normal, halfVector));
|
float nDotHV = max(0.0, dot(normal, halfVector));
|
||||||
|
|
||||||
vec4 color = texture2D( color_tex, coords );
|
vec4 color = texture2D( color_tex, coords );
|
||||||
|
vec4 Iamb = Ambient * color * att;
|
||||||
vec4 Idiff = Diffuse * color * att * nDotVP;
|
vec4 Idiff = Diffuse * color * att * nDotVP;
|
||||||
vec3 Ispec = pow( nDotHV, spec_emis.y ) * spec_emis.x * att * Specular.rgb;
|
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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue