Commit ba856319 authored by Jan Möbius's avatar Jan Möbius

Pass alpha values through shaders to support transparent objects when using these shaders

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3637 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b0974d0a
varying vec4 diffuse;
varying vec4 diffuse_color;
varying vec3 normal;
varying vec4 vertexPosition;
......@@ -21,9 +21,13 @@ vec4 phong_direct(int lightSource) {
if (NdotL > 0.0 && LdotD < 0.0) {
color = gl_LightSource[lightSource].diffuse * -LdotD * NdotL;
}
// Use Alpha Value from original color
color[3] = diffuse_color[3];
return color;
}
void main() {
gl_FragColor = phong_direct(0);
}
\ No newline at end of file
}
varying vec4 diffuse;
varying vec4 diffuse_color;
varying vec3 normal;
varying vec4 vertexPosition;
......@@ -7,5 +7,5 @@ void main()
normal = normalize(gl_NormalMatrix * gl_Normal);
vertexPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = gl_ProjectionMatrix * vertexPosition;
diffuse = gl_FrontMaterial.diffuse;
diffuse_color = gl_FrontMaterial.diffuse;
}
varying vec4 diffuse;
varying vec4 diffuse_color;
varying vec3 normal;
varying vec4 vertexPosition;
uniform float ward_specular;
......@@ -39,6 +39,10 @@ vec4 ward_direct(int lightSource)
color = gl_LightSource[lightSource].diffuse * f_R * G;
}
//use Alpha value from original object color
color[3] = diffuse_color[3];
return color;
}
......
varying vec4 diffuse;
varying vec4 diffuse_color;
varying vec3 normal;
varying vec4 vertexPosition;
uniform float ward_specular;
......@@ -10,5 +10,5 @@ void main()
normal = normalize(gl_NormalMatrix * gl_Normal);
vertexPosition = gl_ModelViewMatrix * gl_Vertex;
gl_Position = gl_ProjectionMatrix * vertexPosition;
diffuse = gl_FrontMaterial.diffuse;
diffuse_color = gl_FrontMaterial.diffuse;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment