From c2b4dcc7660407f687604afe2c03eff0a4ff3a16 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 30 May 2014 17:42:14 -0400 Subject: camera: Use pool. --- libdimension/dimension/camera.h | 18 ++---------------- libdimension/dimension/cameras.h | 5 +++-- 2 files changed, 5 insertions(+), 18 deletions(-) (limited to 'libdimension/dimension') diff --git a/libdimension/dimension/camera.h b/libdimension/dimension/camera.h index e94e227..3c6494c 100644 --- a/libdimension/dimension/camera.h +++ b/libdimension/dimension/camera.h @@ -36,28 +36,20 @@ typedef struct dmnsn_camera dmnsn_camera; typedef dmnsn_line dmnsn_camera_ray_fn(const dmnsn_camera *camera, double x, double y); -/** - * Camera destruction callback. - * @param[in,out] camera The camera to delete. - */ -typedef void dmnsn_camera_free_fn(dmnsn_camera *camera); - /** A camera. */ struct dmnsn_camera { /* Callback functions */ dmnsn_camera_ray_fn *ray_fn; /**< Camera ray callback. */ - dmnsn_camera_free_fn *free_fn; /**< Destructor callback. */ dmnsn_matrix trans; /**< Transformation matrix. */ - - DMNSN_REFCOUNT; /**< Reference count. */ }; /** * Create a dummy camera. + * @param[in] pool The memory pool to allocate from. * @return The allocated camera. */ -dmnsn_camera *dmnsn_new_camera(void); +dmnsn_camera *dmnsn_new_camera(dmnsn_pool *pool); /** * Initialize a dmnsn_camera field. @@ -65,12 +57,6 @@ dmnsn_camera *dmnsn_new_camera(void); */ void dmnsn_init_camera(dmnsn_camera *camera); -/** - * Delete a camera. - * @param[in,out] camera The camera to delete. - */ -void dmnsn_delete_camera(dmnsn_camera *camera); - /** * Invoke the camera ray callback, then correctly transform the ray. * @param[in] camera The camera itself. diff --git a/libdimension/dimension/cameras.h b/libdimension/dimension/cameras.h index d7f44b2..9ef2646 100644 --- a/libdimension/dimension/cameras.h +++ b/libdimension/dimension/cameras.h @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (C) 2009-2010 Tavian Barnes * + * Copyright (C) 2009-2014 Tavian Barnes * * * * This file is part of The Dimension Library. * * * @@ -28,6 +28,7 @@ * (0, 0, 1). The feild of view is the section of the plane z = 1 from * (-0.5, -0.5) to (0.5, 0.5). Rays are transformed by the camera's * transformation matrix. + * @param[in] pool The memory pool to allocate from. * @return A perspective camera. */ -dmnsn_camera *dmnsn_new_perspective_camera(void); +dmnsn_camera *dmnsn_new_perspective_camera(dmnsn_pool *pool); -- cgit v1.2.3