SuperTuxKart 1.5 upstream source (from official release tarball)
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// Octahedron Normal Vector
|
||||
|
||||
vec2 OctWrap(vec2 v)
|
||||
{
|
||||
vec2 w = 1.0 - abs( v.yx );
|
||||
if (v.x < 0.0) w.x = -w.x;
|
||||
if (v.y < 0.0) w.y = -w.y;
|
||||
return w;
|
||||
}
|
||||
|
||||
vec2 EncodeNormal(vec3 n)
|
||||
{
|
||||
n /= (abs(n.x) + abs(n.y) + abs(n.z));
|
||||
n.xy = n.z >= 0.0 ? n.xy : OctWrap(n.xy);
|
||||
n.xy = n.xy * 0.5 + 0.5;
|
||||
return n.xy;
|
||||
}
|
||||
Reference in New Issue
Block a user