diff --git a/include/QF/scene/transform.h b/include/QF/scene/transform.h index ca71392d3..943509590 100644 --- a/include/QF/scene/transform.h +++ b/include/QF/scene/transform.h @@ -55,7 +55,6 @@ enum { transform_type_localRotation, transform_type_localScale, transform_type_worldRotation, - transform_type_worldScale, transform_type_count }; @@ -321,8 +320,15 @@ Transform_GetWorldScale (transform_t transform) { __auto_type ref = Transform_GetRef (transform); hierarchy_t *h = ref->hierarchy; - vec4f_t *worldScale = h->components[transform_type_worldScale]; - return worldScale[ref->index]; + mat4f_t *worldMatrix = h->components[transform_type_worldMatrix]; + vec4f_t *m = worldMatrix[ref->index]; + vec4f_t s = { + dotf (m[0], m[0])[0], + dotf (m[1], m[1])[0], + dotf (m[2], m[2])[0], + 0, + }; + return vsqrt4f (s); } XFORMINLINE diff --git a/libs/scene/transform.c b/libs/scene/transform.c index a01867b44..f00d2d527 100644 --- a/libs/scene/transform.c +++ b/libs/scene/transform.c @@ -119,11 +119,6 @@ static const component_t transform_components[transform_type_count] = { .create = transform_rotation_identity, .name = "World Rotation", }, - [transform_type_worldScale] = { - .size = sizeof (vec4f_t), - .create = transform_scale_identity, - .name = "World Scale", - }, }; static const hierarchy_type_t transform_type = { @@ -166,9 +161,7 @@ Transform_UpdateMatrices (hierarchy_t *h) mat4f_t *worldMatrix = h->components[transform_type_worldMatrix]; mat4f_t *worldInverse = h->components[transform_type_worldInverse]; vec4f_t *localRotation = h->components[transform_type_localRotation]; - vec4f_t *localScale = h->components[transform_type_localScale]; vec4f_t *worldRotation = h->components[transform_type_worldRotation]; - vec4f_t *worldScale = h->components[transform_type_worldScale]; byte *modified = h->components[transform_type_modified]; for (uint32_t i = 0; i < h->num_objects; i++) { @@ -182,7 +175,6 @@ Transform_UpdateMatrices (hierarchy_t *h) memcpy (worldInverse[0], localInverse[0], sizeof (mat4_t)); worldRotation[0] = localRotation[0]; - worldScale[0] = localScale[0]; } for (size_t i = 1; i < h->num_objects; i++) { uint32_t parent = h->parentIndex[i]; @@ -208,13 +200,6 @@ Transform_UpdateMatrices (hierarchy_t *h) localRotation[i]); } } - for (size_t i = 1; i < h->num_objects; i++) { - uint32_t parent = h->parentIndex[i]; - if (modified[i] || modified[parent]) { - worldScale[i] = m3vmulf (worldMatrix[parent], - localScale[i]); - } - } memset (modified, 0, h->num_objects); }