Allow casting to vectors of lower dimensions.

This commit is contained in:
King_DuckZ 2015-07-25 21:18:45 +02:00
parent fe03f45f76
commit 7affd7960f
3 changed files with 28 additions and 11 deletions

View file

@ -2,6 +2,11 @@
#include <gtest/gtest.h>
namespace {
void test_svec2 (const vwr::svec2& parVec, float parX, float parY) {
EXPECT_EQ(parVec.x(), parX);
EXPECT_EQ(parVec.y(), parY);
}
void simplevec_double (vwr::SimpleVector3& parVec, float parX, float parY, float parZ) {
EXPECT_EQ(parVec.x, parX);
EXPECT_EQ(parVec.y, parY);
@ -74,4 +79,10 @@ TEST(vwr, example) {
svec3 vec_b(vec);
EXPECT_EQ(vec_b, vec);
}
{
//You can also cast a svec3 to svec2, if you need to.
const svec3 vec(9.5f, 1.2f, 0.9f);
test_svec2(vec.cast<svec2>(), vec.x(), vec.y());
}
}