8000 Fixed: outerProduct defintions and operator signatures for mat2x4 and vec4 by MrApplejuice · Pull Request #475 · g-truc/glm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixed: outerProduct defintions and operator signatures for mat2x4 and vec4 #475

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

Merged
merged 2 commits into from
Mar 5, 2016
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
12 changes: 6 additions & 6 deletions glm/detail/func_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@ namespace detail
template <typename T, precision P>
struct outerProduct_trait<T, P, tvec2, tvec3>
{
typedef tmat2x3<T, P> type;
typedef tmat3x2<T, P> type;
};

template <typename T, precision P>
struct outerProduct_trait<T, P, tvec2, tvec4>
{
typedef tmat2x4<T, P> type;
typedef tmat4x2<T, P> type;
};

template <typename T, precision P>
struct outerProduct_trait<T, P, tvec3, tvec2>
{
typedef tmat3x2<T, P> type;
typedef tmat2x3<T, P> type;
};

template <typename T, precision P>
Expand All @@ -96,19 +96,19 @@ namespace detail
template <typename T, precision P>
struct outerProduct_trait<T, P, tvec3, tvec4>
{
typedef tmat3x4<T, P> type;
typedef tmat4x3<T, P> type;
};

template <typename T, precision P>
struct outerProduct_trait<T, P, tvec4, tvec2>
{
typedef tmat4x2<T, P> type;
typedef tmat2x4<T, P> type;
};

template <typename T, precision P>
struct outerProduct_trait<T, P, tvec4, tvec3>
{
typedef tmat4x3<T, P> type;
typedef tmat3x4<T, P> type;
};

template <typename T, precision P>
Expand Down
2 changes: 1 addition & 1 deletion glm/detail/type_mat2x4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ namespace glm
GLM_FUNC_DECL tmat3x4<T, P> operator*(tmat2x4<T, P> const & m1, tmat3x2<T, P> const & m2);

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

template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator/(T s, tmat2x4<T, P> const & m);
Expand Down
2 changes: 1 addition & 1 deletion glm/detail/type_mat2x4.inl
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ namespace glm
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/(tmat2x4<T, P> const & m, T s)
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/(tmat2x4<T, P> const & m, const T& s)
{
return tmat2x4<T, P>(
m[0] / s,
Expand Down
8 changes: 4 additions & 4 deletions glm/detail/type_vec4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ namespace detail
// -- Binary operators --

template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, T scalar);
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, const T& scalar);

template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
Expand All @@ -394,7 +394,7 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec4<T, P> const & v2);

template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, T scalar);
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, const T& scalar);

template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
Expand All @@ -409,7 +409,7 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v1, tvec4<T, P> const & v2);

template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, T scalar);
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, const T& scalar);

template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
Expand All @@ -424,7 +424,7 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec4<T, P> const & v2);

template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, T scalar);
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, const T& scalar);

template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
Expand Down
8 changes: 4 additions & 4 deletions glm/detail/type_vec4.inl
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ namespace glm
// -- Binary arithmetic operators --

template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator+(tvec4<T, P> const & v, T scalar)
GLM_FUNC_QUALIFIER tvec4<T, P> operator+(tvec4<T, P> const & v, const T& scalar)
{
return tvec4<T, P>(
v.x + scalar,
Expand Down Expand Up @@ -760,7 +760,7 @@ namespace glm
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator-(tvec4<T, P> const & v, T scalar)
GLM_FUNC_QUALIFIER tvec4<T, P> operator-(tvec4<T, P> const & v, const T& scalar)
{
return tvec4<T, P>(
v.x - scalar,
Expand Down Expand Up @@ -790,7 +790,7 @@ namespace glm
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator*(tvec4<T, P> const & v, T scalar)
GLM_FUNC_QUALIFIER tvec4<T, P> operator*(tvec4<T, P> const & v, const T& scalar)
{
return tvec4<T, P>(
v.x * scalar,
Expand Down Expand Up @@ -820,7 +820,7 @@ namespace glm
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator/(tvec4<T, P> const & v, T scalar)
GLM_FUNC_QUALIFIER tvec4<T, P> operator/(tvec4<T, P> const & v, const T& scalar)
{
return tvec4<T, P>(
v.x / scalar,
Expand Down
13 changes: 12 additions & 1 deletion test/core/core_func_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,18 @@ int test_matrixCompMult()

int test_outerProduct()
{
glm::mat4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec4(1.0f));
{ glm::mat2 m = glm::outerProduct(glm::vec2(1.0f), glm::vec2(1.0f)); }
{ glm::mat3 m = glm::outerProduct(glm::vec3(1.0f), glm::vec3(1.0f)); }
{ glm::mat4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec4(1.0f)); }

{ glm::mat2x3 m = glm::outerProduct(glm::vec3(1.0f), glm::vec2(1.0f)); }
{ glm::mat2x4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec2(1.0f)); }

{ glm::mat3x2 m = glm::outerProduct(glm::vec2(1.0f), glm::vec3(1.0f)); }
{ glm::mat3x4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec3(1.0f)); }

{ glm::mat4x2 m = glm::outerProduct(glm::vec2(1.0f), glm::vec4(1.0f)); }
{ glm::mat4x3 m = glm::outerProduct(glm::vec3(1.0f), glm::vec4(1.0f)); }

return 0;
}
Expand Down
0