Skip to content

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

Description

@leonardus

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions