GlsAnimation Library  1.0.6
Provides classes and functions to support animating GL Studio objects programmatically or with script files
Data Structures | Typedefs | Functions | Variables
disti::Detail Namespace Reference

Data Structures

struct  DefaultInterpolator
 
struct  DefaultInterpolator< glsColor >
 Strings aren't interpreted, so they must be gated. More...
 
struct  DefaultInterpolator< GlsQuaternionD >
 Quaterions should be slerped by default. More...
 
struct  DefaultInterpolator< std::string >
 Strings aren't interpreted, so they must be gated. More...
 
struct  enable_if
 Create our own version of <type_traits> meta-function which is not available on all our target platforms. More...
 
struct  enable_if< true, T >
 Create our own version of <type_traits> function which is not available on all our target platforms. More...
 
struct  FloatSelector
 A helper class for choosing the required floating-point type. More...
 
struct  FloatSelector< Vector >
 Vector only handles float arithmetic. Most types can use the default. More...
 
struct  is_convertible
 Replacement for std::is_convertible, adapted from Loki 0.1.7. More...
 
struct  is_convertible< T, T >
 
struct  is_convertible< T, void >
 
struct  is_convertible< void, T >
 
struct  is_convertible< void, void >
 
struct  is_same
 Create our own version of <type_traits> meta-function which is not available on all our target platforms. More...
 
struct  is_same2
 For easier reading, test whether T is either the same type as U or the same as V. More...
 
struct  is_same< T, T >
 Create our own version of <type_traits> meta-function which is not available on all our target platforms. More...
 

Typedefs

typedef unsigned int ID
 Type for unique identifiers. More...
 

Functions

template<class Value >
GlsKeyframeInterpolator< Value >::Ptr CreateSlerp (typename enable_if< is_same2< Value, Vector, GlsQuaternionD >::value >::type *=0)
 
template<class Value >
GlsKeyframeInterpolator< Value >::Ptr CreateSlerp (typename enable_if< !is_same2< Value, Vector, GlsQuaternionD >::value >::type *=0)
 
unsigned char ToColorElement (const double d)
 
bool FloatGreaterThan (const double lhs, const double rhs, const float tolerance=g_glsAnimationFloatTolerance)
 
bool FloatLessThan (const double lhs, const double rhs, const float tolerance=g_glsAnimationFloatTolerance)
 
bool FloatGreaterThanOrEqualTo (const double lhs, const double rhs, const float tolerance=g_glsAnimationFloatTolerance)
 
bool FloatLessThanOrEqualTo (const double lhs, const double rhs, const float tolerance=g_glsAnimationFloatTolerance)
 
bool IsNaN (const double d)
 Detects not-a-number (NaN) More...
 

Variables

const float g_glsAnimationFloatTolerance = 1e-5f
 The tolerance for our floating-point comparisons. More...
 
const double g_pi = 3.14159265358979323846
 Global constant for math. More...
 
const GlsKeyframeCurveBase::Key g_nan = std::numeric_limits<GlsKeyframeCurveBase::Key>::quiet_NaN()
 Constant for not-a-number (NaN) for easier reading. More...
 

Typedef Documentation

typedef unsigned int disti::Detail::ID

Type for unique identifiers.

Definition at line 100 of file gls_keyframe.h.

Function Documentation

template<class Value >
GlsKeyframeInterpolator<Value>::Ptr disti::Detail::CreateSlerp ( typename enable_if< is_same2< Value, Vector, GlsQuaternionD >::value >::type *  = 0)

Returns a slerp for types that support it

Note
The unnamed parameter allows for type overloading via SFINAE. See documentation for std::enable_if.

Definition at line 767 of file gls_animation.h.

768  {
769  return typename GlsKeyframeInterpolator<Value>::Ptr( new GlsSphericalLinearInterpolator<Value>() );
770  }
stdortr1::shared_ptr< GlsKeyframeInterpolator > Ptr
Alias for easier reading.
Definition: gls_keyframe.h:166
template<class Value >
GlsKeyframeInterpolator<Value>::Ptr disti::Detail::CreateSlerp ( typename enable_if< !is_same2< Value, Vector, GlsQuaternionD >::value >::type *  = 0)

Returns a null for types that don't support slerp (see previous function)

Note
The unnamed parameter allows for type overloading via SFINAE. See documentation for std::enable_if.

