This commit is contained in:
Shyotl
2013-11-02 01:20:05 -05:00
parent 5e8c7264da
commit af8f8bb040
121 changed files with 8416 additions and 3292 deletions

View File

@@ -37,15 +37,10 @@ VARYING vec2 vary_texcoord0;
uniform float minimum_alpha;
vec3 pack(vec3 norm)
vec2 encode_normal(vec3 n)
{
//#define PACK_NORMALS
#ifdef PACK_NORMALS
float p = sqrt(8.0*norm.z+8.0);
return vec3(norm.xy/p + 0.5, 0.0);
#else
return norm.xyz*0.5+0.5;
#endif
float f = sqrt(8 * n.z + 8);
return n.xy / f + 0.5;
}
void main()
@@ -59,5 +54,5 @@ void main()
frag_data[0] = vec4(vertex_color.rgb*col.rgb, 0.0);
frag_data[1] = vec4(0,0,0,0);
vec3 nvn = normalize(vary_normal);
frag_data[2] = vec4(pack(nvn),0.0);
frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, 0.0);
}