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

Bug in Matrix conversion code in 0.9.9.3 #829

Closed
oceanusxiv opened this issue Nov 4, 2018 · 1 comment
Closed

Bug in Matrix conversion code in 0.9.9.3 #829

oceanusxiv opened this issue Nov 4, 2018 · 1 comment
Assignees
Milestone

Comments

@oceanusxiv
Copy link

Hi

I've been using glm HEAD from homebrew and encountered a bug in one of the matrix conversion constructors due to the change to initializer lists starting from this version. Specifically, in commit dee806e,

template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 mat<4, 3, T, Q>::mat(mat<4, 4, T, Q> const& m)
# if GLM_HAS_INITIALIZER_LISTS
: value{col_type(m[0]), col_type(m[1]), col_type(m[2]), col_type(0)}
# endif
{
# if !GLM_HAS_INITIALIZER_LISTS
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]);
this->value[3] = col_type(m[3]);
# endif
}

The initializer list is incorrect and indeed is inconsistent with the old implementation.

#		if GLM_HAS_INITIALIZER_LISTS
			: value{col_type(m[0]), col_type(m[1]), col_type(m[2]), col_type(0)}
#		endif
	{
#		if !GLM_HAS_INITIALIZER_LISTS
			this->value[0] = col_type(m[0]);
			this->value[1] = col_type(m[1]);
			this->value[2] = col_type(m[2]);
			this->value[3] = col_type(m[3]);
# endif

The new implementation would leave the last column as 0 whereas it should be filled with the corresponding column of the 4x4 matrix when converting to 4x3.

This results in a mat4x3 which would have the last row be empty no matter what the mat4 is.

Groovounet added a commit that referenced this issue Nov 5, 2018
@Groovounet Groovounet self-assigned this Nov 5, 2018
@Groovounet Groovounet added this to the GLM 0.9.9 milestone Nov 5, 2018
@Groovounet
Copy link
Member

This issue is in master branch for GLM 0.9.9.4 release.

Thanks for contributing!

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