Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.
Jordan Peck edited this page Jun 6, 2016 · 10 revisions

#Getting Started Since SIMD functions work by processing multiple values at once this library functions by returning sets of data rather than single values. A set is returned in the form of a pointer to an array of floats.

Example of how to generate a set of data, process it, then free it.

#include "FastNoiseSIMD.h"

FastNoiseSIMD* myNoise = FastNoiseSIMD::NewFastNoiseSIMD();

// Get a set of 16 x 16 x 16 Simplex Fractal noise
float* noiseSet = myNoise->GetSimplexFractalSet(0, 0, 0, 16, 16, 16);    
int index = 0;

for (int x = 0; x < 16; x++)
{
    for (int y = 0; y < 16; y++)
    {
        for (int z = 0; z < 16; z++)
        {
            ProcessVoxelData(x, y, z, noiseSet[index++]);			
        }			
    }
}

FastNoiseSIMD::FreeNoiseSet(noiseSet);

Important note: After including the FastNoise SIMD files in your project set C++ code generation to use /arch:AVX(2) only on FastNoiseSIMD_internal.cpp, or remove "#define FN_COMPILE_AVX2" from FastNoiseSIMD.h to not compile AVX2 support.

Note: The size of the Z dimension in a requested noise set must be a multiple of 8, this is to match the 8 float vectors used in AVX2

More documentation coming soon...

Clone this wiki locally