Started working on 2D patterns.

This commit is contained in:
Godzil
2020-03-04 09:32:11 +00:00
parent 83c12dbd83
commit 5c10d65c8d
5 changed files with 77 additions and 3 deletions

View File

@@ -18,6 +18,8 @@
#include <sphere.h>
#include <gtest/gtest.h>
#include <material.h>
#include <uv_pattern.h>
#include <uv_checkers.h>
#ifdef ENABLE_LUA_SUPPORT
extern "C" {
@@ -260,4 +262,15 @@ TEST(PatternTest, Simple_test_of_a_lua_pattern)
lua_close(L);
}
#endif
#endif
TEST(PatternTest, Checkers_pattern_in_2D)
{
UVCheckers checkers = UVCheckers(2, 2, black, white);
ASSERT_EQ(checkers.uvPatternAt(0.0, 0.0), black);
ASSERT_EQ(checkers.uvPatternAt(0.5, 0.0), white);
ASSERT_EQ(checkers.uvPatternAt(0.0, 0.5), white);
ASSERT_EQ(checkers.uvPatternAt(0.5, 0.5), black);
ASSERT_EQ(checkers.uvPatternAt(1.0, 1.0), black);
}