-
Hello, While struggling with some transformations in Filament, I tried the following code : val mat4 = translation(Float3(1f, 2f, 3f))
Log.i("mat4", mat4.toFloatArray().contentToString())
val matrix = FloatArray(16)
Matrix.setIdentityM(matrix, 0)
Matrix.translateM(matrix, 0, 1f, 2f, 3f)
Log.i("matrix", matrix.contentToString()) Since, from what I understand, both APIs are handling matrices in column-major order, I would have expected the same result for
Could someone please indicate me what I am missing ? :) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Both matrices are in column-major order in how they store the data. However when calling |
Beta Was this translation helpful? Give feedback.
-
Oh, thanks @romainguy , that explains quite a lot. Is this the same for the This means that there is an error in the article I used for getting started with Filament 😬 private fun Int.getTransform(): Mat4 {
val tm = modelViewer.engine.transformManager
return Mat4.of(*tm.getTransform(tm.getInstance(this), null))
}
private fun Int.setTransform(mat: Mat4) {
val tm = modelViewer.engine.transformManager
tm.setTransform(tm.getInstance(this), mat.toFloatArray())
} |
Beta Was this translation helpful? Give feedback.
-
Ok, thanks for the clarifications ! In my opinion, yes a second variant might help understanding the specific aspects of the methods. |
Beta Was this translation helpful? Give feedback.
Both matrices are in column-major order in how they store the data. However when calling
toFloatArray()
, Filament'sMat4
(which is from kotlin-math) returns data in a row-major format.