Use mat4_fromPose more;

This commit is contained in:
bjorn 2023-07-03 13:16:35 -07:00
parent 5904d3997e
commit 38be62c103
2 changed files with 2 additions and 4 deletions

View File

@ -291,8 +291,7 @@ static int l_lovrPassSetViewPose(lua_State* L) {
float position[4], orientation[4], matrix[16];
index = luax_readvec3(L, index, position, "vec3, number, or mat4");
index = luax_readquat(L, index, orientation, NULL);
mat4_fromQuat(matrix, orientation);
memcpy(matrix + 12, position, 3 * sizeof(float));
mat4_fromPose(matrix, position, orientation);
mat4_invert(matrix);
lovrPassSetViewMatrix(pass, view, matrix);
}

View File

@ -2078,8 +2078,7 @@ static ModelData* openxr_newModelDataFB(XrHandTrackerEXT tracker, bool animated)
// Inverse bind matrix
XrPosef* pose = &mesh.jointBindPoses[i];
float* inverseBindMatrix = inverseBindMatrices + 16 * i;
mat4_fromQuat(inverseBindMatrix, &pose->orientation.x);
memcpy(inverseBindMatrix + 12, &pose->position.x, 3 * sizeof(float));
mat4_fromPose(inverseBindMatrix, &pose->position.x, &pose->orientation.x);
mat4_invert(inverseBindMatrix);
// Add child bones by looking for any bones that have a parent of the current bone.