Even though the C++ and C# workflows are near-identical, I have split them into two parts for ease of use.
Available in namespace that
Once you start using the library the first thing you need is an instantiation of the Generator class.
This class contains all the logic needed to generate a world.
Methods:
GetHeightMap()
Returns a reference to the heightmap that the generator uses to create worlds.
GetHeight(float x, float y)
Returns the height [0,1] for a given coordinate.
SetSize(float size)
Set the size used by the shape generators.
SetShape(std::unique_ptr<that::shape::WorldShape> shape)
Set the shape used by the generator. If no shape is set, the world generator will generate an infinite world.
The shape needs to be an unique pointer of a class derived from the WorldShape interface.
See WorldShape
AddPredicate(const that::SuccessPredicate& predicate)
Add a predicate that the world generator must meet.
See SuccessPredicate
TryPredicates(int step)
Returns whether the current world meets the needs of the predicates saved in the generator.
The step parameter is the distance between two positions where the predicates will be tested.
Available in namespace that
This class is a wrapper around a list of NoiseMaps. These noisemaps gets blended together to form the final heightmap.
Methods:
AddNoiseMap(const that::NoiseMap& noiseMap)
Add a new noise map to the heightmap.
See NoiseMap
SetBlendMode(that::HeightMap::BlendMode blendMode)
Set the blendmode that will blend the noisemaps together.
Blendmodes available are Multiply, Add and Average.
GetHeight(float x, float y)
Returns the height [0,1] generated by this heightmap.
Available in namespace that
This class is a wrapper around a perlin object and a graph object. Both objects are fully customizable to generate a noisemap to your liking.
Methods:
GetPerlin()
Returns the perlin object that is used in this noisemap.
See PerlinComposition
GetGraph()
Returns the graph object that is used in this noisemap.
See Graph
GetNoise(float x, float y)
Returns the noise value [0,1] for the given coordinate.
Available in namespace that
This class is produces perlin noise depending on the added octaves.
Methods:
AddOctave(float multiplier, float zoom)
Add an octave to this perlin object.
The multiplier describes how much this octave will count toward the total perlin.
The zoom describes how large the perlin will be.
GetNoise(float x, float y)
Returns the noise value [0,1] for the given coordinate.
Available in namespace that
This class acts as a graph between which the nodes are linearly interpolated.
Methods:
AddNode(float x, float y)
Add a node to the graph at the given coordinate.
GetValue(float x)
Returns the mapped value of x on the graph.
Available in namespace that::shape
The interface WorldShape is the base class of all the world shapes.
It only has one method used internally, the Transform method. This transforms a heightmap value using the worldshape.
The WorldShapes in the library are:
CirclePeak
Creates a world shape that is a circle. The heightmap values are usually higher at the center.
SquarePeak
Creates a world shape that is a (rounded) square. The heightmap values are usually higher at the center.
You can create your own worldshapes by creating a class that derives from the WorldShape interface and implements the Transform method.
Available in namespace that::preset
The Presets class contains static methods that will add noisemaps to a given Generator.
Methods:
This class is a wrapper around a std::function with 2 float parameters that returns a bool.
The two float parameters will be two height values that are tested. (usually named height0 and height1)
The return value of this function should be whether or not the predicate succeeded.
Before usage of this library you need to set up the location of the dll file inside the file ProceduralWorldsDll.cs.
There is a string variable called DLL_NAME that needs to be changed to the location of the dll file.
Available in namespace that
Once you start using the library the first thing you need is an instantiation of the Generator class.
This class contains all the logic needed to generate a world.
Properties:
Methods:
GetHeight(float x, float y)
Returns the height [0,1] for a given coordinate.
SetSize(float size)
Set the size used by the shape generators.
SetShape(that.shape.IWorldShape shape)
Set the shape used by the generator. If no shape is set, the world generator will generate an infinite world.
The shape needs to be a class derived from the IWorldShape interface.
See WorldShape
AddPredicate(that.SuccessPredicate predicate)
Add a predicate that the world generator must meet.
See SuccessPredicate
TryPredicates(int step)
Returns whether the current world meets the needs of the predicates saved in the generator.
The step parameter is the distance between two positions where the predicates will be tested.
Available in namespace that
This class is a wrapper around a list of NoiseMaps. These noisemaps gets blended together to form the final heightmap.
THIS CLASS CANNOT BE INSTANTIATED USING NEW To create HeightMap objects that are not connected to any Generator, use the DynamicHeightMap class with the same functionality.
Methods:
AddNoiseMap(that.NoiseMap noiseMap)
Add a new noise map to the heightmap.
See NoiseMap
SetBlendMode(that.HeightMapBlendMode blendMode)
Set the blendmode that will blend the noisemaps together.
Blendmodes available are Multiply, Add and Average.
GetHeight(float x, float y)
Returns the height [0,1] generated by this heightmap.
Available in namespace that
This class is a wrapper around a perlin object and a graph object. Both objects are fully customizable to generate a noisemap to your liking.
Properties:
Perlin
The perlin object that is used in this noisemap.
See PerlinComposition
Graph
The graph object that is used in this noisemap.
See Graph
Methods:
Available in namespace that
This class is produces perlin noise depending on the added octaves.
THIS CLASS CANNOT BE INSTANTIATED USING NEW To create PerlinComposition objects that are not connected to any NoiseMap, use the DynamicPerlinComposition class with the same functionality.
Methods:
AddOctave(float multiplier, float zoom)
Add an octave to this perlin object.
The multiplier describes how much this octave will count toward the total perlin.
The zoom describes how large the perlin will be.
GetNoise(float x, float y)
Returns the noise value [0,1] for the given coordinate.
Available in namespace that
This class acts as a graph between which the nodes are linearly interpolated.
THIS CLASS CANNOT BE INSTANTIATED USING NEW To create Graph objects that are not connected to any NoiseMap, use the DynamicGraph class with the same functionality.
Methods:
AddNode(float x, float y)
Add a node to the graph at the given coordinate.
GetValue(float x)
Returns the mapped value of x on the graph.
Available in namespace that.shape
The interface IWorldShape is the base of all the world shapes.
The WorldShapes in the library are:
CirclePeak
Creates a world shape that is a circle. The heightmap values are usually higher at the center.
SquarePeak
Creates a world shape that is a (rounded) square. The heightmap values are usually higher at the center.
Available in namespace that.preset
The Presets class contains static methods that will add noisemaps to a given Generator.
Methods:
This class is a wrapper around a Func object with 2 float parameters that returns a bool.
The two float parameters will be two height values that are tested. (usually named height0 and height1)
The return value of this function should be whether or not the predicate succeeded.