@@ -280,12 +280,14 @@ static int test_shearing()
280
280
glm::vec4 (1 , 1 , 1 , 0 ),
281
281
glm::vec4 (1 , 1 , 0 , 1 ));
282
282
glm::mat4x4 const B4x4 = glm::shear (A4x4, center, l_x, l_y, l_z);
283
+ glm::mat4x4 const C4x4 = glm::shear_slow (A4x4, center, l_x, l_y, l_z);
283
284
glm::mat4x4 const expected (
284
285
glm::vec4 (0 , 0 , 1 , 1 ),
285
- glm::vec4 (2 , 1 , 1 , 0 ),
286
- glm::vec4 (3 , 1 , 1 , 0 ),
287
- glm::vec4 (3 , 1 , 0 , 1 ));
286
+ glm::vec4 (0 , 1 , 3 , 2 ),
287
+ glm::vec4 (1 , 1 , 1 , 0 ),
288
+ glm::vec4 (1 , 1 , 0 , 1 ));
288
289
Error += all (equal (B4x4, expected, epsilon<float >())) ? 0 : 1 ;
290
+ Error += all (equal (C4x4, expected, epsilon<float >())) ? 0 : 1 ;
289
291
}
290
292
291
293
{
@@ -299,12 +301,14 @@ static int test_shearing()
299
301
glm::vec4 (1 , 1 , 1 , 0 ),
300
302
glm::vec4 (1 , 0 , 0 , 0 ));
301
303
glm::mat4x4 const B4x4 = glm::shear (A4x4, center, l_x, l_y, l_z);
304
+ glm::mat4x4 const C4x4 = glm::shear_slow (A4x4, center, l_x, l_y, l_z);
302
305
glm::mat4x4 const expected (
303
- glm::vec4 (0 , 1 , 1 , 0 ),
304
- glm::vec4 (1 , 2 , 1 , 0 ),
305
- glm::vec4 (2 , 2 , 2 , 0 ),
306
- glm::vec4 (1 , 0 , 1 , 0 ));
306
+ glm::vec4 (1 , 1 , 2 , 0 ),
307
+ glm::vec4 (0 , 1 , 2 , 0 ),
308
+ glm::vec4 (1 , 2 , 2 , 0 ),
309
+ glm::vec4 (1 , 0 , 0 , 0 ));
307
310
Error += all (equal (B4x4, expected, epsilon<float >())) ? 0 : 1 ;
311
+ Error += all (equal (C4x4, expected, epsilon<float >())) ? 0 : 1 ;
308
312
}
309
313
310
314
{
@@ -314,12 +318,14 @@ static int test_shearing()
314
318
glm::vec2 const l_z (4 , 5 );
315
319
glm::mat4x4 const A4x4 (1 );
316
320
glm::mat4x4 const B4x4 = glm::shear (A4x4, center, l_x, l_y, l_z);
321
+ glm::mat4x4 const C4x4 = glm::shear_slow (A4x4, center, l_x, l_y, l_z);
317
322
glm::mat4x4 const expected (
318
323
glm::vec4 (1 , 3 , 4 , 0 ),
319
324
glm::vec4 (1 , 1 , 5 , 0 ),
320
325
glm::vec4 (2 , 1 , 1 , 0 ),
321
326
glm::vec4 (-9 , -8 , -9 , 1 ));
322
327
Error += all (equal (B4x4, expected, epsilon<float >())) ? 0 : 1 ;
328
+ Error += all (equal (C4x4, expected, epsilon<float >())) ? 0 : 1 ;
323
329
}
324
330
325
331
{
@@ -333,12 +339,14 @@ static int test_shearing()
333
339
glm::vec4 (4 , -8 , 0 , 0 ),
334
340
glm::vec4 (7 , 1 , -2 , 0 ));
335
341
glm::mat4x4 const B4x4 = glm::shear (A4x4, center, l_x, l_y, l_z);
342
+ glm::mat4x4 const C4x4 = glm::shear_slow (A4x4, center, l_x, l_y, l_z);
336
343
glm::mat4x4 const expected (
337
- glm::vec4 (1 , -6 , - 1 , 0 ),
338
- glm::vec4 (7 , 12 , 23 , 0 ),
339
- glm::vec4 (- 4 , 4 , - 24 , 0 ),
340
- glm::vec4 (4 , 20 , 31 , 0 ));
344
+ glm::vec4 (22 , -24 , 4 , 0 ),
345
+ glm::vec4 (20 , - 36 , 2 , 0 ),
346
+ glm::vec4 (1 , - 2 , 3 , 0 ),
347
+ glm::vec4 (- 26 , 39 , - 19 , 0 ));
341
348
Error += all (equal (B4x4, expected, epsilon<float >())) ? 0 : 1 ;
349
+ Error += all (equal (C4x4, expected, epsilon<float >())) ? 0 : 1 ;
342
350
}
343
351
344
352
return Error;
@@ -392,19 +400,20 @@ static int test_inverse_perf(std::size_t Count, std::size_t Instance, char const
392
400
int main ()
393
401
{
394
402
int Error = 0 ;
403
+
395
404
Error += test_matrixCompMult ();
396
405
Error += test_outerProduct ();
397
406
Error += test_transpose ();
398
407
Error += test_determinant ();
399
408
Error += test_inverse ();
400
- Error += test_inverse_simd ();
401
- Error += test_shearing ();
409
+ Error += test_inverse_simd ();
410
+ Error += test_shearing ();
402
411
403
- # ifdef NDEBUG
412
+ #ifdef NDEBUG
404
413
std::size_t const Samples = 1000 ;
405
- # else
414
+ #else
406
415
std::size_t const Samples = 1 ;
407
- # endif // NDEBUG
416
+ #endif // NDEBUG
408
417
409
418
for (std::size_t i = 0 ; i < 1 ; ++i)
410
419
{
0 commit comments