Skip to content
Browse files

Cleanup

  • Loading branch information...
1 parent 0ff997b commit 432ce5602530b989bb9359c8690962933d8d7628 @stegu stegu committed Mar 26, 2011
Showing with 15 additions and 14 deletions.
  1. +15 −14 src/noise2D.glsl
View
29 src/noise2D.glsl
@@ -10,37 +10,37 @@
float simplexNoise(vec2 v)
{
- const vec2 C = vec2(0.211324865405187134, // (3.0-sqrt(3.0))/6.;
- 0.366025403784438597); // 0.5*(sqrt(3.0)-1.);
- const vec3 D = vec3( 0., 0.5, 2.0) * 3.14159265358979312;
+ const vec2 C = vec2(0.211324865405187134, // (3.0-sqrt(3.0))/6.0;
+ 0.366025403784438597); // 0.5*(sqrt(3.0)-1.0);
+ const vec3 D = vec3( 0.0, 0.5, 2.0) * 3.14159265358979312;
// First corner
vec2 i = floor(v + dot(v, C.yy) );
vec2 x0 = v - i + dot(i, C.xx);
// Other corners
vec2 i1;
i1.x = float( (x0.x>x0.y) );
- i1.y = 1. - i1.x;
+ i1.y = 1.0 - i1.x;
- // x0 = x0 - 0. + 0. * C.xx ;
- // x1 = x0 - i1 + 1. * C.xx ;
- // x2 = x0 - 1. + 2. * C.xx ;
+ // x0 = x0 - 0.0 + 0.0 * C.xx ;
+ // x1 = x0 - i1 + 1.0 * C.xx ;
+ // x2 = x0 - 1.0 + 2.0 * C.xx ;
- vec4 xC = x0.xyxy + vec4( C.xx, -1. + 2.* C.xx);
+ vec4 xC = x0.xyxy + vec4( C.xx, -1.0 + 2.0 * C.xx);
xC.xy -= i1;
// Permutations
i = mod(i, pParam.x);
vec3 p = permute( permute(
- i.y + vec3(0., i1.y, 1. ), pParam.xyz)
- + i.x + vec3(0., i1.x, 1. ), pParam.xyz);
+ i.y + vec3(0.0, i1.y, 1.0 ), pParam.xyz)
+ + i.x + vec3(0.0, i1.x, 1.0 ), pParam.xyz);
- vec3 m = max(0.5 - vec3(dot(x0,x0), dot(xC.xy,xC.xy), dot(xC.zw,xC.zw)), 0.);
+ vec3 m = max(0.5 - vec3(dot(x0,x0), dot(xC.xy,xC.xy), dot(xC.zw,xC.zw)), 0.0);
m = m*m ;
m = m*m ;
#ifndef USE_CIRCLE
// ( N points uniformly over a line, mapped onto a diamond.)
- vec3 x = 2.0 * fract(p / pParam.w) - 1. ;
+ vec3 x = 2.0 * fract(p / pParam.w) - 1.0 ;
vec3 h = abs(x) - 0.5 ;
vec3 ox = floor(x+0.5);
@@ -61,14 +61,15 @@ float simplexNoise(vec2 v)
g.x = a0.x * x0.x + h.x * x0.y;
g.yz = a0.yz * xC.xz + h.yz * xC.yw;
- return 160.0 * dot(m, g);
#else
// N points around a unit circle.
vec3 phi = D.z * mod(p,pParam.w) /pParam.w ;
vec4 a0 = sin(phi.xxyy+D.xyxy);
vec2 a1 = sin(phi.zz +D.xy);
// mix
vec3 g = vec3( dot(a0.xy, x0), dot(a0.zw, xC.xy), dot(a1.xy, xC.zw) );
- return 160.0 * dot(m, g);
#endif
+
+ return 160.0 * dot(m, g);
+
}

0 comments on commit 432ce56

Please sign in to comment.
Something went wrong with that request. Please try again.