Add AlignCheck UV Pattern

This commit is contained in:
Godzil
2020-03-04 16:42:43 +00:00
parent 7209244f48
commit f5685a45e1
6 changed files with 142 additions and 1 deletions

View File

@@ -20,6 +20,7 @@
#include <material.h>
#include <uv_pattern.h>
#include <uv_checkers.h>
#include <uv_aligncheck.h>
#include <texturemap.h>
#ifdef ENABLE_LUA_SUPPORT
@@ -429,4 +430,40 @@ TEST(PatternTest, Using_a_cylindrical_mapping_on_a_3d_point)
ASSERT_TRUE(double_equal(u, testResults[i][0]));
ASSERT_TRUE(double_equal(v, testResults[i][1]));
}
}
TEST(PatternTest, Layout_of_the_align_check_pattern)
{
Colour main = Colour(1, 1, 1);
Colour ul = Colour(1, 0, 0);
Colour ur = Colour(1, 1, 0);
Colour bl = Colour(0, 1, 0);
Colour br = Colour(0, 1, 1);
double testList[][2] = {
{ 0.5, 0.5 },
{ 0.1, 0.9 },
{ 0.9, 0.9 },
{ 0.1, 0.1 },
{ 0.9, 0.1 },
};
Colour testResults[] {
main,
ul,
ur,
bl,
br,
};
int testCount = sizeof(testList)/sizeof((testList)[0]);
int i;
UVAlignCheck uvac = UVAlignCheck(main, ul, ur, bl, br);
for(i = 0; i < testCount; i++)
{
Colour ret = uvac.uvPatternAt(testList[i][0], testList[i][1]);
ASSERT_EQ(ret, testResults[i]);
}
}