summaryrefslogtreecommitdiffstats
path: root/libdimension/cameras.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-07-16 01:16:09 +0000
committerTavian Barnes <tavianator@gmail.com>2009-07-16 01:16:09 +0000
commit8f01c5394dcce8f5d4e7102dacfcdea9d1f7b021 (patch)
tree4092a281882e34ac53ec15d582dcbf2cb0d408c0 /libdimension/cameras.c
parent1928016fe7aa439d4bfb61d3a7e7b7399ca7a229 (diff)
downloaddimension-8f01c5394dcce8f5d4e7102dacfcdea9d1f7b021.tar.xz
Add destructor callbacks for polymorphic C types, and use their base
dmnsn_delete_*() function.
Diffstat (limited to 'libdimension/cameras.c')
-rw-r--r--libdimension/cameras.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/libdimension/cameras.c b/libdimension/cameras.c
index 1ab1360..dfe4708 100644
--- a/libdimension/cameras.c
+++ b/libdimension/cameras.c
@@ -39,8 +39,6 @@ dmnsn_new_perspective_camera(dmnsn_matrix trans)
dmnsn_matrix *ptr;
dmnsn_camera *camera = dmnsn_new_camera();
if (camera) {
- camera->ray_fn = &dmnsn_perspective_camera_ray_fn;
-
/* Allocate room for the transformation matrix */
ptr = malloc(sizeof(dmnsn_matrix));
if (!ptr) {
@@ -49,18 +47,11 @@ dmnsn_new_perspective_camera(dmnsn_matrix trans)
}
*ptr = trans;
camera->ptr = ptr;
- }
- return camera;
-}
-/* Delete a perspective camera */
-void
-dmnsn_delete_perspective_camera(dmnsn_camera *camera)
-{
- if (camera) {
- free(camera->ptr);
- dmnsn_delete_camera(camera);
+ camera->ray_fn = &dmnsn_perspective_camera_ray_fn;
+ camera->free_fn = &free;
}
+ return camera;
}
/* Get the transformation matrix */