|
Infinity Engine v0.6.20
C++ API Documentation
|
Configurable procedural noise generator powered by FastNoise2. More...
#include <Noise.hpp>
Public Member Functions | |
| Noise () | |
| Default constructor. | |
| Noise (const std::string &base64Encoded) | |
| Constructs a noise generator from a base64-encoded node graph. | |
| Noise (const Noise &other) | |
| Copy constructor. | |
| ~Noise () | |
| Destructor. | |
| std::unique_ptr< Core::Base > | clone () const override |
| Noise & | operator= (const Noise &other) |
| Copy assignment operator. | |
| const Infinity::Types::TypeID & | typeId () const override |
| Gets the TypeID for Noise. | |
| void | generate2D (float *out, int xSize, int ySize, int seed) const |
| Generates 2D noise into a pre-allocated float array. | |
| void | generate3D (float *out, int xSize, int ySize, int zSize, int seed) const |
| Generates 3D noise into a pre-allocated float array. | |
| FastNoise::SmartNode & | generator () |
| Gets a reference to the underlying FastNoise2 generator. | |
| const FastNoise::SmartNode & | generator () const |
| Gets a const reference to the underlying FastNoise2 generator. | |
| void | setFromBase64Encoded (const std::string &encoded) |
| Loads a noise configuration from base64-encoded string. | |
| std::string | base64Encoded () const |
| Serializes the noise configuration to base64-encoded string. | |
Public Member Functions inherited from Infinity::Types::Core::Data | |
| Data () | |
| Data (const Data &other) | |
| Data (Data &&other) | |
| Data & | operator= (const Data &other) |
| Data & | operator= (Data &&other) |
| virtual | ~Data () |
| Virtual destructor. | |
| bool | hasProperty (const std::string &key) const |
| template<typename T > | |
| void | setProperty (const std::string &key, T &&value) |
| Sets a typed property value. | |
| template<typename T > | |
| void | setProperty (const std::string &key, const T &value) |
| Sets a typed property value. | |
| void | setProperty (const std::string &key, PropertyValue &&value) |
| Sets a typed property value. | |
| const PropertyValue & | getProperty (const std::string &key) const |
| Gets a property value without type checking. | |
| template<typename T > | |
| const T & | getProperty (const std::string &key) const |
| Gets a typed property value. | |
| void | removeProperty (const std::string &key) |
Public Member Functions inherited from Infinity::Types::Core::Base | |
| virtual | ~Base () |
| Virtual destructor. | |
| virtual std::istream & | legibleDataRead (std::istream &in) override |
| Deserializes the object from a single-line text representation. | |
| virtual std::ostream & | legibleDataWrite (std::ostream &out) const override |
| Serializes the object to a single-line text representation. | |
Public Attributes | |
| Math::Vector3 | position |
| Offset position for noise sampling. | |
| float | frequency = 0.02f |
| Base frequency for noise generation. | |
Public Attributes inherited from Infinity::Types::Core::Data | |
| std::unordered_map< std::string, PropertyValue > | properties |
| Property storage for arbitrary metadata. | |
Configurable procedural noise generator powered by FastNoise2.
Noise provides an interface to FastNoise2's node-based noise generation system, encapsulating a complete noise graph that can generate coherent pseudo-random values in 2D and 3D space. The noise configuration is created using the embedded FastNoiseTool interface in the Infinity Creator and stored as base64-encoded strings.
FastNoise2 supports a wide variety of noise algorithms and operations:
Noise configurations are created visually in the Infinity Creator and exported as base64-encoded node graphs, enabling:
Common use cases in procedural generation:
Example usage:
| Infinity::Types::Procedural::Noise::Noise | ( | ) |
Default constructor.
Creates an empty noise generator. You must configure the generator by calling setFromBase64Encoded() with a configuration exported from the Infinity Creator.
| Infinity::Types::Procedural::Noise::Noise | ( | const std::string & | base64Encoded | ) |
Constructs a noise generator from a base64-encoded node graph.
Deserializes a FastNoise2 node graph from base64 encoding exported from the Infinity Creator's FastNoiseTool interface.
| base64Encoded | Base64-encoded FastNoise2 node graph string. |
| Infinity::Types::Procedural::Noise::Noise | ( | const Noise & | other | ) |
Copy constructor.
Creates a deep copy of the noise generator, including the complete node graph configuration.
| other | Noise generator to copy from. |
| Infinity::Types::Procedural::Noise::~Noise | ( | ) |
Destructor.
| std::string Infinity::Types::Procedural::Noise::base64Encoded | ( | ) | const |
Serializes the noise configuration to base64-encoded string.
Exports the complete FastNoise2 node graph as a base64-encoded string. This can be saved and later loaded back into the Infinity Creator or used to recreate the same noise configuration.
|
overridevirtual |
Reimplemented from Infinity::Types::Core::Data.
| void Infinity::Types::Procedural::Noise::generate2D | ( | float * | out, |
| int | xSize, | ||
| int | ySize, | ||
| int | seed | ||
| ) | const |
Generates 2D noise into a pre-allocated float array.
Fills the output array with noise values sampled across a 2D grid. Uses the stored position offset and frequency for sampling.
| out | Output array of size xSize * ySize (row-major order). |
| xSize | Width of the output grid. |
| ySize | Height of the output grid. |
| seed | Random seed for deterministic generation. |
| void Infinity::Types::Procedural::Noise::generate3D | ( | float * | out, |
| int | xSize, | ||
| int | ySize, | ||
| int | zSize, | ||
| int | seed | ||
| ) | const |
Generates 3D noise into a pre-allocated float array.
Fills the output array with noise values sampled across a 3D grid. Uses the stored position offset and frequency for sampling.
| out | Output array of size xSize * ySize * zSize. |
| xSize | Width of the output grid (X dimension). |
| ySize | Height of the output grid (Y dimension). |
| zSize | Depth of the output grid (Z dimension). |
| seed | Random seed for deterministic generation. |
| FastNoise::SmartNode & Infinity::Types::Procedural::Noise::generator | ( | ) |
Gets a reference to the underlying FastNoise2 generator.
Provides access to the FastNoise2 SmartNode for advanced usage with FastNoise2's API. This allows direct use of FastNoise2's comprehensive generation methods beyond the convenience functions provided by this class.
| const FastNoise::SmartNode & Infinity::Types::Procedural::Noise::generator | ( | ) | const |
Gets a const reference to the underlying FastNoise2 generator.
Copy assignment operator.
| other | Noise generator to copy from. |
| void Infinity::Types::Procedural::Noise::setFromBase64Encoded | ( | const std::string & | encoded | ) |
Loads a noise configuration from base64-encoded string.
Deserializes and sets the noise generator from a base64-encoded FastNoise2 node graph exported from the Infinity Creator. This is the primary method for configuring the noise generator.
| encoded | Base64-encoded FastNoise2 node graph string. |
|
overridevirtual |
Reimplemented from Infinity::Types::Core::Data.
| float Infinity::Types::Procedural::Noise::frequency = 0.02f |
Base frequency for noise generation.
Controls the scale of noise features - lower values create larger, broader features; higher values create smaller, more detailed features. This is a multiplier applied to input coordinates.
Typical values:
Default: 0.02f
| Math::Vector3 Infinity::Types::Procedural::Noise::position |
Offset position for noise sampling.
3D offset applied to sampling coordinates, allowing the same noise configuration to generate different regions. Useful for:
Default: (0, 0, 0) - no offset