mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[scene] Provide direct access to the world matrix
Holding onto the pointer is not a good idea, and it is read-only as direct manipulation of the world matrix is not supported. However, this is useful for passing the matrix to the GPU.
This commit is contained in:
parent
869cc4050c
commit
8b1eec08cf
2 changed files with 9 additions and 0 deletions
|
@ -61,6 +61,8 @@ uint32_t Transform_GetTag (const transform_t *transform) __attribute__((pure));
|
|||
void Transform_GetLocalMatrix (const transform_t *transform, mat4f_t mat);
|
||||
void Transform_GetLocalInverse (const transform_t *transform, mat4f_t mat);
|
||||
void Transform_GetWorldMatrix (const transform_t *transform, mat4f_t mat);
|
||||
// XXX the pointer may be invalidated by hierarchy updates
|
||||
const vec4f_t *Transform_GetWorldMatrixPtr (const transform_t *transform) __attribute__((pure));
|
||||
void Transform_GetWorldInverse (const transform_t *transform, mat4f_t mat);
|
||||
vec4f_t Transform_GetLocalPosition (const transform_t *transform) __attribute__((pure));
|
||||
void Transform_SetLocalPosition (transform_t *transform, vec4f_t position);
|
||||
|
|
|
@ -183,6 +183,13 @@ Transform_GetWorldMatrix (const transform_t *transform, mat4f_t mat)
|
|||
memcpy (mat, h->worldMatrix.a[transform->index], sizeof (mat4f_t));
|
||||
}
|
||||
|
||||
const vec4f_t *
|
||||
Transform_GetWorldMatrixPtr (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->worldMatrix.a[transform->index];
|
||||
}
|
||||
|
||||
void
|
||||
Transform_GetWorldInverse (const transform_t *transform, mat4f_t mat)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue