blob: 9a189a2173dba618678c1693eb93b65dd6ea7f8d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
void default_scatter(vec3 viewVec, vec3 lightDir);
attribute vec4 materialColor;
attribute vec4 specularColor;
void main()
{
//transform vertex
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
vec4 spec = specularColor;
gl_FrontColor.rgb = calcLightingSpecular(pos, norm, materialColor, spec, gl_Color).rgb;
gl_FrontColor.a = materialColor.a;
gl_TexCoord[2] = spec;
vec3 ref = reflect(pos,norm);
gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
default_scatter(pos.xyz, gl_LightSource[0].position.xyz);
}
|