summaryrefslogtreecommitdiffstats
path: root/libdimension/camera.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/camera.c')
-rw-r--r--libdimension/camera.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libdimension/camera.c b/libdimension/camera.c
index 08c4e1a..d963d1b 100644
--- a/libdimension/camera.c
+++ b/libdimension/camera.c
@@ -18,6 +18,11 @@
* <http://www.gnu.org/licenses/>. *
*************************************************************************/
+/**
+ * @file
+ * Cameras.
+ */
+
#include "dimension.h"
#include <stdlib.h>
@@ -27,6 +32,7 @@ dmnsn_new_camera()
{
dmnsn_camera *camera = dmnsn_malloc(sizeof(dmnsn_camera));
camera->free_fn = NULL;
+ camera->trans = dmnsn_identity_matrix();
return camera;
}
@@ -41,3 +47,11 @@ dmnsn_delete_camera(dmnsn_camera *camera)
dmnsn_free(camera);
}
}
+
+/* Invoke the camera ray function */
+dmnsn_line
+dmnsn_camera_ray(const dmnsn_camera *camera, double x, double y)
+{
+ dmnsn_line ray = (*camera->ray_fn)(camera, x, y);
+ return dmnsn_transform_line(camera->trans, ray);
+}