Definition at line 775 of file gls_animation.h.

776  {
777  std::cerr << "GlsAnimation: Slerp requested for a type that does not support it.\n";
778  return typename GlsKeyframeInterpolator<Value>::Ptr();
779  }
stdortr1::shared_ptr< GlsKeyframeInterpolator > Ptr
Alias for easier reading.
Definition: gls_keyframe.h:166
bool disti::Detail::FloatGreaterThan ( const double  lhs,
const double  rhs,
const float  tolerance = g_glsAnimationFloatTolerance 
)
inline

Compares two floating-point numbers for greater than and fuzzy-not-equal, like lhs > rhs.

Parameters
lhsThe left-hand side
rhsThe right-hand side
toleranceThe floating-point tolerance for the equality check.

Definition at line 128 of file gls_keyframe.h.

129  {
130  return lhs > rhs && !Equal( lhs, rhs, tolerance );
131  }
bool disti::Detail::FloatGreaterThanOrEqualTo ( const double  lhs,
const double  rhs,
const float  tolerance = g_glsAnimationFloatTolerance 
)
inline

Compares two floating-point numbers for greater than or fuzzy-equal, like lhs >= rhs.

Parameters
lhsThe left-hand side
rhsThe right-hand side
toleranceThe floating-point tolerance for the equality check.

Definition at line 146 of file gls_keyframe.h.

147  {
148  return lhs > rhs || Equal( lhs, rhs, tolerance );
149  }
bool disti::Detail::FloatLessThan ( const double  lhs,
const double  rhs,
const float  tolerance = g_glsAnimationFloatTolerance 
)
inline

Compares two floating-point numbers for less than and fuzzy-not-equal, like lhs < rhs.

Parameters
lhsThe left-hand side
rhsThe right-hand side
toleranceThe floating-point tolerance for the equality check.

Definition at line 137 of file gls_keyframe.h.

138  {
139  return lhs < rhs && !Equal( lhs, rhs, tolerance );
140  }
bool disti::Detail::FloatLessThanOrEqualTo ( const double  lhs,
const double  rhs,
const float  tolerance = g_glsAnimationFloatTolerance 
)
inline

Compares two floating-point numbers for less than or fuzzy-equal, like lhs <= rhs.

Parameters
lhsThe left-hand side
rhsThe right-hand side
toleranceThe floating-point tolerance for the equality check.

Definition at line 155 of file gls_keyframe.h.

156  {
157  return lhs < rhs || Equal( lhs, rhs, tolerance );
158  }
bool disti::Detail::IsNaN ( const double  d)
inline

Detects not-a-number (NaN)

Definition at line 1258 of file gls_keyframe.h.

1259  {
1260  #ifdef __FAST_MATH__
1261  // GCC's -ffast-math flag doesn't support d != d checking for NaN, so we have to compare bit patterns
1262  return 0 == std::memcmp( reinterpret_cast<const void*>( &d ), reinterpret_cast<const void*>( &g_nan ), sizeof( double ) );
1263  #else
1264  return d != d;
1265  #endif
1266  }
const GlsKeyframeCurveBase::Key g_nan
Constant for not-a-number (NaN) for easier reading.
unsigned char disti::Detail::ToColorElement ( const double  d)
inline

Converts a double value approximately in the range 0-255 to a clamped unsigned char value that is certainly in that range.

Note
This function may require -ffloat-store on GCC or other platform specific floating-point options

Definition at line 116 of file gls_keyframe.h.

117  {
118  const unsigned int trunc = static_cast<unsigned int>( d + 0.5 );
119  // Extra parens avoid the NOMINMAX problems on Windows
120  return static_cast<unsigned char>( (std::min)( (std::max)( trunc, 0u ), 255u ) );
121  }

Variable Documentation

const float disti::Detail::g_glsAnimationFloatTolerance = 1e-5f

The tolerance for our floating-point comparisons.

Definition at line 103 of file gls_keyframe.h.

const GlsKeyframeCurveBase::Key disti::Detail::g_nan = std::numeric_limits<GlsKeyframeCurveBase::Key>::quiet_NaN()

Constant for not-a-number (NaN) for easier reading.

Definition at line 1254 of file gls_keyframe.h.

const double disti::Detail::g_pi = 3.14159265358979323846

Global constant for math.

Definition at line 106 of file gls_keyframe.h.