Open 3D Engine GradientSignal Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
GradientSignal::GradientTransform Class Reference

Public Member Functions

 GradientTransform (const AZ::Aabb &shapeBounds, const AZ::Matrix3x4 &transform, bool use3d, float frequencyZoom, GradientSignal::WrappingType wrappingType)
 
bool operator== (const GradientTransform &rhs) const
 
bool operator!= (const GradientTransform &rhs) const
 
void TransformPositionToUVW (const AZ::Vector3 &inPosition, AZ::Vector3 &outUVW, bool &wasPointRejected) const
 
void TransformPositionToUVWNormalized (const AZ::Vector3 &inPosition, AZ::Vector3 &outUVW, bool &wasPointRejected) const
 
WrappingType GetWrappingType () const
 Return the WrappingType for this GradientTransform.
 
AZ::Aabb GetBounds () const
 
AZ::Vector3 GetScale () const
 Return the scale for this GradientTransform.
 
float GetFrequencyZoom () const
 Return the frequency zoom for this GradientTransform.
 
AZ::Matrix3x4 GetTransformMatrix () const
 Get the transform matrix used by this gradient transform.
 
void GetMinMaxUvwValues (AZ::Vector3 &minUvw, AZ::Vector3 &maxUvw) const
 
void GetMinMaxUvwValuesNormalized (AZ::Vector3 &minUvw, AZ::Vector3 &maxUvw) const
 

Static Public Attributes

static constexpr float UvEpsilon = 0.001f
 

Constructor & Destructor Documentation

◆ GradientTransform()

GradientSignal::GradientTransform::GradientTransform ( const AZ::Aabb &  shapeBounds,
const AZ::Matrix3x4 &  transform,
bool  use3d,
float  frequencyZoom,
GradientSignal::WrappingType  wrappingType 
)

Create a GradientTransform with the given parameters. GradientTransform is a utility class that converts world space positions to gradient space UVW values which can be used to look up deterministic gradient values for the input spatial locations.

Parameters
shapeBoundsThe bounds of the shape associated with the gradient, in local space.
transformThe transform to use to convert from world space to gradient space.
use3dTrue for 3D gradient lookup outputs, false for 2D gradient lookup outputs. (i.e. output W will be nonzero or zero)
frequencyZoomAmount to scale the UVW results after wrapping is applied.
wrappingTypeThe way in which the gradient repeats itself outside the shape bounds.

Member Function Documentation

◆ GetBounds()

AZ::Aabb GradientSignal::GradientTransform::GetBounds ( ) const

Return the AABB bounds for this GradientTransform The bounds that are returned are in the local space of the shape, not world space.

◆ GetMinMaxUvwValues()

void GradientSignal::GradientTransform::GetMinMaxUvwValues ( AZ::Vector3 &  minUvw,
AZ::Vector3 &  maxUvw 
) const

Get the UVW values at the min and max corners of the shape's local bounds.

Parameters
minUvw[output] The UVW values at the min corner of the local bounds.
maxUvw[output] The UVW values at the max corner of the local bounds.

◆ operator!=()

bool GradientSignal::GradientTransform::operator!= ( const GradientTransform rhs) const
inline

Checks to see if two GradientTransform instances aren't equivalent. Useful for being able to send out notifications when a GradientTransform has changed.

Parameters
rhsThe second GradientTranform to compare against.
Returns
True if they're not equal, False if they are.

◆ operator==()

bool GradientSignal::GradientTransform::operator== ( const GradientTransform rhs) const
inline

Checks to see if two GradientTransform instances are equivalent.
Useful for being able to send out notifications when a GradientTransform has changed.

Parameters
rhsThe second GradientTranform to compare against.
Returns
True if they're equal, False if they aren't.

◆ TransformPositionToUVW()

void GradientSignal::GradientTransform::TransformPositionToUVW ( const AZ::Vector3 &  inPosition,
AZ::Vector3 &  outUVW,
bool &  wasPointRejected 
) const

Transform the given world space position to a gradient space UVW lookup value.

Parameters
inPositionThe input world space position to transform.
outUVW[out] The UVW value that can be used to look up a deterministic gradient value.
wasPointRejected[out] True if the input position doesn't have a gradient value, false if it does. Most gradients have values mapped to infinite world space, so wasPointRejected will almost always be false. It will only be true when using ClampToZero and the world space position falls outside the shape bounds.

◆ TransformPositionToUVWNormalized()

void GradientSignal::GradientTransform::TransformPositionToUVWNormalized ( const AZ::Vector3 &  inPosition,
AZ::Vector3 &  outUVW,
bool &  wasPointRejected 
) const

Transform the given world space position to a gradient space UVW lookup value and normalize to the shape bounds. "Normalizing" in this context means that regardless of the world space coordinates, (0,0,0) represents the minimum shape bounds corner, and (1,1,1) represents the maximum shape bounds corner. Depending on the wrapping type, it's possible (and even likely) to get values outside the 0-1 range.

Parameters
inPositionThe input world space position to transform.
outUVW[out] The UVW value that can be used to look up a deterministic gradient value.
wasPointRejected[out] True if the input position doesn't have a gradient value, false if it does. Most gradients have values mapped to infinite world space, so wasPointRejected will almost always be false. It will only be true when using ClampToZero and the world space position falls outside the shape bounds.

Member Data Documentation

◆ UvEpsilon

constexpr float GradientSignal::GradientTransform::UvEpsilon = 0.001f
staticconstexpr

Epsilon value to allow our UVW range to go to [min, max) by using the range [min, max - epsilon]. To keep things behaving consistently between clamped and unbounded uv ranges, we want our clamped uvs to use a range of [min, max), so we'll actually clamp to [min, max - epsilon]. Since our floating-point numbers are likely in the -16384 to 16384 range, an epsilon of 0.001 will work without rounding to 0. (This constant is public so that it can be used from unit tests for validating transformation results)


The documentation for this class was generated from the following file: