![]() |
naev 0.10.4
|
Handles creating noise based on perlin noise. More...
#include "perlin.h"#include "log.h"#include "nfile.h"#include "nstring.h"#include "rng.h"Go to the source code of this file.
Data Structures | |
| struct | perlin_data_t |
| Structure used for generating noise. More... | |
Macros | |
| #define | SIMPLEX_SCALE 0.5f |
| #define | SWAP(a, b, t) (t) = (a); (a) = (b); (b) = (t) |
| #define | FLOOR(a) ((int)(a) - ((a) < 0 && (a) != (int)(a))) |
| #define | NOISE_SIMPLEX_GRADIENT_1D(n, h, x) { float grad; h &= 0xF; grad=1.0f+(h & 7); if ( h & 8 ) grad = -grad; n = grad * x; } |
Functions | |
| perlin_data_t * | noise_new (void) |
| Creates a new perlin noise generator. More... | |
| float | noise_simplex1 (perlin_data_t *pdata, float f[1]) |
| Gets 1D simplex noise for a position. More... | |
| void | noise_delete (perlin_data_t *pdata) |
| Frees some noise data. More... | |
Handles creating noise based on perlin noise.
Code tries to handle basically 2d/3d cases, without much genericness because it needs to be pretty fast. Originally sped up the code from about 20 seconds to 8 seconds per Nebula image with the manual loop unrolling.
Definition in file perlin.c.
| #define NOISE_SIMPLEX_GRADIENT_1D | ( | n, | |
| h, | |||
| x | |||
| ) | { float grad; h &= 0xF; grad=1.0f+(h & 7); if ( h & 8 ) grad = -grad; n = grad * x; } |
| void noise_delete | ( | perlin_data_t * | pdata | ) |
| perlin_data_t * noise_new | ( | void | ) |