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

cpml.mat4.to_vec4s() and cpml.mat4.to_vec4s_cols() are reversed #84

Open
leonardus opened this issue Jan 12, 2023 · 1 comment
Open

Comments

@leonardus
Copy link

CPML documentation states that cpml matrices are column-major.

local testmatrix = cpml.mat4.new{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}

This should be the matrix:

[1  5  9  13]
[2  6  10 14]
[3  7  11 15]
[4  8  12 16]

If so, this prints the opposite results from what is expected:

for _, row in pairs(cpml.mat4.to_vec4s(testmatrix)) do
	print("row: ", row[1], row[2], row[3], row[4])
end
for _, col in pairs(cpml.mat4.to_vec4s_cols(testmatrix)) do
	print("col: ", col[1], col[2], col[3], col[4])
end
row:    1       2       3       4
row:    5       6       7       8
row:    9       10      11      12
row:    13      14      15      16
col:    1       5       9       13
col:    2       6       10      14
col:    3       7       11      15
col:    4       8       12      16
@shakesoda
Copy link
Member

shakesoda commented Jan 13, 2023 via email

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