Add additional swizzle constructors

This commit is contained in:
Ben
2011-10-05 11:14:59 -07:00
parent 5f287430f4
commit bcc8926ebf
4 changed files with 84 additions and 3 deletions

View File

@@ -391,19 +391,16 @@ int test_vec3_swizzle_partial()
{
glm::vec3 B(A.xy, 3.0f);
Error += A == B ? 0 : 1;
}
{
glm::vec3 B(1.0f, A.yz);
Error += A == B ? 0 : 1;
}
{
glm::vec3 B(A.xyz);
Error += A == B ? 0 : 1;
}

View File

@@ -213,6 +213,41 @@ int test_vec4_size()
return Error;
}
int test_vec4_swizzle_partial()
{
int Error = 0;
glm::vec4 A(1, 2, 3, 4);
{
glm::vec4 B(A.xy, A.zw);
Error += A == B ? 0 : 1;
}
{
glm::vec4 B(A.xy, 3.0f, 4.0f);
Error += A == B ? 0 : 1;
}
{
glm::vec4 B(1.0f, A.yz, 4.0f);
Error += A == B ? 0 : 1;
}
{
glm::vec4 B(1.0f, 2.0f, A.zw);
Error += A == B ? 0 : 1;
}
{
glm::vec4 B(A.xyz, 4.0f);
Error += A == B ? 0 : 1;
}
{
glm::vec4 B(1.0f, A.yzw);
Error += A == B ? 0 : 1;
}
return Error;
}
int main()
{
//__m128 DataA = swizzle<X, Y, Z, W>(glm::vec4(1.0f, 2.0f, 3.0f, 4.0f));
@@ -223,6 +258,7 @@ int main()
Error += test_vec4_size();
Error += test_vec4_operators();
Error += test_hvec4();
Error += test_vec4_swizzle_partial();
return Error;
}