Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
Fixed MatCap on iOS
Browse files Browse the repository at this point in the history
pow(x) where x < 0 is undefined by spec
  • Loading branch information
vorg committed Oct 12, 2014
1 parent 199d9f9 commit 772146e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/MatCap.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ varying vec3 e;
varying vec3 n;

void main() {
vec3 r = reflect(e, n);
float m = 2.0 * sqrt(
pow(r.x, 2.0) +
pow(r.y, 2.0) +
pow(r.z + 1.0, 2.0)
);
vec3 r = (reflect(e, n));
float m = 2.0 * sqrt(r.x * r.x + r.y * r.y + (r.z + 1.0) * (r.z + 1.0));
vec2 N = r.xy / m + 0.5;
vec3 base = texture2D( texture, N ).rgb;
gl_FragColor = vec4( base, 1.0 );
Expand Down

0 comments on commit 772146e

Please sign in to comment.