Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameterize on dimensions #584

Closed
johnmcfarlane opened this issue Dec 3, 2016 · 6 comments
Closed

Parameterize on dimensions #584

johnmcfarlane opened this issue Dec 3, 2016 · 6 comments
Assignees
Milestone

Comments

@johnmcfarlane
Copy link

You mentioned making C++11 the minimum spec. This would make a lot of things far easier.

One missing feature which I've heard mentioned and which I've been able to implement myself is a dimension parameter.

It would be nice to replace

template<typename T, precision P> struct tvec3;

with:

template<typename T, int N, precision P> struct tvec;
template<typename T, precision P> using tvec3 = tvec<T, 3, P>;

This would help reduce a lot of duplication, notably in the heterogeneous operation change that I've part implemented.

I'm not sure that this needs using aliases and therefore that you'd need to drop C++03. I see that you've used nested templates (e.g.) to make the code nice and generic. It may also be possible to get around the limitations of typedef with inheritance, e.g.

template<typename T, precision P> struct tvec3 : tvec<T, 3, P> { ... };

but it's hard to say without some costly experimentation. I've started experimenting in my fork with the using solution above and it's a big, big change!

I'm sure you've thought about this feature. Is there any particular reason not to do it? Do you think it's dependent on C++11? Would you consider a PR from me if I was able to achieve it?

@Groovounet Groovounet added the core label Dec 4, 2016
@Groovounet
Copy link
Member

Hi,

Alias templates are not supported by Visual Studio 2013 and I think it's too early to drop 2013. Actually GLM 0.9.9 is the first version that will drop Visual Studio 2010 support...

So I should have said, I am considering requiring some C++11 features.

Thanks,
Chirstophe

@johnmcfarlane
Copy link
Author

FYI, I got this working on Clang / GCC: johnmcfarlane#2

@Groovounet
Copy link
Member

I pulled the branch into "dim" branch to run the tests.
https://travis-ci.org/g-truc/glm/builds/187434972

With Visual C++ it doesn't built but looking at the code it looks very promising!

I'll have a closer look.

@johnmcfarlane
Copy link
Author

Thanks. Surprisingly, I was able to compile on VS2013 & VS2015 with very few fixes. They are pushed: johnmcfarlane#2

Groovounet added a commit that referenced this issue Dec 30, 2016
Groovounet added a commit that referenced this issue Dec 30, 2016
Groovounet added a commit that referenced this issue Dec 30, 2016
Groovounet added a commit that referenced this issue Jan 3, 2017
Parameterize on dimensions #584 for vectors and matrices types #596
@Groovounet Groovounet added this to the GLM 0.9.9 milestone Jan 3, 2017
@Groovounet
Copy link
Member

This issue is merged in master branch for 0.9.9 release.

Thanks for contributing,
Christophe

@Groovounet Groovounet self-assigned this Jan 3, 2017
@johnmcfarlane
Copy link
Author

Glad to help, thanks! (I might also take a look at tmat some time.)

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

No branches or pull requests

2 participants