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

Add static components and prec members to all vector and quat types #350

Merged
merged 3 commits into from
Jul 18, 2015
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
44 changes: 28 additions & 16 deletions glm/detail/type_mat2x2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -54,11 +54,23 @@ namespace glm
template <typename U, precision Q>
friend tvec2<U, Q> operator/(tvec2<U, Q> const & v, tmat2x2<U, Q> const & m);

# if GLM_HAS_CONSTEXPR
static GLM_CONSTEXPR length_t components = 2;
static GLM_CONSTEXPR length_t cols = 2;
static GLM_CONSTEXPR length_t rows = 2;
static GLM_CONSTEXPR precision prec = P;
# else
static const length_t components = 2;
static const length_t cols = 2;
static const length_t rows = 2;
static const precision prec = P;
# endif

private:
/// @cond DETAIL
col_type value[2];
/// @endcond

public:
//////////////////////////////////////
// Constructors
Expand Down Expand Up @@ -130,23 +142,23 @@ namespace glm

GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<T, P> const & v);

template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<U, P> const & m);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator+=(U s);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator+=(tmat2x2<U, P> const & m);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator-=(U s);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator-=(tmat2x2<U, P> const & m);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator*=(U s);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator*=(tmat2x2<U, P> const & m);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator/=(U s);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator/=(tmat2x2<U, P> const & m);

//////////////////////////////////////
Expand Down Expand Up @@ -191,10 +203,10 @@ namespace glm

template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);

template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat3x2<T, P> const & m2);

template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat4x2<T, P> const & m2);

Expand All @@ -214,7 +226,7 @@ namespace glm
GLM_FUNC_DECL tmat2x2<T, P> operator/(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);

// Unary constant operators
template <typename T, precision P>
template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> const operator-(tmat2x2<T, P> const & m);
} //namespace glm

Expand Down
40 changes: 26 additions & 14 deletions glm/detail/type_mat2x3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -50,11 +50,23 @@ namespace glm
typedef tmat3x2<T, P> transpose_type;
typedef T value_type;

# if GLM_HAS_CONSTEXPR
static GLM_CONSTEXPR length_t components = 2;
static GLM_CONSTEXPR length_t cols = 3;
static GLM_CONSTEXPR length_t rows = 2;
static GLM_CONSTEXPR precision prec = P;
# else
static const length_t components = 2;
static const length_t cols = 3;
static const length_t rows = 2;
static const precision prec = P;
# endif

private:
/// @cond DETAIL
/// @cond DETAIL
col_type value[2];
/// @endcond

public:
// Constructors
GLM_FUNC_DECL tmat2x3();
Expand All @@ -78,7 +90,7 @@ namespace glm
GLM_FUNC_DECL tmat2x3(
X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2);

template <typename U, typename V>
GLM_FUNC_DECL tmat2x3(
tvec3<U, P> const & v1,
Expand Down Expand Up @@ -126,19 +138,19 @@ namespace glm

GLM_FUNC_DECL tmat2x3<T, P> & operator=(tmat2x3<T, P> const & m);

template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator=(tmat2x3<U, P> const & m);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator+=(U s);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator+=(tmat2x3<U, P> const & m);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator-=(U s);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator-=(tmat2x3<U, P> const & m);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator*=(U s);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator/=(U s);

//////////////////////////////////////
Expand Down Expand Up @@ -181,7 +193,7 @@ namespace glm

template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator*(tmat2x3<T, P> const & m1, tmat3x2<T, P> const & m2);

template <typename T, precision P>
GLM_FUNC_DECL tmat4x3<T, P> operator*(tmat2x3<T, P> const & m1, tmat4x2<T, P> const & m2);

Expand Down
40 changes: 26 additions & 14 deletions glm/detail/type_mat2x4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -50,11 +50,23 @@ namespace glm
typedef tmat4x2<T, P> transpose_type;
typedef T value_type;

# if GLM_HAS_CONSTEXPR
static GLM_CONSTEXPR length_t components = 2;
static GLM_CONSTEXPR length_t cols = 4;
static GLM_CONSTEXPR length_t rows = 2;
static GLM_CONSTEXPR precision prec = P;
# else
static const length_t components = 2;
static const length_t cols = 4;
static const length_t rows = 2;
static const precision prec = P;
# endif

private:
/// @cond DETAIL
col_type value[2];
/// @endcond

public:
// Constructors
GLM_FUNC_DECL tmat2x4();
Expand All @@ -68,7 +80,7 @@ namespace glm
T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1);
GLM_FUNC_DECL tmat2x4(
col_type const & v0,
col_type const & v0,
col_type const & v1);

//////////////////////////////////////
Expand Down Expand Up @@ -127,19 +139,19 @@ namespace glm

GLM_FUNC_DECL tmat2x4<T, P> & operator=(tmat2x4<T, P> const & m);

template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P> & operator=(tmat2x4<U, P> const & m);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P> & operator+=(U s);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P> & operator+=(tmat2x4<U, P> const & m);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P> & operator-=(U s);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P> & operator-=(tmat2x4<U, P> const & m);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P> & operator*=(U s);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P> & operator/=(U s);

//////////////////////////////////////
Expand Down Expand Up @@ -179,7 +191,7 @@ namespace glm

template <typename T, precision P>
GLM_FUNC_DECL tmat4x4<T, P> operator*(tmat2x4<T, P> const & m1, tmat4x2<T, P> const & m2);

template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator*(tmat2x4<T, P> const & m1, tmat2x2<T, P> const & m2);

Expand All @@ -189,7 +201,7 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator/(tmat2x4<T, P> const & m, T s);

template <typename T, precision P>
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator/(T s, tmat2x4<T, P> const & m);

// Unary constant operators
Expand Down
40 changes: 26 additions & 14 deletions glm/detail/type_mat3x2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -50,11 +50,23 @@ namespace glm
typedef tmat2x3<T, P> transpose_type;
typedef T value_type;

# if GLM_HAS_CONSTEXPR
static GLM_CONSTEXPR length_t components = 3;
static GLM_CONSTEXPR length_t cols = 2;
static GLM_CONSTEXPR length_t rows = 3;
static GLM_CONSTEXPR precision prec = P;
# else
static const length_t components = 3;
static const length_t cols = 2;
static const length_t rows = 3;
static const precision prec = P;
# endif

private:
/// @cond DETAIL
col_type value[3];
/// @endcond

public:
// Constructors
GLM_FUNC_DECL tmat3x2();
Expand Down Expand Up @@ -84,7 +96,7 @@ namespace glm
X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2,
X3 const & x3, Y3 const & y3);

template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL tmat3x2(
tvec2<V1, P> const & v1,
Expand Down Expand Up @@ -133,19 +145,19 @@ namespace glm

GLM_FUNC_DECL tmat3x2<T, P> & operator=(tmat3x2<T, P> const & m);

template <typename U>
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator=(tmat3x2<U, P> const & m);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator+=(U s);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator+=(tmat3x2<U, P> const & m);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator-=(U s);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator-=(tmat3x2<U, P> const & m);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator*=(U s);
template <typename U>
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator/=(U s);

//////////////////////////////////////
Expand Down Expand Up @@ -184,10 +196,10 @@ namespace glm

template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> operator*(tmat3x2<T, P> const & m1, tmat2x3<T, P> const & m2);

template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat3x2<T, P> const & m1, tmat3x3<T, P> const & m2);

template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat3x2<T, P> const & m1, tmat4x3<T, P> const & m2);

Expand Down
Loading