mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 02:11:19 +00:00
[entity] Update local rotation and scale caches
When setting local rotation/scale/transform, need to cache the rotation and scale, otherwise they can't be fetched easily later on (position is easy as it's just the fourth column of the matrix).
This commit is contained in:
parent
c715fb384f
commit
435009e2cd
1 changed files with 4 additions and 0 deletions
|
@ -222,6 +222,7 @@ Transform_SetLocalRotation (transform_t *transform, vec4f_t rotation)
|
|||
mat4f_t mat;
|
||||
mat4fquat (mat, rotation);
|
||||
|
||||
h->localRotation.a[transform->index] = rotation;
|
||||
h->localMatrix.a[transform->index][0] = mat[0] * scale[0];
|
||||
h->localMatrix.a[transform->index][1] = mat[1] * scale[1];
|
||||
h->localMatrix.a[transform->index][2] = mat[2] * scale[2];
|
||||
|
@ -245,6 +246,7 @@ Transform_SetLocalScale (transform_t *transform, vec4f_t scale)
|
|||
mat4f_t mat;
|
||||
mat4fquat (mat, rotation);
|
||||
|
||||
h->localScale.a[transform->index] = scale;
|
||||
h->localMatrix.a[transform->index][0] = mat[0] * scale[0];
|
||||
h->localMatrix.a[transform->index][1] = mat[1] * scale[1];
|
||||
h->localMatrix.a[transform->index][2] = mat[2] * scale[2];
|
||||
|
@ -304,6 +306,8 @@ Transform_SetLocalTransform (transform_t *transform, vec4f_t scale,
|
|||
mat4fquat (mat, rotation);
|
||||
|
||||
position[3] = 1;
|
||||
h->localRotation.a[transform->index] = rotation;
|
||||
h->localScale.a[transform->index] = scale;
|
||||
h->localMatrix.a[transform->index][0] = mat[0] * scale[0];
|
||||
h->localMatrix.a[transform->index][1] = mat[1] * scale[1];
|
||||
h->localMatrix.a[transform->index][2] = mat[2] * scale[2];
|
||||
|
|
Loading…
Reference in a new issue