16-bit, fixed point implementation of Perlin's noise without scaling.
Coordinates are 16.16 fixed point values, 32 bit integers with integral coordinates in the high 16-bits and fractional in the low 16-bits.
- Returns
- unscaled noise value as a signed integer, roughly -18k to 18k
- Parameters
-
x | x-axis coordinate on noise map (1D) |
y | y-axis coordinate on noise map (2D) |
Definition at line 452 of file noise.cpp.
453{
454
457
458
465
466
467 uint16_t u =
x & 0xFFFF;
468 uint16_t v =
y & 0xFFFF;
469
470
471 int16_t xx = (u >> 1) & 0x7FFF;
472 int16_t yy = (v >> 1) & 0x7FFF;
473 uint16_t N = 0x8000L;
474
475 u = EASE16(u); v = EASE16(v);
476
479
480 int16_t ans = LERP(X1,X2,v);
481
482 return ans;
483}
static int16_t grad16(uint8_t hash, int16_t x, int16_t y, int16_t z)
#define NOISE_P(x)
Reads a single byte from the p array.
References grad16(), NOISE_P, x, and y.