Dav1dde / gl3n

OpenGL Maths for D (not glm for D).
http://dav1dde.github.com/gl3n/
Other
103 stars 49 forks source link

Vector!(ushort,3) constructor #8

Closed karhu closed 12 years ago

karhu commented 12 years ago

I have a problem getting the following code to run. I'm not sure whether the problem lies with the compiler, the library or with me.

I want to do the following:

alias Vector!(ushort,3) TriIndices;
auto Test = TriIndices(1,2,3);

But I get the following error from the compiler: "gl3n/linalg.d(125): Error: static assert "Vector constructor argument must be of type ushort or Vector, not int"

Thanks for your help.

Dav1dde commented 12 years ago

you create a vector with 3 ushort components, but you pass 3 integer for initialization, since int is not implicitly convertible to ushort you get this error.

auto test = TriIndices(cast(ushort)1, cast(ushort)2, cast(ushort)3); 

This would work, maybe there is a shortcut for that (like 1.0f for floats).