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-python/dimension.pxd | 6 ++---- libdimension-python/dimension.pyx | 6 +----- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'libdimension-python') diff --git a/libdimension-python/dimension.pxd b/libdimension-python/dimension.pxd index 6b5c77f..55c2ab8 100644 --- a/libdimension-python/dimension.pxd +++ b/libdimension-python/dimension.pxd @@ -204,7 +204,6 @@ cdef extern from "../libdimension/dimension.h": size_t height dmnsn_canvas *dmnsn_new_canvas(dmnsn_pool *pool, size_t width, size_t height) - void dmnsn_delete_canvas(dmnsn_canvas *canvas) dmnsn_tcolor dmnsn_canvas_get_pixel(dmnsn_canvas *canvas, size_t x, size_t y) void dmnsn_canvas_set_pixel(dmnsn_canvas *canvas, size_t x, size_t y, @@ -373,10 +372,9 @@ cdef extern from "../libdimension/dimension.h": ctypedef struct dmnsn_camera: dmnsn_matrix trans - dmnsn_camera *dmnsn_new_camera() - void dmnsn_delete_camera(dmnsn_camera *camera) + dmnsn_camera *dmnsn_new_camera(dmnsn_pool *pool) - dmnsn_camera *dmnsn_new_perspective_camera() + dmnsn_camera *dmnsn_new_perspective_camera(dmnsn_pool *pool) ########## # Scenes # diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx index 79e4014..28392db 100644 --- a/libdimension-python/dimension.pyx +++ b/libdimension-python/dimension.pyx @@ -1446,9 +1446,6 @@ cdef class Camera(_Transformable): if self._camera == NULL: raise TypeError("attempt to initialize base Camera") - def __dealloc__(self): - dmnsn_delete_camera(self._camera) - def transform(self, Matrix trans not None): """Transform a camera.""" self._camera.trans = dmnsn_matrix_mul(trans._m, self._camera.trans) @@ -1467,7 +1464,7 @@ cdef class PerspectiveCamera(Camera): sky -- the direction of the top of the camera (default: Y) angle -- the field of view angle (from bottom to top) (default: 45) """ - self._camera = dmnsn_new_perspective_camera() + self._camera = dmnsn_new_perspective_camera(_get_pool()) Camera.__init__(self) # Apply the field of view angle @@ -1528,7 +1525,6 @@ cdef class Scene: dmnsn_array_push(self._scene.lights, &l) self._scene.camera = camera._camera - DMNSN_INCREF(self._scene.camera) # Subregion render support property region_x: -- cgit v1.2.3