Namespaces | |
Back | |
Bounce | |
Circ | |
Cubic | |
Elastic | |
Expo | |
Linear | |
Quad | |
Quart | |
Quint | |
Sine | |
Classes | |
class | BaseSmoothOperator |
class | Box |
struct | FComplex |
class | FCurve |
struct | FCurvePoint |
class | Rect |
class | SmoothOperator |
Typedefs | |
using | FloatFComplex = FComplex< float, float > |
using | Vec2FComplex = FComplex< float, glm::vec2 > |
using | Vec3FComplex = FComplex< float, glm::vec3 > |
using | Vec4FComplex = FComplex< float, glm::vec4 > |
using | FloatFCurve = FCurve< float, float > |
using | Vec2FCurve = FCurve< float, glm::vec2 > |
using | Vec3FCurve = FCurve< float, glm::vec3 > |
using | Vec4FCurve = FCurve< float, glm::vec4 > |
using | FloatFCurvePoint = FCurvePoint< float, float > |
using | Vec2FCurvePoint = FCurvePoint< float, glm::vec2 > |
using | Vec3FCurvePoint = FCurvePoint< float, glm::vec3 > |
using | Vec4FCurvePoint = FCurvePoint< float, glm::vec4 > |
using | FloatSmoothOperator = SmoothOperator< float > |
using | DoubleSmoothOperator = SmoothOperator< double > |
using | Vec2SmoothOperator = SmoothOperator< glm::vec2 > |
using | Vec3SmoothOperator = SmoothOperator< glm::vec3 > |
using | Vec4SmoothOperator = SmoothOperator< glm::vec4 > |
Enumerations | |
enum | ECurveInterp : int { Bezier = 0, Linear, Stepped } |
enum | EWaveform : int { SINE = 0, SQUARE, SAW, TRIANGLE } |
Functions | |
template<typename T > | |
void | getValueAlongLine (const std::vector< T > &vertexData, float location, bool closed, T &outValue) |
template<typename T > | |
int | resampleLine (std::vector< T > &vertices, std::vector< T > &buffer, int segments, bool closed) |
float NAPAPI | getDistancesAlongLine (const std::vector< glm::vec3 > &vertexPositions, std::map< float, int > &outDistances, bool loop) |
float NAPAPI | getVertexLerpValue (const std::map< float, int > &distanceMap, float location, int &outMinVertex, int &outMaxVertex) |
template<typename T > | |
void | getValueAlongLine (const std::map< float, int > &distanceMap, const std::vector< T > &vertexData, float location, T &outValue) |
void NAPAPI | getNormalAlongLine (const std::map< float, int > &distanceMap, const std::vector< glm::vec3 > &vertexNormals, float location, glm::vec3 &outNormal) |
template<typename T > | |
T | fit (T value, T min, T max, T outMin, T outMax) |
template<typename T > | |
T | lerp (const T &start, const T &end, float percent) |
template<typename T > | |
T | clamp (T value, T min, T max) |
template<typename T > | |
T | min (T left, T right) |
template<typename T > | |
T | max (T left, T right) |
template<typename T > | |
T | floor (T value) |
template<typename T > | |
T | ceil (T value) |
template<typename T > | |
T | power (T value, T exp) |
template<typename T > | |
T | smoothStep (T value, T edge0, T edge1) |
template<typename T > | |
T | abs (T value) |
template<typename T > | |
constexpr T | epsilon () |
template<typename T > | |
constexpr T | max () |
template<typename T > | |
constexpr T | min () |
template<typename T > | |
T | sign (T value) |
template<typename T > | |
T | bell (T time, T strength) |
template<typename T > | |
T | random (T min, T max) |
void NAPAPI | setRandomSeed (int value) |
template<typename T > | |
T NAPAPI | smoothDamp (T currentValue, T targetValue, T ¤tVelocity, float deltaTime, float smoothTime, float maxSpeed=math::max< float >()) |
template<typename T > | |
void NAPAPI | smooth (T ¤tValue, const T &targetValue, T ¤tVelocity, float deltaTime, float smoothTime, float maxSpeed) |
glm::mat4 NAPAPI | composeMatrix (const glm::vec3 &translate, const glm::quat &rotate, const glm::vec3 &scale) |
glm::quat NAPAPI | eulerToQuat (const glm::vec3 &eulerAngle) |
glm::quat NAPAPI | eulerToQuat (float roll, float pitch, float yaw) |
glm::vec3 NAPAPI | radians (const glm::vec3 &eulerDegrees) |
glm::vec3 NAPAPI | radians (float roll, float pitch, float yaw) |
float NAPAPI | radians (float degrees) |
float NAPAPI | degrees (float radians) |
glm::vec3 NAPAPI | extractPosition (const glm::mat4x4 &matrix) |
glm::vec3 NAPAPI | objectToWorld (const glm::vec3 &point, const glm::mat4x4 &objectToWorldMatrix) |
glm::vec3 NAPAPI | worldToObject (const glm::vec3 &point, const glm::mat4x4 &objectToWorldMatrix) |
std::string NAPAPI | generateUUID () |
template<> | |
NAPAPI float | lerp< float > (const float &start, const float &end, float percent) |
template<> | |
NAPAPI double | lerp< double > (const double &start, const double &end, float percent) |
template<> | |
NAPAPI glm::vec2 | lerp< glm::vec2 > (const glm::vec2 &start, const glm::vec2 &end, float percent) |
template<> | |
NAPAPI glm::vec3 | lerp< glm::vec3 > (const glm::vec3 &start, const glm::vec3 &end, float percent) |
template<> | |
NAPAPI glm::vec4 | lerp< glm::vec4 > (const glm::vec4 &start, const glm::vec4 &end, float percent) |
template<> | |
NAPAPI float | power< float > (float value, float exp) |
template<> | |
NAPAPI double | power< double > (double value, double exp) |
template<> | |
NAPAPI int | power< int > (int value, int exp) |
template<> | |
NAPAPI void | smooth (float ¤tValue, const float &targetValue, float ¤tVelocity, float deltaTime, float smoothTime, float maxSpeed) |
template<> | |
NAPAPI void | smooth (double ¤tValue, const double &targetValue, double ¤tVelocity, float deltaTime, float smoothTime, float maxSpeed) |
template<> | |
NAPAPI void | smooth (glm::vec2 ¤tValue, const glm::vec2 &targetValue, glm::vec2 ¤tVelocity, float deltaTime, float smoothTime, float maxSpeed) |
template<> | |
NAPAPI void | smooth (glm::vec3 ¤tValue, const glm::vec3 &targetValue, glm::vec3 ¤tVelocity, float deltaTime, float smoothTime, float maxSpeed) |
template<> | |
NAPAPI void | smooth (glm::vec4 ¤tValue, const glm::vec4 &targetValue, glm::vec4 ¤tVelocity, float deltaTime, float smoothTime, float maxSpeed) |
template<> | |
NAPAPI uint | random (uint min, uint max) |
template<> | |
NAPAPI int | random (int min, int max) |
template<> | |
NAPAPI float | random (float min, float max) |
template<> | |
NAPAPI glm::vec3 | random (glm::vec3 min, glm::vec3 max) |
template<> | |
NAPAPI glm::vec4 | random (glm::vec4 min, glm::vec4 max) |
template<> | |
NAPAPI glm::vec2 | random (glm::vec2 min, glm::vec2 max) |
template<> | |
NAPAPI glm::ivec2 | random (glm::ivec2 min, glm::ivec2 max) |
template<> | |
NAPAPI glm::ivec3 | random (glm::ivec3 min, glm::ivec3 max) |
template<> | |
NAPAPI glm::ivec4 | random (glm::ivec4 min, glm::ivec4 max) |
template<> | |
NAPAPI glm::mat4 | random (glm::mat4 min, glm::mat4 max) |
template<> | |
NAPAPI float | abs (float value) |
template<> | |
NAPAPI int | abs (int value) |
template<typename T > | |
T | darken (T target, T blend) |
template<typename T > | |
T | multiply (T target, T blend) |
template<typename T > | |
T | colorBurn (T target, T blend) |
template<typename T > | |
T | linearBurn (T target, T blend) |
template<typename T > | |
T | lighten (T target, T blend) |
template<typename T > | |
T | screen (T target, T blend) |
template<typename T > | |
T | colorDodge (T target, T blend) |
template<typename T > | |
T | linearDodge (T target, T blend) |
template<typename T > | |
T | overlay (T target, T blend) |
template<typename T > | |
T | softLight (T target, T blend) |
template<typename T > | |
T | hardLight (T target, T blend) |
template<typename T > | |
T | vividLight (T target, T blend) |
template<typename T > | |
T | linearLight (T target, T blend) |
template<typename T > | |
T | pinLight (T target, T blend) |
template<typename T > | |
T | difference (T target, T blend) |
template<typename T > | |
T | exclusion (T target, T blend) |
float NAPAPI | waveform (EWaveform type, float time, float frequency) |
Variables | |
constexpr double | E = 2.71828182845904523536 |
constexpr double | LOG2E = 1.44269504088896340736 |
constexpr double | LOG10E = 0.434294481903251827651 |
constexpr double | LN2 = 0.693147180559945309417 |
constexpr double | LN10 = 2.30258509299404568402 |
constexpr double | PI = 3.14159265358979323846 |
constexpr double | PIX2 = 6.28318530717958647692 |
constexpr double | PI_2 = 1.57079632679489661923 |
constexpr double | PI_4 = 0.785398163397448309616 |
constexpr double | M1_PI = 0.318309886183790671538 |
constexpr double | M2_PI = 0.636619772367581343076 |
constexpr double | M2_SQRTPI = 1.12837916709551257390 |
constexpr double | SQRT2 = 1.41421356237309504880 |
constexpr double | SQRT1_2 = 0.707106781186547524401 |
constexpr glm::vec3 | X_AXIS = { 1.0f, 0.0f, 0.0f } |
constexpr glm::vec3 | Y_AXIS = { 0.0f, 1.0f, 0.0f } |
constexpr glm::vec3 | Z_AXIS = { 0.0f, 0.0f, 1.0f } |
constexpr glm::vec3 | FORWARD = { 0.0f, 0.0f, -1.0f } |
using DoubleSmoothOperator = SmoothOperator<double> |
using FloatFComplex = FComplex<float, float> |
using FloatFCurve = FCurve<float, float> |
using FloatFCurvePoint = FCurvePoint<float, float> |
using FloatSmoothOperator = SmoothOperator<float> |
using Vec2FComplex = FComplex<float, glm::vec2> |
using Vec2FCurve = FCurve<float, glm::vec2> |
using Vec2FCurvePoint = FCurvePoint<float, glm::vec2> |
using Vec2SmoothOperator = SmoothOperator<glm::vec2> |
using Vec3FComplex = FComplex<float, glm::vec3> |
using Vec3FCurve = FCurve<float, glm::vec3> |
using Vec3FCurvePoint = FCurvePoint<float, glm::vec3> |
using Vec3SmoothOperator = SmoothOperator<glm::vec3> |
using Vec4FComplex = FComplex<float, glm::vec4> |
using Vec4FCurve = FCurve<float, glm::vec4> |
using Vec4FCurvePoint = FCurvePoint<float, glm::vec4> |
using Vec4SmoothOperator = SmoothOperator<glm::vec4> |
|
strong |
Possible interpolations per curve segment
Enumerator | |
---|---|
Bezier | Bezier style interpolation. |
Linear | Linear style interpolation. |
Stepped | Stepped interpolated (hold previous value until next curve point. |
|
strong |
NAPAPI float nap::math::abs | ( | float | value | ) |
NAPAPI int nap::math::abs | ( | int | value | ) |
T nap::math::abs | ( | T | value | ) |
T bell | ( | T | time, |
T | strength | ||
) |
time | sample value, from 0-1. |
strength | exponent of the bell curve |
T ceil | ( | T | value | ) |
Rounds value upward, returning the smallest integral value that is not less than x. For example: 2.3 -> 3.0, -2.3 -> 2.0
value | value to ceil |
T clamp | ( | T | value, |
T | min, | ||
T | max | ||
) |
Clamp a value between min and max. The value will never exceed max parameter or fall below min.
value | value to clamp. |
min | lower limit of value. |
max | upper limit of value. |
T colorBurn | ( | T | target, |
T | blend | ||
) |
T colorDodge | ( | T | target, |
T | blend | ||
) |
Color Dodge
Non-Commutative
target | Base value |
blend | Value to combine with |
glm::mat4 NAPAPI nap::math::composeMatrix | ( | const glm::vec3 & | translate, |
const glm::quat & | rotate, | ||
const glm::vec3 & | scale | ||
) |
Composes a 4x4 matrix based on individual transformation, rotation and scale values
translate | a vector describing the objects position |
rotate | quaternion describing the objects rotation |
scale | a vector describing the objects scale |
T darken | ( | T | target, |
T | blend | ||
) |
Darken
Commutative
target | Base value |
blend | Value to combine with |
float NAPAPI nap::math::degrees | ( | float | radians | ) |
Converts radians to degrees.
radians | angle in radians |
T difference | ( | T | target, |
T | blend | ||
) |
Difference
Commutative
target | Base value |
blend | Value to combine with |
|
constexpr |
Returns the machine epsilon, that is, the difference between 1.0 and the next value representable by the floating-point type T. Only works for non-integral types.
glm::quat NAPAPI nap::math::eulerToQuat | ( | const glm::vec3 & | eulerAngle | ) |
Converts euler angles in to a quaternion The euler angle axis are interpreted as: roll(x), pitch(y), yaw(z),
eulerAngle | the individual euler angles in radians |
glm::quat NAPAPI nap::math::eulerToQuat | ( | float | roll, |
float | pitch, | ||
float | yaw | ||
) |
Converts euler angles in to a quaternion The euler angle axis are interpreted as: roll(x), pitch(y), yaw(z),
roll | the x axis rotation value in radians |
pitch | the y axis rotation value in radians |
yaw | the z axis rotation value in radians |
T exclusion | ( | T | target, |
T | blend | ||
) |
Exclusion
Commutative
target | Base value |
blend | Value to combine with |
glm::vec3 NAPAPI nap::math::extractPosition | ( | const glm::mat4x4 & | matrix | ) |
Extracts the position component from a 4x4 matrix. This call assumes the matrix is column major, the outermost array dimension is a column.
matrix | column major matrix |
T fit | ( | T | value, |
T | min, | ||
T | max, | ||
T | outMin, | ||
T | outMax | ||
) |
Maps a value from min/max to outMin/outMax. For example: fit<float>(10.0f, 0.0f, 20.0f, 100.0f, 200.0f) -> returns 150.0f. Input is clamped, ensuring output is always in outMin and outMax range.
value | the value to map |
min | the min input value |
max | the max input value |
outMin | min output value |
outMax | max output value |
T floor | ( | T | value | ) |
Rounds value downward, returning the largest integral value that is not greater than value. For example: 2.3 -> 2.0, -3.8 -> -4.0
value | value to floor. |
std::string NAPAPI nap::math::generateUUID | ( | ) |
Generate a UUID4, random every time, based on host device and random distribution
float NAPAPI nap::math::getDistancesAlongLine | ( | const std::vector< glm::vec3 > & | vertexPositions, |
std::map< float, int > & | outDistances, | ||
bool | loop | ||
) |
Utility function to retrieve distances along a line This function will calculate the distance of a vertex along the line based on the total length of that line The distance map allows you to easily retrieve the closest vertex associated with a certain distance
vertexPositions | the vertex position data |
outDistances | a map that has a distance entry for every vertex of the line |
loop | if the last vertex should be connected to the first vertex, creating a loop |
void NAPAPI nap::math::getNormalAlongLine | ( | const std::map< float, int > & | distanceMap, |
const std::vector< glm::vec3 > & | vertexNormals, | ||
float | location, | ||
glm::vec3 & | outNormal | ||
) |
Utility function that returns the interpolated normal value along a line This function accurately blends a normal based on the position of a vertex on the line Note that normals with a length of 0 will result in an invalid normal as we can't rotate along a normal with no value
distanceMap | the per vertex line distance map that can be acquired using the getDistancesAlongLine function |
vertexNormals | the normal data associated with a line |
location | parametric normalized location along the spline, this value needs to be within the 0-1 range |
outNormal | the interpolated normal |
void getValueAlongLine | ( | const std::map< float, int > & | distanceMap, |
const std::vector< T > & | vertexData, | ||
float | location, | ||
T & | outValue | ||
) |
Utility function that returns an interpolated attribute value along a line This function is more accurate but requires an extra step to perform the interpolation
distanceMap | the per vertex line distance map that can be acquired using the getDistancesAlongLine() function |
vertexData | the polyline attribute to sample |
location | parametric normalized location along the spline, this value needs to be within the 0-1 range |
outValue | the interpolated attribute value |
void getValueAlongLine | ( | const std::vector< T > & | vertexData, |
float | location, | ||
bool | closed, | ||
T & | outValue | ||
) |
Returns an interpolated value along the line based on the given location Note that this function works best with equally distributed vertices, ie: segments of equal length. For more accurate results use the getDistancesAlongLine() function, based on actual distance.
vertexData | the polyline attribute to sample, ie position, normal etc. |
location | parametric normalized (0-1) location along the spline |
closed | if the line is closed or not |
outValue | the interpolated attribute value |
float NAPAPI nap::math::getVertexLerpValue | ( | const std::map< float, int > & | distanceMap, |
float | location, | ||
int & | outMinVertex, | ||
int & | outMaxVertex | ||
) |
Utility function that returns a normalized blend value between two line vertices based on a position along the line
distanceMap | the per vertex line distance map that can be acquired using the getDistancesAlongLine() function |
location | parametric normalized location along the spline, this value needs to be within the 0-1 range |
outMinVertex | the lower bound vertex id |
outMaxVertex | the upper bound vertex id |
T hardLight | ( | T | target, |
T | blend | ||
) |
Hard Light
Non-Commutative
target | Base value |
blend | Value to combine with |
T nap::math::lerp | ( | const T & | start, |
const T & | end, | ||
float | percent | ||
) |
Blends a value between start and end value based on percentage (0-1).
start | begin value |
end | end value |
percent | the amount to blend between start and end, in between 0 and 1. |
NAPAPI double nap::math::lerp< double > | ( | const double & | start, |
const double & | end, | ||
float | percent | ||
) |
NAPAPI float nap::math::lerp< float > | ( | const float & | start, |
const float & | end, | ||
float | percent | ||
) |
NAPAPI glm::vec2 nap::math::lerp< glm::vec2 > | ( | const glm::vec2 & | start, |
const glm::vec2 & | end, | ||
float | percent | ||
) |
NAPAPI glm::vec3 nap::math::lerp< glm::vec3 > | ( | const glm::vec3 & | start, |
const glm::vec3 & | end, | ||
float | percent | ||
) |
NAPAPI glm::vec4 nap::math::lerp< glm::vec4 > | ( | const glm::vec4 & | start, |
const glm::vec4 & | end, | ||
float | percent | ||
) |
T lighten | ( | T | target, |
T | blend | ||
) |
Lighten
Commutative
target | Base value |
blend | Value to combine with |
T linearBurn | ( | T | target, |
T | blend | ||
) |
T linearDodge | ( | T | target, |
T | blend | ||
) |
T linearLight | ( | T | target, |
T | blend | ||
) |
Linear Light
Non-Commutative
target | Base value |
blend | Value to combine with |
|
constexpr |
T max | ( | T | left, |
T | right | ||
) |
Returns the highest of 2 values.
left | first value. |
right | second value. |
|
constexpr |
T min | ( | T | left, |
T | right | ||
) |
Returns the lowest of 2 values.
left | first value. |
right | second value. |
T multiply | ( | T | target, |
T | blend | ||
) |
Multiply
Commutative
target | Base value |
blend | Value to combine with |
glm::vec3 NAPAPI nap::math::objectToWorld | ( | const glm::vec3 & | point, |
const glm::mat4x4 & | objectToWorldMatrix | ||
) |
Converts a point in object space to world space using the given object to world matrix.
point | the point in object space |
objectToWorldMatrix | local to world space transformation matrix |
T overlay | ( | T | target, |
T | blend | ||
) |
Overlay
Non-Commutative
target | Base value |
blend | Value to combine with |
T pinLight | ( | T | target, |
T | blend | ||
) |
Pin Light
Non-Commutative
target | Base value |
blend | Value to combine with |
T nap::math::power | ( | T | value, |
T | exp | ||
) |
value | parameter to raise. |
exp | power exponent. |
NAPAPI double nap::math::power< double > | ( | double | value, |
double | exp | ||
) |
NAPAPI float nap::math::power< float > | ( | float | value, |
float | exp | ||
) |
NAPAPI int nap::math::power< int > | ( | int | value, |
int | exp | ||
) |
glm::vec3 NAPAPI nap::math::radians | ( | const glm::vec3 & | eulerDegrees | ) |
Converts an euler rotation in degrees to radians
eulerDegrees | the euler rotation roll(x), pitch(y), yaw(z) in degrees |
float NAPAPI nap::math::radians | ( | float | degrees | ) |
Converts degrees to radians.
degrees | angle in degrees |
glm::vec3 NAPAPI nap::math::radians | ( | float | roll, |
float | pitch, | ||
float | yaw | ||
) |
Converts an euler rotation in degrees to radians The arguments are interpreted as floats
roll | the x axis rotation in degrees |
pitch | the y axis rotation in degrees |
yaw | the z axis rotation in degrees |
NAPAPI float nap::math::random | ( | float | min, |
float | max | ||
) |
NAPAPI glm::ivec2 nap::math::random | ( | glm::ivec2 | min, |
glm::ivec2 | max | ||
) |
NAPAPI glm::ivec3 nap::math::random | ( | glm::ivec3 | min, |
glm::ivec3 | max | ||
) |
NAPAPI glm::ivec4 nap::math::random | ( | glm::ivec4 | min, |
glm::ivec4 | max | ||
) |
NAPAPI glm::mat4 nap::math::random | ( | glm::mat4 | min, |
glm::mat4 | max | ||
) |
NAPAPI glm::vec2 nap::math::random | ( | glm::vec2 | min, |
glm::vec2 | max | ||
) |
NAPAPI glm::vec3 nap::math::random | ( | glm::vec3 | min, |
glm::vec3 | max | ||
) |
NAPAPI glm::vec4 nap::math::random | ( | glm::vec4 | min, |
glm::vec4 | max | ||
) |
NAPAPI int nap::math::random | ( | int | min, |
int | max | ||
) |
T nap::math::random | ( | T | min, |
T | max | ||
) |
Returns a random number of type T in the range of the given min / max value. Note that the random number is based on the seed set by setRandomSeed.
min | min random number |
max | max random number |
int resampleLine | ( | std::vector< T > & | vertices, |
std::vector< T > & | buffer, | ||
int | segments, | ||
bool | closed | ||
) |
Utility function to up-sample a polyline to the given number of segments This function distributes the vertices equally among every segment, something that is not desirable with more uneven, complex lines A weighted distribution method is preferred but for now this will do.
vertices | the original mesh vertices |
buffer | the buffer that will hold the re-sampled vertices |
segments | the amount of segments the poly line should have, a segment is the line between two vertices |
closed | if the line is closed or not, if a line is not closed it will contain one extra point to maintain the last vertex |
T screen | ( | T | target, |
T | blend | ||
) |
Screen
Commutative
target | Base value |
blend | Value to combine with |
void NAPAPI nap::math::setRandomSeed | ( | int | value | ) |
Sets the seed for all subsequent random calls.
value | the new seed value |
T sign | ( | T | value | ) |
value | requested sign value |
NAPAPI void nap::math::smooth | ( | double & | currentValue, |
const double & | targetValue, | ||
double & | currentVelocity, | ||
float | deltaTime, | ||
float | smoothTime, | ||
float | maxSpeed | ||
) |
NAPAPI void nap::math::smooth | ( | float & | currentValue, |
const float & | targetValue, | ||
float & | currentVelocity, | ||
float | deltaTime, | ||
float | smoothTime, | ||
float | maxSpeed | ||
) |
NAPAPI void nap::math::smooth | ( | glm::vec2 & | currentValue, |
const glm::vec2 & | targetValue, | ||
glm::vec2 & | currentVelocity, | ||
float | deltaTime, | ||
float | smoothTime, | ||
float | maxSpeed | ||
) |
NAPAPI void nap::math::smooth | ( | glm::vec3 & | currentValue, |
const glm::vec3 & | targetValue, | ||
glm::vec3 & | currentVelocity, | ||
float | deltaTime, | ||
float | smoothTime, | ||
float | maxSpeed | ||
) |
NAPAPI void nap::math::smooth | ( | glm::vec4 & | currentValue, |
const glm::vec4 & | targetValue, | ||
glm::vec4 & | currentVelocity, | ||
float | deltaTime, | ||
float | smoothTime, | ||
float | maxSpeed | ||
) |
void NAPAPI nap::math::smooth | ( | T & | currentValue, |
const T & | targetValue, | ||
T & | currentVelocity, | ||
float | deltaTime, | ||
float | smoothTime, | ||
float | maxSpeed | ||
) |
Smoothly interpolates a value of type T over time to a target using a dampening model. The smoothTime argument is the expected time in seconds to reach the target assuming the current value changes at maximum velocity. This is a specialization of the default smoothDamp() function.
currentValue | the current blend value, will be updated after calling |
targetValue | the value to blend to |
currentVelocity | the current velocity used to blend to target |
deltaTime | time in seconds between cooks |
smoothTime | approximately the time it will take to reach the target in seconds. A smaller value will reach the target faster. |
maxSpeed | allows you to clamp the maximum speed |
T NAPAPI nap::math::smoothDamp | ( | T | currentValue, |
T | targetValue, | ||
T & | currentVelocity, | ||
float | deltaTime, | ||
float | smoothTime, | ||
float | maxSpeed = math::max< float >() |
||
) |
Interpolates a float value over time to a targetValue using a dampening model The smoothTime argument is the expected time in seconds to reach the targetValue assuming the currentValue value changes at maximum currentVelocity. The weights of this function are tuned for the range 0-1. Based on Chapter 1.10 of "Game Programming Gems 4".
currentValue | the current blend value, often the return value |
targetValue | the value to blend to |
currentVelocity | the current velocity used to blend to target |
deltaTime | time in seconds between cooks |
smoothTime | approximately the time it will take to reach the target in seconds. A smaller value will reach the target faster. |
maxSpeed | allows you to clamp the maximum speed |
T smoothStep | ( | T | value, |
T | edge0, | ||
T | edge1 | ||
) |
Smoothly interpolates, using a Hermite polynomial, between 0 and 1
value | value to interpolate |
edge0 | returns 0 if input is less than this value |
edge1 | returns 1 if input is higher than this value |
T softLight | ( | T | target, |
T | blend | ||
) |
Soft Light
Non-Commutative
target | Base value |
blend | Value to combine with |
T vividLight | ( | T | target, |
T | blend | ||
) |
Vivid Light
Non-Commutative
target | Base value |
blend | Value to combine with |
float NAPAPI nap::math::waveform | ( | EWaveform | type, |
float | time, | ||
float | frequency | ||
) |
type | the waveform type to query |
time | point in time to sample the waveform |
frequency | the waveform frequency |
glm::vec3 NAPAPI nap::math::worldToObject | ( | const glm::vec3 & | point, |
const glm::mat4x4 & | objectToWorldMatrix | ||
) |
Converts a point in world space to a point in object space using the given object to world matrix Note that this call internally uses matrix inversion, a rather costly operation
point | in world space |
objectToWorldMatrix | the object to world transformation matrix |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |