Permalink
Browse files

Forgot to add 'kludge' to 3D case. fixed.

  • Loading branch information...
1 parent d907d3d commit 2b4faf3ad05910c664bd421659967eb6a4c4794f ijm committed Mar 21, 2011
Showing with 9 additions and 7 deletions.
  1. +9 −7 noise.glsl
View
16 noise.glsl
@@ -8,8 +8,8 @@
// Distributed under the Artistic License 2.0; See LICENCE file.
//
-#define NORMALIZE_GRADIENTS
-#undef USE_CIRCLE
+#define NORMALIZE_GRADIENTS
+#undef USE_CIRCLE
#define COLLAPSE_SORTNET
float permute(float x0,vec3 p) {
@@ -111,10 +111,12 @@ float simplexNoise3(vec3 v)
vec3 i2 = max( g.xyz, l.zxy);
#else
// Keeping this clean - let the compiler optimize.
+// Force existance of strict total ordering in sort.
+ vec3 q0 = floor(x0 * 1024.0) + vec3( 0., 1./4., 2./4.);
vec3 q1;
- q1.x = max(x0.x, x0.y);
- q1.y = min(x0.x, x0.y);
- q1.z = x0.z;
+ q1.x = max(q0.x, q0.y);
+ q1.y = min(q0.x, q0.y);
+ q1.z = q0.z;
vec3 q2;
q2.x = max(q1.x,q1.z);
@@ -126,8 +128,8 @@ float simplexNoise3(vec3 v)
q3.z = min(q2.y, q2.z);
q3.x = q2.x;
- vec3 i1 = vec3(equal(q3.xxx, x0));
- vec3 i2 = i1 + vec3(equal(q3.yyy, x0));
+ vec3 i1 = vec3(lessThanEqual(q3.xxx, q0));
+ vec3 i2 = vec3(lessThanEqual(q3.yyy, q0));
#endif
// x0 = x0 - 0. + 0. * C

0 comments on commit 2b4faf3

Please sign in to comment.