|
Infinity Engine v0.6.20
C++ API Documentation
|
Interpolated gradient for smoothly transitioning between values. More...
#include <Ramp.hpp>
Public Member Functions | |
| Ramp ()=default | |
| Default constructor. | |
| std::unique_ptr< Core::Base > | clone () const override |
| Ramp (std::vector< Stop< T > > inputStops, Interpolation interp=Interpolation::Linear) | |
| Constructs a ramp from a vector of stops. | |
| bool | operator== (const Ramp< T > &other) const |
| Equality comparison operator. | |
| bool | operator!= (const Ramp< T > &other) const |
| Inequality comparison operator. | |
| const Infinity::Types::TypeID & | typeId () const override |
| Gets the runtime type identifier for this Ramp<T> specialization. | |
| T | sample (float position) const |
| Samples the ramp at a given position. | |
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 | |
| std::vector< Stop< T > > | stops |
| Collection of control points defining the ramp. | |
| Interpolation | interpolation = Interpolation::Linear |
| Interpolation method used between stops. | |
Public Attributes inherited from Infinity::Types::Core::Data | |
| std::unordered_map< std::string, PropertyValue > | properties |
| Property storage for arbitrary metadata. | |
Interpolated gradient for smoothly transitioning between values.
Ramp provides a one-dimensional interpolation curve defined by a series of control points (Stops). It enables smooth transitions between values across a parameter range, with support for both linear and cubic interpolation.
Ramps are fundamental to procedural generation, providing control over:
The ramp automatically sorts stops by position and clamps sampling to the range defined by the first and last stops. Values between stops are interpolated using the specified interpolation method.
Example usage:
| T | The type of value to interpolate (float, Vector2, Vector3, Vector4). |
|
default |
Default constructor.
Creates an empty ramp with linear interpolation.
|
inline |
Constructs a ramp from a vector of stops.
Creates a ramp with the specified stops and interpolation method. Stops are automatically sorted by position.
| inputStops | Vector of stops defining the ramp. |
| interp | Interpolation method to use (default: Linear). |
|
inlineoverridevirtual |
Reimplemented from Infinity::Types::Core::Data.
|
inline |
Inequality comparison operator.
| other | The ramp to compare against. |
|
inline |
Equality comparison operator.
Two ramps are equal if they have the same stops (in the same order) and the same interpolation method.
| other | The ramp to compare against. |
|
inline |
Samples the ramp at a given position.
Evaluates the ramp at the specified position, interpolating between stops using the configured interpolation method. The behavior depends on the position relative to the stop range:
| position | The position to sample at (typically 0-1, but any value is valid). |
|
inlineoverridevirtual |
Gets the runtime type identifier for this Ramp<T> specialization.
Reimplemented from Infinity::Types::Core::Data.
| Interpolation Infinity::Types::Math::Ramp< T >::interpolation = Interpolation::Linear |
Interpolation method used between stops.
Determines how values are interpolated between control points:
| std::vector<Stop<T> > Infinity::Types::Math::Ramp< T >::stops |
Collection of control points defining the ramp.
Stops should be added in any order; they will be automatically sorted by position. Each stop defines a value at a specific position along the parameter axis.