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

Used macros to allow compilation with C++11 and constexpr #25

Merged
merged 1 commit into from
Jul 16, 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
38 changes: 19 additions & 19 deletions Imath/ImathBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ class Box
// Constructors - an "empty" box is created by default
//-----------------------------------------------------

constexpr Box ();
constexpr Box (const T &point);
constexpr Box (const T &minT, const T &maxT);
IMATH_CONSTEXPR14 Box ();
IMATH_CONSTEXPR14 Box (const T &point);
IMATH_CONSTEXPR14 Box (const T &minT, const T &maxT);

//--------------------
// Operators: ==, !=
Expand Down Expand Up @@ -145,22 +145,22 @@ typedef Box <V3d> Box3d;


template <class T>
constexpr inline Box<T>::Box()
IMATH_CONSTEXPR14 inline Box<T>::Box()
{
makeEmpty();
}


template <class T>
constexpr inline Box<T>::Box (const T &point)
IMATH_CONSTEXPR14 inline Box<T>::Box (const T &point)
{
min = point;
max = point;
}


template <class T>
constexpr inline Box<T>::Box (const T &minT, const T &maxT)
IMATH_CONSTEXPR14 inline Box<T>::Box (const T &minT, const T &maxT)
{
min = minT;
max = maxT;
Expand Down Expand Up @@ -356,9 +356,9 @@ class Box<Vec2<T> >
// Constructors - an "empty" box is created by default
//-----------------------------------------------------

constexpr Box();
constexpr Box (const Vec2<T> &point);
constexpr Box (const Vec2<T> &minT, const Vec2<T> &maxT);
IMATH_CONSTEXPR14 Box();
IMATH_CONSTEXPR14 Box (const Vec2<T> &point);
IMATH_CONSTEXPR14 Box (const Vec2<T> &minT, const Vec2<T> &maxT);

//--------------------
// Operators: ==, !=
Expand Down Expand Up @@ -402,22 +402,22 @@ class Box<Vec2<T> >
// Implementation

template <class T>
constexpr inline Box<Vec2<T> >::Box()
IMATH_CONSTEXPR14 inline Box<Vec2<T> >::Box()
{
makeEmpty();
}


template <class T>
constexpr inline Box<Vec2<T> >::Box (const Vec2<T> &point)
IMATH_CONSTEXPR14 inline Box<Vec2<T> >::Box (const Vec2<T> &point)
{
min = point;
max = point;
}


template <class T>
constexpr inline Box<Vec2<T> >::Box (const Vec2<T> &minT, const Vec2<T> &maxT)
IMATH_CONSTEXPR14 inline Box<Vec2<T> >::Box (const Vec2<T> &minT, const Vec2<T> &maxT)
{
min = minT;
max = maxT;
Expand Down Expand Up @@ -578,7 +578,7 @@ Box<Vec2<T> >::majorAxis() const

if (s[1] > s[major])
major = 1;

return major;
}

Expand All @@ -599,9 +599,9 @@ class Box<Vec3<T> >
// Constructors - an "empty" box is created by default
//-----------------------------------------------------

constexpr Box();
constexpr Box (const Vec3<T> &point);
constexpr Box (const Vec3<T> &minT, const Vec3<T> &maxT);
IMATH_CONSTEXPR14 Box();
IMATH_CONSTEXPR14 Box (const Vec3<T> &point);
IMATH_CONSTEXPR14 Box (const Vec3<T> &minT, const Vec3<T> &maxT);

//--------------------
// Operators: ==, !=
Expand Down Expand Up @@ -646,22 +646,22 @@ class Box<Vec3<T> >


template <class T>
constexpr inline Box<Vec3<T> >::Box()
IMATH_CONSTEXPR14 inline Box<Vec3<T> >::Box()
{
makeEmpty();
}


template <class T>
constexpr inline Box<Vec3<T> >::Box (const Vec3<T> &point)
IMATH_CONSTEXPR14 inline Box<Vec3<T> >::Box (const Vec3<T> &point)
{
min = point;
max = point;
}


template <class T>
constexpr inline Box<Vec3<T> >::Box (const Vec3<T> &minT, const Vec3<T> &maxT)
IMATH_CONSTEXPR14 inline Box<Vec3<T> >::Box (const Vec3<T> &minT, const Vec3<T> &maxT)
{
min = minT;
max = maxT;
Expand Down
14 changes: 7 additions & 7 deletions Imath/ImathBoxAlgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER


template <class T>
constexpr inline T
IMATH_CONSTEXPR14 inline T
clip (const T &p, const Box<T> &box)
{
//
Expand Down Expand Up @@ -118,7 +118,7 @@ closestPointInBox (const T &p, const Box<T> &box)


template <class T>
constexpr Vec3<T>
IMATH_CONSTEXPR14 Vec3<T>
closestPointOnBox (const Vec3<T> &p, const Box< Vec3<T> > &box)
{
//
Expand Down Expand Up @@ -161,7 +161,7 @@ closestPointOnBox (const Vec3<T> &p, const Box< Vec3<T> > &box)


template <class S, class T>
constexpr Box< Vec3<S> >
IMATH_CONSTEXPR14 Box< Vec3<S> >
transform (const Box< Vec3<S> > &box, const Matrix44<T> &m)
{
//
Expand Down Expand Up @@ -324,7 +324,7 @@ transform (const Box< Vec3<S> > &box,


template <class S, class T>
constexpr Box< Vec3<S> >
IMATH_CONSTEXPR14 Box< Vec3<S> >
affineTransform (const Box< Vec3<S> > &box, const Matrix44<T> &m)
{
//
Expand Down Expand Up @@ -434,7 +434,7 @@ affineTransform (const Box< Vec3<S> > &box,


template <class T>
constexpr bool
IMATH_CONSTEXPR14 bool
findEntryAndExitPoints (const Line3<T> &r,
const Box<Vec3<T> > &b,
Vec3<T> &entry,
Expand Down Expand Up @@ -724,7 +724,7 @@ findEntryAndExitPoints (const Line3<T> &r,


template<class T>
constexpr bool
IMATH_CONSTEXPR14 bool
intersects (const Box< Vec3<T> > &b, const Line3<T> &r, Vec3<T> &ip)
{
//
Expand Down Expand Up @@ -1003,7 +1003,7 @@ intersects (const Box< Vec3<T> > &b, const Line3<T> &r, Vec3<T> &ip)


template<class T>
constexpr bool
IMATH_CONSTEXPR14 bool
intersects (const Box< Vec3<T> > &box, const Line3<T> &ray)
{
Vec3<T> ignored;
Expand Down
Loading