Closed alexlarsson closed 5 years ago
This requires graphene support for decomposing a matrix, @ebassi said exposing this was ok.
What kind of API would you need?
Would something like this be enough:
bool
graphene_matrix_decompose (const graphene_matrix_t *m,
graphene_vec3_t *translate_out,
graphene_vec3_t *scale_out,
graphene_quaternion_t *rotate_out,
graphene_vec4_t *perspective_out,
graphene_vec3_t *shear_out);
The "meh" bit is that the decomposition code for 2D matrices is slightly different, but it should be doable.
In practice, gthree will only ever need translation, scale and rotation, as those are the properties it has for the node. Its just not gonna be possible to set a perspective matrix on a node, and then start to modify the translation expecting the perspective to stay. However, for completeness it makes sense for the api to have it.
For 2d matrices, do we even have any support for 2x2 or 3x3 (homogenous 2d) matrices?
When this is done we can stop setting auto_update to FALSE if matrix is set in the GLTF loader.