propane 3.7.1-java → 3.8.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.mvn/extensions.xml +1 -1
- data/CHANGELOG.md +2 -0
- data/README.md +5 -12
- data/lib/propane/app.rb +3 -0
- data/lib/propane/version.rb +1 -1
- data/pom.rb +2 -2
- data/pom.xml +3 -3
- data/propane.gemspec +2 -0
- data/src/main/java/monkstone/fastmath/DegLutTables.java +111 -0
- data/src/main/java/monkstone/fastmath/Deglut.java +6 -56
- data/src/main/java/monkstone/noise/Noise.java +116 -0
- data/src/main/java/monkstone/noise/NoiseGenerator.java +63 -0
- data/src/main/java/monkstone/noise/NoiseMode.java +15 -0
- data/src/main/java/monkstone/noise/SimplexNoise.java +135 -101
- data/src/main/java/monkstone/noise/ValueNoise.java +170 -0
- data/src/main/java/processing/core/PApplet.java +13243 -13354
- data/src/main/java/processing/core/PGraphics.java +2 -2
- data/test/deglut_spec_test.rb +2 -2
- data/vendors/Rakefile +1 -1
- metadata +8 -4
- data/library/simplex_noise/simplex_noise.rb +0 -5
@@ -0,0 +1,63 @@
|
|
1
|
+
/*
|
2
|
+
* To change this license header, choose License Headers in Project Properties.
|
3
|
+
* To change this template file, choose Tools | Templates
|
4
|
+
* and open the template in the editor.
|
5
|
+
*/
|
6
|
+
package monkstone.noise;
|
7
|
+
|
8
|
+
/**
|
9
|
+
*
|
10
|
+
* @author Martin Prout
|
11
|
+
*/
|
12
|
+
public class NoiseGenerator implements Noise {
|
13
|
+
|
14
|
+
private Noise implementation;
|
15
|
+
private NoiseMode mode;
|
16
|
+
|
17
|
+
public NoiseGenerator() {
|
18
|
+
this.implementation = new ValueNoise();
|
19
|
+
this.mode = NoiseMode.PERLIN;
|
20
|
+
}
|
21
|
+
|
22
|
+
public void noiseMode(NoiseMode mode) {
|
23
|
+
if (this.mode != mode && this.mode != NoiseMode.PERLIN) {
|
24
|
+
this.implementation = new ValueNoise();
|
25
|
+
this.mode = NoiseMode.PERLIN;
|
26
|
+
}
|
27
|
+
if (this.mode != mode && this.mode != NoiseMode.SIMPLEX) {
|
28
|
+
this.implementation = new SimplexNoise();
|
29
|
+
this.mode = NoiseMode.SIMPLEX;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
public NoiseMode noiseMode(){
|
34
|
+
return this.mode;
|
35
|
+
}
|
36
|
+
|
37
|
+
@Override
|
38
|
+
public float noise(float x, float y, float z) {
|
39
|
+
return implementation.noise(x, y, z);
|
40
|
+
}
|
41
|
+
|
42
|
+
@Override
|
43
|
+
public float noise(float x, float y, float z, float w) {
|
44
|
+
if (mode == NoiseMode.PERLIN) { return 0.5f;}
|
45
|
+
return implementation.noise(x, y, z, w);
|
46
|
+
}
|
47
|
+
|
48
|
+
@Override
|
49
|
+
public void noiseDetail(int lod) {
|
50
|
+
implementation.noiseDetail(lod);
|
51
|
+
}
|
52
|
+
|
53
|
+
@Override
|
54
|
+
public void noiseDetail(int lod, float falloff) {
|
55
|
+
implementation.noiseDetail(lod, falloff);
|
56
|
+
}
|
57
|
+
|
58
|
+
@Override
|
59
|
+
public void noiseSeed(long seed) {
|
60
|
+
implementation.noiseSeed(seed);
|
61
|
+
}
|
62
|
+
|
63
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* To change this license header, choose License Headers in Project Properties.
|
3
|
+
* To change this template file, choose Tools | Templates
|
4
|
+
* and open the template in the editor.
|
5
|
+
*/
|
6
|
+
package monkstone.noise;
|
7
|
+
|
8
|
+
/**
|
9
|
+
*
|
10
|
+
* @author tux
|
11
|
+
*/
|
12
|
+
public enum NoiseMode {
|
13
|
+
SIMPLEX,
|
14
|
+
PERLIN;
|
15
|
+
}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
package monkstone.noise;
|
2
|
+
|
1
3
|
/*
|
2
4
|
* A speed-improved simplex noise algorithm for 2D, 3D and 4D in Java.
|
3
5
|
*
|
@@ -14,9 +16,9 @@
|
|
14
16
|
* attribution is appreciated.
|
15
17
|
*
|
16
18
|
*/
|
17
|
-
package monkstone.noise;
|
18
19
|
|
19
|
-
|
20
|
+
|
21
|
+
public class SimplexNoise implements Noise{ // Simplex noise in 2D, 3D and 4D
|
20
22
|
|
21
23
|
private static Grad grad3[] = {new Grad(1, 1, 0), new Grad(-1, 1, 0), new Grad(1, -1, 0), new Grad(-1, -1, 0),
|
22
24
|
new Grad(1, 0, 1), new Grad(-1, 0, 1), new Grad(1, 0, -1), new Grad(-1, 0, -1),
|
@@ -56,43 +58,44 @@ public class SimplexNoise { // Simplex noise in 2D, 3D and 4D
|
|
56
58
|
}
|
57
59
|
|
58
60
|
// Skewing and unskewing factors for 2, 3, and 4 dimensions
|
59
|
-
private static final
|
60
|
-
private static final
|
61
|
-
private static final
|
62
|
-
private static final
|
63
|
-
private static final
|
64
|
-
private static final
|
61
|
+
private static final float F2 = 0.5f * (float)(Math.sqrt(3.0) - 1.0);
|
62
|
+
private static final float G2 = (float)(3.0 - Math.sqrt(3.0)) / 6.0f;
|
63
|
+
private static final float F3 = 1.0f / 3.0f;
|
64
|
+
private static final float G3 = 1.0f / 6.0f;
|
65
|
+
private static final float F4 = (float)(Math.sqrt(5.0) - 1.0) / 4.0f;
|
66
|
+
private static final float G4 = (float)(5.0 - Math.sqrt(5.0)) / 20.0f;
|
65
67
|
|
66
68
|
// This method is a *lot* faster than using (int)Math.floor(x)
|
67
|
-
private static int fastfloor(
|
69
|
+
private static int fastfloor(float x) {
|
68
70
|
int xi = (int) x;
|
69
71
|
return x < xi ? xi - 1 : xi;
|
70
72
|
}
|
71
73
|
|
72
|
-
private static
|
74
|
+
private static float dot(Grad g, float x, float y) {
|
73
75
|
return g.x * x + g.y * y;
|
74
76
|
}
|
75
77
|
|
76
|
-
private static
|
78
|
+
private static float dot(Grad g, float x, float y, float z) {
|
77
79
|
return g.x * x + g.y * y + g.z * z;
|
78
80
|
}
|
79
81
|
|
80
|
-
private static
|
82
|
+
private static float dot(Grad g, float x, float y, float z, float w) {
|
81
83
|
return g.x * x + g.y * y + g.z * z + g.w * w;
|
82
84
|
}
|
83
85
|
|
84
86
|
// 2D simplex noise
|
85
|
-
|
86
|
-
|
87
|
+
@Override
|
88
|
+
public float noise(float xin, float yin) {
|
89
|
+
float n0, n1, n2; // Noise contributions from the three corners
|
87
90
|
// Skew the input space to determine which simplex cell we're in
|
88
|
-
|
91
|
+
float s = (xin + yin) * F2; // Hairy factor for 2D
|
89
92
|
int i = fastfloor(xin + s);
|
90
93
|
int j = fastfloor(yin + s);
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
94
|
+
float t = (i + j) * G2;
|
95
|
+
float X0 = i - t; // Unskew the cell origin back to (x,y) space
|
96
|
+
float Y0 = j - t;
|
97
|
+
float x0 = xin - X0; // The x,y distances from the cell origin
|
98
|
+
float y0 = yin - Y0;
|
96
99
|
// For the 2D case, the simplex shape is an equilateral triangle.
|
97
100
|
// Determine which simplex we are in.
|
98
101
|
int i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords
|
@@ -107,10 +110,10 @@ public class SimplexNoise { // Simplex noise in 2D, 3D and 4D
|
|
107
110
|
// A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and
|
108
111
|
// a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where
|
109
112
|
// c = (3-sqrt(3))/6
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
113
|
+
float x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords
|
114
|
+
float y1 = y0 - j1 + G2;
|
115
|
+
float x2 = x0 - 1.0f + 2.0f * G2; // Offsets for last corner in (x,y) unskewed coords
|
116
|
+
float y2 = y0 - 1.0f + 2.0f * G2;
|
114
117
|
// Work out the hashed gradient indices of the three simplex corners
|
115
118
|
int ii = i & 255;
|
116
119
|
int jj = j & 255;
|
@@ -118,47 +121,48 @@ public class SimplexNoise { // Simplex noise in 2D, 3D and 4D
|
|
118
121
|
int gi1 = PERM_MOD_12[ii + i1 + PERM[jj + j1]];
|
119
122
|
int gi2 = PERM_MOD_12[ii + 1 + PERM[jj + 1]];
|
120
123
|
// Calculate the contribution from the three corners
|
121
|
-
|
124
|
+
float t0 = 0.5f - x0 * x0 - y0 * y0;
|
122
125
|
if (t0 < 0) {
|
123
|
-
n0 = 0.
|
126
|
+
n0 = 0.0f;
|
124
127
|
} else {
|
125
128
|
t0 *= t0;
|
126
129
|
n0 = t0 * t0 * dot(grad3[gi0], x0, y0); // (x,y) of grad3 used for 2D gradient
|
127
130
|
}
|
128
|
-
|
131
|
+
float t1 = 0.5f - x1 * x1 - y1 * y1;
|
129
132
|
if (t1 < 0) {
|
130
|
-
n1 = 0.
|
133
|
+
n1 = 0.0f;
|
131
134
|
} else {
|
132
135
|
t1 *= t1;
|
133
136
|
n1 = t1 * t1 * dot(grad3[gi1], x1, y1);
|
134
137
|
}
|
135
|
-
|
138
|
+
float t2 = 0.5f - x2 * x2 - y2 * y2;
|
136
139
|
if (t2 < 0) {
|
137
|
-
n2 = 0.
|
140
|
+
n2 = 0.0f;
|
138
141
|
} else {
|
139
142
|
t2 *= t2;
|
140
143
|
n2 = t2 * t2 * dot(grad3[gi2], x2, y2);
|
141
144
|
}
|
142
145
|
// Add contributions from each corner to get the final noise value.
|
143
146
|
// The result is scaled to return values in the interval [-1,1].
|
144
|
-
return 70.
|
147
|
+
return 70.0f * (n0 + n1 + n2);
|
145
148
|
}
|
146
149
|
|
147
150
|
// 3D simplex noise
|
148
|
-
|
149
|
-
|
151
|
+
@Override
|
152
|
+
public float noise(float xin, float yin, float zin) {
|
153
|
+
float n0, n1, n2, n3; // Noise contributions from the four corners
|
150
154
|
// Skew the input space to determine which simplex cell we're in
|
151
|
-
|
155
|
+
float s = (xin + yin + zin) * F3; // Very nice and simple skew factor for 3D
|
152
156
|
int i = fastfloor(xin + s);
|
153
157
|
int j = fastfloor(yin + s);
|
154
158
|
int k = fastfloor(zin + s);
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
159
|
+
float t = (i + j + k) * G3;
|
160
|
+
float X0 = i - t; // Unskew the cell origin back to (x,y,z) space
|
161
|
+
float Y0 = j - t;
|
162
|
+
float Z0 = k - t;
|
163
|
+
float x0 = xin - X0; // The x,y,z distances from the cell origin
|
164
|
+
float y0 = yin - Y0;
|
165
|
+
float z0 = zin - Z0;
|
162
166
|
// For the 3D case, the simplex shape is a slightly irregular tetrahedron.
|
163
167
|
// Determine which simplex we are in.
|
164
168
|
int i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) coords
|
@@ -218,15 +222,15 @@ public class SimplexNoise { // Simplex noise in 2D, 3D and 4D
|
|
218
222
|
// a step of (0,1,0) in (i,j,k) means a step of (-c,1-c,-c) in (x,y,z), and
|
219
223
|
// a step of (0,0,1) in (i,j,k) means a step of (-c,-c,1-c) in (x,y,z), where
|
220
224
|
// c = 1/6.
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
225
|
+
float x1 = x0 - i1 + G3; // Offsets for second corner in (x,y,z) coords
|
226
|
+
float y1 = y0 - j1 + G3;
|
227
|
+
float z1 = z0 - k1 + G3;
|
228
|
+
float x2 = x0 - i2 + 2.0f * G3; // Offsets for third corner in (x,y,z) coords
|
229
|
+
float y2 = y0 - j2 + 2.0f * G3;
|
230
|
+
float z2 = z0 - k2 + 2.0f * G3;
|
231
|
+
float x3 = x0 - 1.0f + 3.0f * G3; // Offsets for last corner in (x,y,z) coords
|
232
|
+
float y3 = y0 - 1.0f + 3.0f * G3;
|
233
|
+
float z3 = z0 - 1.0f + 3.0f * G3;
|
230
234
|
// Work out the hashed gradient indices of the four simplex corners
|
231
235
|
int ii = i & 255;
|
232
236
|
int jj = j & 255;
|
@@ -236,58 +240,68 @@ public class SimplexNoise { // Simplex noise in 2D, 3D and 4D
|
|
236
240
|
int gi2 = PERM_MOD_12[ii + i2 + PERM[jj + j2 + PERM[kk + k2]]];
|
237
241
|
int gi3 = PERM_MOD_12[ii + 1 + PERM[jj + 1 + PERM[kk + 1]]];
|
238
242
|
// Calculate the contribution from the four corners
|
239
|
-
|
243
|
+
float t0 = 0.5f - x0 * x0 - y0 * y0 - z0 * z0;
|
240
244
|
if (t0 < 0) {
|
241
|
-
n0 = 0.
|
245
|
+
n0 = 0.0f;
|
242
246
|
} else {
|
243
247
|
t0 *= t0;
|
244
248
|
n0 = t0 * t0 * dot(grad3[gi0], x0, y0, z0);
|
245
249
|
}
|
246
|
-
|
250
|
+
float t1 = 0.5f - x1 * x1 - y1 * y1 - z1 * z1;
|
247
251
|
if (t1 < 0) {
|
248
|
-
n1 = 0.
|
252
|
+
n1 = 0.0f;
|
249
253
|
} else {
|
250
254
|
t1 *= t1;
|
251
255
|
n1 = t1 * t1 * dot(grad3[gi1], x1, y1, z1);
|
252
256
|
}
|
253
|
-
|
257
|
+
float t2 = 0.5f - x2 * x2 - y2 * y2 - z2 * z2;
|
254
258
|
if (t2 < 0) {
|
255
|
-
n2 = 0.
|
259
|
+
n2 = 0.0f;
|
256
260
|
} else {
|
257
261
|
t2 *= t2;
|
258
262
|
n2 = t2 * t2 * dot(grad3[gi2], x2, y2, z2);
|
259
263
|
}
|
260
|
-
|
264
|
+
float t3 = 0.5f - x3 * x3 - y3 * y3 - z3 * z3;
|
261
265
|
if (t3 < 0) {
|
262
|
-
n3 = 0.
|
266
|
+
n3 = 0.0f;
|
263
267
|
} else {
|
264
268
|
t3 *= t3;
|
265
269
|
n3 = t3 * t3 * dot(grad3[gi3], x3, y3, z3);
|
266
270
|
}
|
267
271
|
// Add contributions from each corner to get the final noise value.
|
268
272
|
// The result is scaled to stay just inside [-1,1]
|
269
|
-
return 32.
|
273
|
+
return 32.0f * (n0 + n1 + n2 + n3);
|
270
274
|
}
|
271
275
|
|
272
276
|
// 4D simplex noise, better simplex rank ordering method 2012-03-09
|
273
|
-
public static double noise(double x, double y, double z, double w) {
|
274
277
|
|
275
|
-
|
278
|
+
/**
|
279
|
+
*
|
280
|
+
* @param x
|
281
|
+
* @param y
|
282
|
+
* @param z
|
283
|
+
* @param w
|
284
|
+
* @return
|
285
|
+
*/
|
286
|
+
@Override
|
287
|
+
public float noise(float x, float y, float z, float w) {
|
288
|
+
|
289
|
+
float n0, n1, n2, n3, n4; // Noise contributions from the five corners
|
276
290
|
// Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in
|
277
|
-
|
291
|
+
float s = (x + y + z + w) * F4; // Factor for 4D skewing
|
278
292
|
int i = fastfloor(x + s);
|
279
293
|
int j = fastfloor(y + s);
|
280
294
|
int k = fastfloor(z + s);
|
281
295
|
int l = fastfloor(w + s);
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
296
|
+
float t = (i + j + k + l) * G4; // Factor for 4D unskewing
|
297
|
+
float X0 = i - t; // Unskew the cell origin back to (x,y,z,w) space
|
298
|
+
float Y0 = j - t;
|
299
|
+
float Z0 = k - t;
|
300
|
+
float W0 = l - t;
|
301
|
+
float x0 = x - X0; // The x,y,z,w distances from the cell origin
|
302
|
+
float y0 = y - Y0;
|
303
|
+
float z0 = z - Z0;
|
304
|
+
float w0 = w - W0;
|
291
305
|
// For the 4D case, the simplex is a 4D shape I won't even try to describe.
|
292
306
|
// To find out which of the 24 possible simplices we're in, we need to
|
293
307
|
// determine the magnitude ordering of x0, y0, z0 and w0.
|
@@ -348,22 +362,22 @@ public class SimplexNoise { // Simplex noise in 2D, 3D and 4D
|
|
348
362
|
k3 = rankz >= 1 ? 1 : 0;
|
349
363
|
l3 = rankw >= 1 ? 1 : 0;
|
350
364
|
// The fifth corner has all coordinate offsets = 1, so no need to compute that.
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
365
|
+
float x1 = x0 - i1 + G4; // Offsets for second corner in (x,y,z,w) coords
|
366
|
+
float y1 = y0 - j1 + G4;
|
367
|
+
float z1 = z0 - k1 + G4;
|
368
|
+
float w1 = w0 - l1 + G4;
|
369
|
+
float x2 = x0 - i2 + 20.f * G4; // Offsets for third corner in (x,y,z,w) coords
|
370
|
+
float y2 = y0 - j2 + 20.f * G4;
|
371
|
+
float z2 = z0 - k2 + 20.f * G4;
|
372
|
+
float w2 = w0 - l2 + 20.f * G4;
|
373
|
+
float x3 = x0 - i3 + 30.f * G4; // Offsets for fourth corner in (x,y,z,w) coords
|
374
|
+
float y3 = y0 - j3 + 30.f * G4;
|
375
|
+
float z3 = z0 - k3 + 30.f * G4;
|
376
|
+
float w3 = w0 - l3 + 30.f * G4;
|
377
|
+
float x4 = x0 - 1.0f + 40.f * G4; // Offsets for last corner in (x,y,z,w) coords
|
378
|
+
float y4 = y0 - 1.0f + 40.f * G4;
|
379
|
+
float z4 = z0 - 1.0f + 40.f * G4;
|
380
|
+
float w4 = w0 - 1.0f + 40.f * G4;
|
367
381
|
// Work out the hashed gradient indices of the five simplex corners
|
368
382
|
int ii = i & 255;
|
369
383
|
int jj = j & 255;
|
@@ -375,58 +389,78 @@ public class SimplexNoise { // Simplex noise in 2D, 3D and 4D
|
|
375
389
|
int gi3 = PERM[ii + i3 + PERM[jj + j3 + PERM[kk + k3 + PERM[ll + l3]]]] % 32;
|
376
390
|
int gi4 = PERM[ii + 1 + PERM[jj + 1 + PERM[kk + 1 + PERM[ll + 1]]]] % 32;
|
377
391
|
// Calculate the contribution from the five corners
|
378
|
-
|
392
|
+
float t0 = 0.5f - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0;
|
379
393
|
if (t0 < 0) {
|
380
|
-
n0 = 0.
|
394
|
+
n0 = 0.0f;
|
381
395
|
} else {
|
382
396
|
t0 *= t0;
|
383
397
|
n0 = t0 * t0 * dot(grad4[gi0], x0, y0, z0, w0);
|
384
398
|
}
|
385
|
-
|
399
|
+
float t1 = 0.5f - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1;
|
386
400
|
if (t1 < 0) {
|
387
|
-
n1 = 0.
|
401
|
+
n1 = 0.0f;
|
388
402
|
} else {
|
389
403
|
t1 *= t1;
|
390
404
|
n1 = t1 * t1 * dot(grad4[gi1], x1, y1, z1, w1);
|
391
405
|
}
|
392
|
-
|
406
|
+
float t2 = 0.5f - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2;
|
393
407
|
if (t2 < 0) {
|
394
|
-
n2 = 0.
|
408
|
+
n2 = 0.0f;
|
395
409
|
} else {
|
396
410
|
t2 *= t2;
|
397
411
|
n2 = t2 * t2 * dot(grad4[gi2], x2, y2, z2, w2);
|
398
412
|
}
|
399
|
-
|
413
|
+
float t3 = 0.5f - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3;
|
400
414
|
if (t3 < 0) {
|
401
|
-
n3 = 0.
|
415
|
+
n3 = 0.0f;
|
402
416
|
} else {
|
403
417
|
t3 *= t3;
|
404
418
|
n3 = t3 * t3 * dot(grad4[gi3], x3, y3, z3, w3);
|
405
419
|
}
|
406
|
-
|
420
|
+
float t4 = 0.5f - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4;
|
407
421
|
if (t4 < 0) {
|
408
|
-
n4 = 0.
|
422
|
+
n4 = 0.0f;
|
409
423
|
} else {
|
410
424
|
t4 *= t4;
|
411
425
|
n4 = t4 * t4 * dot(grad4[gi4], x4, y4, z4, w4);
|
412
426
|
}
|
413
427
|
// Sum up and scale the result to cover the range [-1,1]
|
414
|
-
return 27.
|
428
|
+
return 27.0f * (n0 + n1 + n2 + n3 + n4);
|
429
|
+
}
|
430
|
+
|
431
|
+
@Override
|
432
|
+
public void noiseDetail(int lod) {
|
433
|
+
|
434
|
+
}
|
435
|
+
|
436
|
+
@Override
|
437
|
+
public void noiseDetail(int lod, float falloff) {
|
438
|
+
|
439
|
+
}
|
440
|
+
|
441
|
+
@Override
|
442
|
+
public void noiseSeed(long seed) {
|
443
|
+
|
444
|
+
}
|
445
|
+
|
446
|
+
@Override
|
447
|
+
public void noiseMode(NoiseMode mode) {
|
448
|
+
|
415
449
|
}
|
416
450
|
|
417
451
|
// Inner class to speed upp gradient computations
|
418
452
|
// (In Java, array access is a lot slower than member access)
|
419
453
|
private static class Grad {
|
420
454
|
|
421
|
-
|
455
|
+
float x, y, z, w;
|
422
456
|
|
423
|
-
Grad(
|
457
|
+
Grad(float x, float y, float z) {
|
424
458
|
this.x = x;
|
425
459
|
this.y = y;
|
426
460
|
this.z = z;
|
427
461
|
}
|
428
462
|
|
429
|
-
Grad(
|
463
|
+
Grad(float x, float y, float z, float w) {
|
430
464
|
this.x = x;
|
431
465
|
this.y = y;
|
432
466
|
this.z = z;
|