Adds scalar multiplication for all types
This commit is contained in:
@@ -40,6 +40,7 @@ glmCreateTestGTC(gtx_quaternion)
|
||||
glmCreateTestGTC(gtx_dual_quaternion)
|
||||
glmCreateTestGTC(gtx_rotate_normalized_axis)
|
||||
glmCreateTestGTC(gtx_rotate_vector)
|
||||
glmCreateTestGTC(gtx_scalar_multiplication)
|
||||
glmCreateTestGTC(gtx_scalar_relational)
|
||||
glmCreateTestGTC(gtx_simd_vec4)
|
||||
glmCreateTestGTC(gtx_simd_mat4)
|
||||
|
||||
32
test/gtx/gtx_scalar_multiplication.cpp
Normal file
32
test/gtx/gtx_scalar_multiplication.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2014-09-22
|
||||
// Updated : 2014-09-22
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/gtx_scalar_multiplication.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtx/scalar_multiplication.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
glm::vec3 v(0.5, 3.1, -9.1);
|
||||
|
||||
Error += glm::all(glm::equal(v, 1.0 * v)) ? 0 : 1;
|
||||
Error += glm::all(glm::equal(v, 1 * v)) ? 0 : 1;
|
||||
Error += glm::all(glm::equal(v, 1u * v)) ? 0 : 1;
|
||||
|
||||
glm::mat3 m(1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
glm::vec3 w = 0.5f * m * v;
|
||||
|
||||
Error += glm::all(glm::equal((m*v)/2, w)) ? 0 : 1;
|
||||
Error += glm::all(glm::equal(m*(v/2), w)) ? 0 : 1;
|
||||
Error += glm::all(glm::equal((m/2)*v, w)) ? 0 : 1;
|
||||
Error += glm::all(glm::equal((0.5*m)*v, w)) ? 0 : 1;
|
||||
Error += glm::all(glm::equal(0.5*(m*v), w)) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
Reference in New Issue
Block a user