summaryrefslogtreecommitdiffstats
path: root/libdimension/dimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-05-21 20:27:09 -0600
committerTavian Barnes <tavianator@gmail.com>2011-05-21 20:27:09 -0600
commit0f0b704144bddc045657f7ed852b49d5e349b0bd (patch)
treecefc022b10cc4f5675245ea2e77c24c89a6bc30a /libdimension/dimension
parent07d784563af19c162945c60562819269e6fc4994 (diff)
downloaddimension-0f0b704144bddc045657f7ed852b49d5e349b0bd.tar.xz
Add refcounts to cameras.
Diffstat (limited to 'libdimension/dimension')
-rw-r--r--libdimension/dimension/camera.h5
-rw-r--r--libdimension/dimension/refcount.h3
-rw-r--r--libdimension/dimension/scene.h7
3 files changed, 13 insertions, 2 deletions
diff --git a/libdimension/dimension/camera.h b/libdimension/dimension/camera.h
index c3ad65b..67fffc0 100644
--- a/libdimension/dimension/camera.h
+++ b/libdimension/dimension/camera.h
@@ -44,8 +44,9 @@ struct dmnsn_camera {
dmnsn_matrix trans; /**< Transformation matrix. */
- /** Generic pointer for camera info. */
- void *ptr;
+ void *ptr; /**< @internal Generic pointer for camera info. */
+
+ dmnsn_refcount *refcount; /**< @internal reference count. */
};
/**
diff --git a/libdimension/dimension/refcount.h b/libdimension/dimension/refcount.h
index 14f31ab..9d2c304 100644
--- a/libdimension/dimension/refcount.h
+++ b/libdimension/dimension/refcount.h
@@ -30,6 +30,7 @@
#define DMNSN_INCREF(obj) ((void)++(*(obj)->refcount))
/**
+ * @internal
* Decrement a reference count.
* @param[in,out] object The reference-counted object to release.
* @return Whether the object is now garbage.
@@ -42,6 +43,7 @@
typedef unsigned int dmnsn_refcount;
/**
+ * @internal
* Create a reference count.
* @return A new reference counter, initialized to zero (a "borrowed" reference,
* which will be garbage-collected the first time it is deleted).
@@ -49,6 +51,7 @@ typedef unsigned int dmnsn_refcount;
dmnsn_refcount *dmnsn_new_refcount(void);
/**
+ * @internal
* Delete a reference count. Raises an error if the reference count wasn't
* zero.
*/
diff --git a/libdimension/dimension/scene.h b/libdimension/dimension/scene.h
index ffe5fb3..b726a77 100644
--- a/libdimension/dimension/scene.h
+++ b/libdimension/dimension/scene.h
@@ -100,6 +100,13 @@ void dmnsn_initialize_scene(dmnsn_scene *scene);
void dmnsn_scene_set_canvas(dmnsn_scene *scene, dmnsn_canvas *canvas);
/**
+ * Set the camera for a scene.
+ * @param[in,out] scene The scene for which to set the canvas.
+ * @param[in] camera The camera to set.
+ */
+void dmnsn_scene_set_camera(dmnsn_scene *scene, dmnsn_camera *camera);
+
+/**
* Add an object to a scene.
* @param[in,out] scene The scene to which to add the object.
* @param[in] object The object to add.