Basic Usage

All noise generation code is encapsulated into objects called modules. All modules in Luminoise derive from the IModule interface. For more information on the IModule class, and how to create your own modules, see here.

Noise Programs
The class responsible for generating and compiling the OpenCL source code is the NoiseProgram class. It has two constructors - one which takes in an IModule, and another which takes in an additional seed parameter, which is used to select the permutation buffer for generating perlin noise.
NoiseProgram program = new NoiseProgram(myModule);

Before a noise program can be used to generate noise values, it must be compiled. Also, a program must be recompiled after any changes are made to the source module.

To retrieve values from a program, use the GetValues() function. GetValues() takes in an array of Single3 coordinates, and outputs an array of float values - one for each corresponding input coordinate.
float[] values = program.GetValues(input);

After you are done with a program, you must dispose it. This will clean up all OpenCL resources used.

Last edited Sep 13, 2010 at 4:49 AM by YellPika, version 4


No comments yet.