From 8f01c5394dcce8f5d4e7102dacfcdea9d1f7b021 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 16 Jul 2009 01:16:09 +0000 Subject: Add destructor callbacks for polymorphic C types, and use their base dmnsn_delete_*() function. --- libdimension/dimension/object.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libdimension/dimension/object.h') diff --git a/libdimension/dimension/object.h b/libdimension/dimension/object.h index 2da3ac7..901b366 100644 --- a/libdimension/dimension/object.h +++ b/libdimension/dimension/object.h @@ -34,7 +34,9 @@ typedef dmnsn_array *dmnsn_object_intersections_fn(const dmnsn_object *object, typedef int dmnsn_object_inside_fn(const dmnsn_object *object, dmnsn_vector point); +/* dmnsn_object definition */ struct dmnsn_object { + /* Surface properties */ dmnsn_texture *texture; /* Transformation matrix */ @@ -43,6 +45,7 @@ struct dmnsn_object { /* Callback functions */ dmnsn_object_intersections_fn *intersections_fn; dmnsn_object_inside_fn *inside_fn; + dmnsn_free_fn *free_fn; /* Generic pointer for object info */ void *ptr; @@ -50,6 +53,8 @@ struct dmnsn_object { /* Allocate a dummy object */ dmnsn_object *dmnsn_new_object(); + +/* Free an object */ void dmnsn_delete_object(dmnsn_object *object); #endif /* DIMENSION_OBJECT_H */ -- cgit v1.2.3