mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-06 19:38:15 +00:00
optimisation of the "bone socket" tutorial (#3864)
Less matrix operations doing.
This commit is contained in:
@@ -144,10 +144,8 @@ int main(void)
|
|||||||
Matrix matrixTransform = QuaternionToMatrix(rotate);
|
Matrix matrixTransform = QuaternionToMatrix(rotate);
|
||||||
// Translate socket to its position in the current animation
|
// Translate socket to its position in the current animation
|
||||||
matrixTransform = MatrixMultiply(matrixTransform, MatrixTranslate(transform->translation.x, transform->translation.y, transform->translation.z));
|
matrixTransform = MatrixMultiply(matrixTransform, MatrixTranslate(transform->translation.x, transform->translation.y, transform->translation.z));
|
||||||
// Rotate socket by character angle
|
// Transform the socket using the transform of the character (angle and translate)
|
||||||
matrixTransform = MatrixMultiply(matrixTransform, QuaternionToMatrix(characterRotate));
|
matrixTransform = MatrixMultiply(matrixTransform, characterModel.transform);
|
||||||
// Translate socket to character position
|
|
||||||
matrixTransform = MatrixMultiply(matrixTransform, MatrixTranslate(position.x, position.y + 0.0f, position.z));
|
|
||||||
|
|
||||||
// Draw mesh at socket position with socket angle rotation
|
// Draw mesh at socket position with socket angle rotation
|
||||||
DrawMesh(equipModel[i].meshes[0], equipModel[i].materials[1], matrixTransform);
|
DrawMesh(equipModel[i].meshes[0], equipModel[i].materials[1], matrixTransform);
|
||||||
|
Reference in New Issue
Block a user