diff options
Diffstat (limited to 'libdimension/object.c')
-rw-r--r-- | libdimension/object.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libdimension/object.c b/libdimension/object.c index 9074d60..acc0163 100644 --- a/libdimension/object.c +++ b/libdimension/object.c @@ -37,10 +37,11 @@ dmnsn_object * dmnsn_new_object() { dmnsn_object *object = dmnsn_malloc(sizeof(dmnsn_object)); - object->texture = NULL; - object->interior = NULL; - object->trans = dmnsn_identity_matrix(); - object->free_fn = NULL; + object->texture = NULL; + object->interior = NULL; + object->trans = dmnsn_identity_matrix(); + object->precompute_fn = NULL; + object->free_fn = NULL; return object; } @@ -62,9 +63,14 @@ dmnsn_delete_object(dmnsn_object *object) void dmnsn_object_precompute(dmnsn_object *object) { + if (object->precompute_fn) { + (*object->precompute_fn)(object); + } + object->bounding_box = dmnsn_transform_bounding_box(object->trans, object->bounding_box); object->trans_inv = dmnsn_matrix_inverse(object->trans); + if (object->texture) { object->texture->trans = dmnsn_matrix_mul(object->trans, object->texture->trans); |