Skip to content

Conversation

JesseTG
Copy link

@JesseTG JesseTG commented Oct 2, 2015

In a project of mine, I need to be able to have functions that convert between all the different vector types at will (and matrices, and quaternions). I do not feel like writing 225 different functions (vec2, vec3, and vec4, times the 5 instantiations I care about) to do this. I managed to make it work with templates, but it's not pretty. If I could just use one constructor interface for each vector type, it would make things much easier on me. So I did.

- Also removed all degree symbols from test/gtc/gtc_quaternion.cpp
- It made editing it a pain in the ass
- Oh, added tests for the new constructors for quat, too
- Tests, too
- Also, removed a line from the simdVec4 test (there's no operator+, apparently)
@Groovounet
Copy link
Member

I don't think that accumulating option is a solution for GLM as this is growing in too much complexity.

If you really need such functionality for metaprogramming purposes, you should be able to write code outside GLM to produce the same behavior.

Thanks,
Christophe

@Groovounet Groovounet closed this Oct 7, 2015
@JesseTG
Copy link
Author

JesseTG commented Oct 7, 2015

What would you suggest, then?

@Groovounet
Copy link
Member

template <typename T, precision P, template <typename, precision> class vecType>
vecType<T, P> make_vec(T x, T y, T z, Tw);

?

@JesseTG
Copy link
Author

JesseTG commented Oct 7, 2015

I'll look to see if doing so will make my code smaller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants