2011-01-20 11:02:39 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2011-01-20 11:40:14 +00:00
|
|
|
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
2011-01-20 11:02:39 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Created : 2010-09-16
|
2011-05-07 17:12:03 +00:00
|
|
|
// Updated : 2011-05-07
|
2011-01-20 11:02:39 +00:00
|
|
|
// Licence : This source is under MIT licence
|
2011-05-07 17:12:03 +00:00
|
|
|
// File : test/gtc/matrix_access.cpp
|
2011-01-20 11:02:39 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <glm/glm.hpp>
|
2011-05-07 17:12:03 +00:00
|
|
|
#include <glm/gtc/matrix_access.hpp>
|
|
|
|
|
|
|
|
int test_mat4x4_row_get()
|
|
|
|
{
|
|
|
|
int Error = 0;
|
|
|
|
|
2011-05-07 20:38:41 +00:00
|
|
|
glm::mat4 m(1);
|
2011-05-07 17:12:03 +00:00
|
|
|
|
2011-05-07 20:38:41 +00:00
|
|
|
glm::vec4 A = glm::row(m, 0);
|
|
|
|
Error += A == glm::vec4(1, 0, 0, 0) ? 0 : 1;
|
|
|
|
glm::vec4 B = glm::row(m, 0);
|
|
|
|
Error += B == glm::vec4(0, 1, 0, 0) ? 0 : 1;
|
|
|
|
glm::vec4 C = glm::row(m, 0);
|
|
|
|
Error += C == glm::vec4(0, 0, 1, 0) ? 0 : 1;
|
|
|
|
glm::vec4 D = glm::row(m, 0);
|
|
|
|
Error += D == glm::vec4(0, 0, 0, 1) ? 0 : 1;
|
2011-05-07 17:12:03 +00:00
|
|
|
|
|
|
|
return Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_mat4x4_col_get()
|
|
|
|
{
|
|
|
|
int Error = 0;
|
|
|
|
|
2011-05-07 20:38:41 +00:00
|
|
|
glm::mat4 m(1);
|
2011-05-07 17:12:03 +00:00
|
|
|
|
2011-05-07 20:38:41 +00:00
|
|
|
glm::vec4 A = glm::column(m, 0);
|
|
|
|
Error += A == glm::vec4(1, 0, 0, 0) ? 0 : 1;
|
|
|
|
glm::vec4 B = glm::column(m, 0);
|
|
|
|
Error += B == glm::vec4(0, 1, 0, 0) ? 0 : 1;
|
|
|
|
glm::vec4 C = glm::column(m, 0);
|
|
|
|
Error += C == glm::vec4(0, 0, 1, 0) ? 0 : 1;
|
|
|
|
glm::vec4 D = glm::column(m, 0);
|
|
|
|
Error += D == glm::vec4(0, 0, 0, 1) ? 0 : 1;
|
2011-05-07 17:12:03 +00:00
|
|
|
|
|
|
|
return Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_mat4x4_row_set()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_mat4x4_col_set()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2011-01-20 11:02:39 +00:00
|
|
|
|
2011-01-24 15:44:14 +00:00
|
|
|
int main()
|
2011-01-20 11:02:39 +00:00
|
|
|
{
|
2011-05-07 17:12:03 +00:00
|
|
|
int Error = 0;
|
2011-01-20 11:02:39 +00:00
|
|
|
|
2011-05-07 17:12:03 +00:00
|
|
|
Error += test_mat4x4_row_get();
|
|
|
|
Error += test_mat4x4_col_set();
|
|
|
|
Error += test_mat4x4_row_set();
|
|
|
|
Error += test_mat4x4_col_set();
|
|
|
|
|
|
|
|
return Error;
|
2011-01-20 11:02:39 +00:00
|
|
|
}
|