summaryrefslogtreecommitdiffstats
path: root/libdimension/dimension
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/dimension')
-rw-r--r--libdimension/dimension/cameras.h1
-rw-r--r--libdimension/dimension/canvas.h1
-rw-r--r--libdimension/dimension/error.h11
-rw-r--r--libdimension/dimension/progress.h6
-rw-r--r--libdimension/dimension/raytrace.h1
-rw-r--r--libdimension/dimension/scene.h1
6 files changed, 17 insertions, 4 deletions
diff --git a/libdimension/dimension/cameras.h b/libdimension/dimension/cameras.h
index a75e9b9..d161f0e 100644
--- a/libdimension/dimension/cameras.h
+++ b/libdimension/dimension/cameras.h
@@ -31,6 +31,7 @@
dmnsn_camera *dmnsn_new_perspective_camera(dmnsn_matrix trans);
void dmnsn_delete_perspective_camera(dmnsn_camera *camera);
+/* Get or set the transformation matrix */
dmnsn_matrix dmnsn_get_perspective_camera_trans(const dmnsn_camera *camera);
void dmnsn_set_perspective_camera_trans(dmnsn_camera *camera, dmnsn_matrix T);
diff --git a/libdimension/dimension/canvas.h b/libdimension/dimension/canvas.h
index aaf728b..1818ccc 100644
--- a/libdimension/dimension/canvas.h
+++ b/libdimension/dimension/canvas.h
@@ -40,6 +40,7 @@ typedef struct {
dmnsn_color *pixels;
} dmnsn_canvas;
+/* Forward-declare dmnsn_canvas_optimizer */
typedef struct dmnsn_canvas_optimizer dmnsn_canvas_optimizer;
/* Canvas optimizer callback types */
diff --git a/libdimension/dimension/error.h b/libdimension/dimension/error.h
index cd7dd81..c5bf2a1 100644
--- a/libdimension/dimension/error.h
+++ b/libdimension/dimension/error.h
@@ -34,10 +34,17 @@ typedef enum {
DMNSN_SEVERITY_HIGH /* Always die */
} dmnsn_severity;
+#ifdef __GNUC__
+ #define DMNSN_FUNC __PRETTY_FUNCTION__
+#elif (__STDC_VERSION__ >= 199901L)
+ #define DMNSN_FUNC __func__
+#else
+ #define DMNSN_FUNC __FILE__
+#endif
+
/* Use this macro to report an error */
#define dmnsn_error(severity, str) \
- dmnsn_report_error((dmnsn_severity)(severity), __PRETTY_FUNCTION__, __LINE__,\
- (str))
+ dmnsn_report_error((dmnsn_severity)(severity), DMNSN_FUNC, __LINE__, (str))
/* Called by dmnsn_error() - don't call directly */
void dmnsn_report_error(dmnsn_severity severity,
diff --git a/libdimension/dimension/progress.h b/libdimension/dimension/progress.h
index 57a38b6..0de1f03 100644
--- a/libdimension/dimension/progress.h
+++ b/libdimension/dimension/progress.h
@@ -52,14 +52,16 @@ typedef struct {
pthread_mutex_t *mutex;
} dmnsn_progress;
+/* Allocate a new progress object */
dmnsn_progress *dmnsn_new_progress();
/* For failed returns from *_async() functions */
void dmnsn_delete_progress(dmnsn_progress *progress);
-/* This joins the worker thread and returns it's integer return value in
- addition to deleting `progress' */
+/* Join the worker thread and returns it's integer return value in addition to
+ deleting `progress' */
int dmnsn_finish_progress(dmnsn_progress *progress);
+/* Get the progress of the background task, out of 1.0 */
double dmnsn_get_progress(const dmnsn_progress *progress);
/* Wait for the progress to be >= prog, in a better way than spinlocking */
void dmnsn_wait_progress(const dmnsn_progress *progress, double prog);
diff --git a/libdimension/dimension/raytrace.h b/libdimension/dimension/raytrace.h
index 2be79a8..a855c24 100644
--- a/libdimension/dimension/raytrace.h
+++ b/libdimension/dimension/raytrace.h
@@ -25,6 +25,7 @@
#ifndef DIMENSION_RAYTRACE_H
#define DIMENSION_RAYTRACE_H
+/* Render a scene by raytracing */
int dmnsn_raytrace_scene(dmnsn_scene *scene);
dmnsn_progress *dmnsn_raytrace_scene_async(dmnsn_scene *scene);
diff --git a/libdimension/dimension/scene.h b/libdimension/dimension/scene.h
index 67db588..11195d4 100644
--- a/libdimension/dimension/scene.h
+++ b/libdimension/dimension/scene.h
@@ -32,6 +32,7 @@ typedef struct {
dmnsn_canvas *canvas;
} dmnsn_scene;
+/* Create a scene, initializing only the ->objects field */
dmnsn_scene *dmnsn_new_scene();
void dmnsn_delete_scene(dmnsn_scene *scene);