From 47c9476452825c357d0055fe603138fd0545628b Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 7 May 2011 18:12:03 +0100 Subject: [PATCH] Added matrix_access test --- test/gtc/gtc_matrix_access.cpp | 62 ++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 6 deletions(-) diff --git a/test/gtc/gtc_matrix_access.cpp b/test/gtc/gtc_matrix_access.cpp index 0b9bc908..ab726a3c 100644 --- a/test/gtc/gtc_matrix_access.cpp +++ b/test/gtc/gtc_matrix_access.cpp @@ -2,18 +2,68 @@ // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2010-09-16 -// Updated : 2010-09-16 +// Updated : 2011-05-07 // Licence : This source is under MIT licence -// File : test/gtc/matrix_transform.cpp +// File : test/gtc/matrix_access.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#define GLM_MESSAGES #include -#include +#include + +int test_mat4x4_row_get() +{ + int Error = 0; + + glm::imat4 m(1); + + glm::ivec4 A = glm::row(m, 0); + Error += A == glm::ivec4(1, 0, 0, 0) ? 0 : 1; + glm::ivec4 B = glm::row(m, 0); + Error += B == glm::ivec4(0, 1, 0, 0) ? 0 : 1; + glm::ivec4 C = glm::row(m, 0); + Error += C == glm::ivec4(0, 0, 1, 0) ? 0 : 1; + glm::ivec4 D = glm::row(m, 0); + Error += D == glm::ivec4(0, 0, 0, 1) ? 0 : 1; + + return Error; +} + +int test_mat4x4_col_get() +{ + int Error = 0; + + glm::imat4 m(1); + + glm::ivec4 A = glm::column(m, 0); + Error += A == glm::ivec4(1, 0, 0, 0) ? 0 : 1; + glm::ivec4 B = glm::column(m, 0); + Error += B == glm::ivec4(0, 1, 0, 0) ? 0 : 1; + glm::ivec4 C = glm::column(m, 0); + Error += C == glm::ivec4(0, 0, 1, 0) ? 0 : 1; + glm::ivec4 D = glm::column(m, 0); + Error += D == glm::ivec4(0, 0, 0, 1) ? 0 : 1; + + return Error; +} + +int test_mat4x4_row_set() +{ + +} + +int test_mat4x4_col_set() +{ + +} int main() { - int Failed = 0; + int Error = 0; - return Failed; + Error += test_mat4x4_row_get(); + Error += test_mat4x4_col_set(); + Error += test_mat4x4_row_set(); + Error += test_mat4x4_col_set(); + + return Error; }