Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made various Imath/ header methods inline #42

Merged
merged 2 commits into from
Aug 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions Imath/ImathEuler.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ Euler<T>::toXYZVector() const
}

template <class T>
constexpr Euler<T>::Euler()
constexpr inline Euler<T>::Euler()
: Vec3<T> (0, 0, 0),
_frameStatic (true),
_initialRepeated (false),
Expand All @@ -406,8 +406,7 @@ constexpr Euler<T>::Euler()
{}

template <class T>
IMATH_CONSTEXPR14
Euler<T>::Euler (typename Euler<T>::Order p)
IMATH_CONSTEXPR14 inline Euler<T>::Euler (typename Euler<T>::Order p)
: Vec3<T> (0, 0, 0),
_frameStatic (true),
_initialRepeated (false),
Expand Down Expand Up @@ -875,7 +874,7 @@ Euler<T>::setOrder (typename Euler<T>::Order p)
}

template <class T>
void
inline void
Euler<T>::set (typename Euler<T>::Axis axis, bool relative, bool parityEven, bool firstRepeats)
{
_initialAxis = axis;
Expand All @@ -885,7 +884,7 @@ Euler<T>::set (typename Euler<T>::Axis axis, bool relative, bool parityEven, boo
}

template <class T>
IMATH_CONSTEXPR14 const Euler<T>&
IMATH_CONSTEXPR14 inline const Euler<T>&
Euler<T>::operator= (const Euler<T>& euler)
{
x = euler.x;
Expand All @@ -899,7 +898,7 @@ Euler<T>::operator= (const Euler<T>& euler)
}

template <class T>
IMATH_CONSTEXPR14 const Euler<T>&
IMATH_CONSTEXPR14 inline const Euler<T>&
Euler<T>::operator= (const Vec3<T>& v)
{
x = v.x;
Expand All @@ -926,7 +925,7 @@ operator<< (std::ostream& o, const Euler<T>& euler)
}

template <class T>
IMATH_CONSTEXPR14 float
IMATH_CONSTEXPR14 inline float
Euler<T>::angleMod (T angle)
{
const T pi = static_cast<T> (M_PI);
Expand All @@ -941,7 +940,7 @@ Euler<T>::angleMod (T angle)
}

template <class T>
void
inline void
Euler<T>::simpleXYZRotation (Vec3<T>& xyzRot, const Vec3<T>& targetXyzRot)
{
Vec3<T> d = xyzRot - targetXyzRot;
Expand Down
34 changes: 17 additions & 17 deletions Imath/ImathFrustum.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ template <class T> Frustum<T>::~Frustum()
{}

template <class T>
IMATH_CONSTEXPR14 const Frustum<T>&
IMATH_CONSTEXPR14 inline const Frustum<T>&
Frustum<T>::operator= (const Frustum& f)
{
_nearPlane = f._nearPlane;
Expand All @@ -215,7 +215,7 @@ Frustum<T>::operator= (const Frustum& f)
}

template <class T>
constexpr bool
constexpr inline bool
Frustum<T>::operator== (const Frustum<T>& src) const
{
return _nearPlane == src._nearPlane && _farPlane == src._farPlane && _left == src._left &&
Expand All @@ -231,7 +231,7 @@ Frustum<T>::operator!= (const Frustum<T>& src) const
}

template <class T>
void
inline void
Frustum<T>::set (T n, T f, T l, T r, T t, T b, bool o)
{
_nearPlane = n;
Expand All @@ -244,7 +244,7 @@ Frustum<T>::set (T n, T f, T l, T r, T t, T b, bool o)
}

template <class T>
void
inline void
Frustum<T>::modifyNearAndFar (T n, T f)
{
if (_orthographic)
Expand Down Expand Up @@ -274,14 +274,14 @@ Frustum<T>::modifyNearAndFar (T n, T f)
}

template <class T>
void
inline void
Frustum<T>::setOrthographic (bool ortho)
{
_orthographic = ortho;
}

template <class T>
void
inline void
Frustum<T>::set (T nearPlane, T farPlane, T fovx, T fovy, T aspect)
{
if (fovx != 0 && fovy != 0)
Expand Down Expand Up @@ -309,21 +309,21 @@ Frustum<T>::set (T nearPlane, T farPlane, T fovx, T fovy, T aspect)
}

template <class T>
constexpr T
constexpr inline T
Frustum<T>::fovx() const
{
return Math<T>::atan2 (_right, _nearPlane) - Math<T>::atan2 (_left, _nearPlane);
}

template <class T>
constexpr T
constexpr inline T
Frustum<T>::fovy() const
{
return Math<T>::atan2 (_top, _nearPlane) - Math<T>::atan2 (_bottom, _nearPlane);
}

template <class T>
IMATH_CONSTEXPR14 T
IMATH_CONSTEXPR14 inline T
Frustum<T>::aspect() const
{
T rightMinusLeft = _right - _left;
Expand All @@ -339,7 +339,7 @@ Frustum<T>::aspect() const
}

template <class T>
IMATH_CONSTEXPR14 T
IMATH_CONSTEXPR14 inline T
Frustum<T>::aspect_noexcept() const noexcept
{
T rightMinusLeft = _right - _left;
Expand All @@ -348,7 +348,7 @@ Frustum<T>::aspect_noexcept() const noexcept
}

template <class T>
IMATH_CONSTEXPR14 Matrix44<T>
IMATH_CONSTEXPR14 inline Matrix44<T>
Frustum<T>::projectionMatrix() const
{
T rightPlusLeft = _right + _left;
Expand Down Expand Up @@ -424,7 +424,7 @@ Frustum<T>::projectionMatrix() const
}

template <class T>
IMATH_CONSTEXPR14 Matrix44<T>
IMATH_CONSTEXPR14 inline Matrix44<T>
Frustum<T>::projectionMatrix_noexcept() const noexcept
{
T rightPlusLeft = _right + _left;
Expand Down Expand Up @@ -468,14 +468,14 @@ Frustum<T>::projectionMatrix_noexcept() const noexcept
}

template <class T>
constexpr bool
constexpr inline bool
Frustum<T>::degenerate() const
{
return (_nearPlane == _farPlane) || (_left == _right) || (_top == _bottom);
}

template <class T>
IMATH_CONSTEXPR14 Frustum<T>
IMATH_CONSTEXPR14 inline Frustum<T>
Frustum<T>::window (T l, T r, T t, T b) const
{
// move it to 0->1 space
Expand All @@ -487,15 +487,15 @@ Frustum<T>::window (T l, T r, T t, T b) const
}

template <class T>
constexpr Vec2<T>
constexpr inline Vec2<T>
Frustum<T>::screenToLocal (const Vec2<T>& s) const
{
return Vec2<T> (_left + (_right - _left) * (1.f + s.x) / 2.f,
_bottom + (_top - _bottom) * (1.f + s.y) / 2.f);
}

template <class T>
IMATH_CONSTEXPR14 Vec2<T>
IMATH_CONSTEXPR14 inline Vec2<T>
Frustum<T>::localToScreen (const Vec2<T>& p) const
{
T leftPlusRight = _left - T (2) * p.x + _right;
Expand All @@ -516,7 +516,7 @@ Frustum<T>::localToScreen (const Vec2<T>& p) const
}

template <class T>
IMATH_CONSTEXPR14 Line3<T>
IMATH_CONSTEXPR14 inline Line3<T>
Frustum<T>::projectScreenToRay (const Vec2<T>& p) const
{
Vec2<T> point = screenToLocal (p);
Expand Down
Loading