summaryrefslogtreecommitdiff
path: root/src/modules/ray
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/ray')
-rw-r--r--src/modules/ray/ray_camera.c4
-rw-r--r--src/modules/ray/ray_camera.h8
-rw-r--r--src/modules/ray/ray_euler.c2
-rw-r--r--src/modules/ray/ray_euler.h2
-rw-r--r--src/modules/ray/ray_render.c2
-rw-r--r--src/modules/ray/ray_render.h2
-rw-r--r--src/modules/ray/ray_render_object.h2
-rw-r--r--src/modules/ray/ray_render_object_plane.h2
-rw-r--r--src/modules/ray/ray_render_object_point.h2
-rw-r--r--src/modules/ray/ray_render_object_sphere.h2
10 files changed, 14 insertions, 14 deletions
diff --git a/src/modules/ray/ray_camera.c b/src/modules/ray/ray_camera.c
index a709d6f..b942cf3 100644
--- a/src/modules/ray/ray_camera.c
+++ b/src/modules/ray/ray_camera.c
@@ -21,7 +21,7 @@ static ray_3f_t project_corner(ray_3f_t *forward, ray_3f_t *left, ray_3f_t *up,
/* Produce vectors for the corners of the entire camera frame, used for interpolation. */
-static void project_corners(ray_camera_t *camera, ray_camera_frame_t *frame)
+static void project_corners(const ray_camera_t *camera, ray_camera_frame_t *frame)
{
ray_3f_t forward, left, up, right, down;
float half_horiz = (float)camera->width * 0.5f;
@@ -39,7 +39,7 @@ static void project_corners(ray_camera_t *camera, ray_camera_frame_t *frame)
/* Prepare a frame of camera projection, initializing res_frame. */
-void ray_camera_frame_prepare(ray_camera_t *camera, ray_camera_frame_t *res_frame)
+void ray_camera_frame_prepare(const ray_camera_t *camera, ray_camera_frame_t *res_frame)
{
res_frame->camera = camera;
diff --git a/src/modules/ray/ray_camera.h b/src/modules/ray/ray_camera.h
index 889beb9..e393beb 100644
--- a/src/modules/ray/ray_camera.h
+++ b/src/modules/ray/ray_camera.h
@@ -20,10 +20,10 @@ typedef struct ray_camera_t {
typedef struct ray_camera_frame_t {
- ray_camera_t *camera; /* the camera supplied to frame_begin() */
+ const ray_camera_t *camera; /* the camera supplied to frame_begin() */
- ray_3f_t nw, ne, sw, se; /* directions pointing through the corners of the frame fragment */
- float x_delta, y_delta; /* interpolation step delta along the x and y axis */
+ ray_3f_t nw, ne, sw, se; /* directions pointing through the corners of the frame fragment */
+ float x_delta, y_delta; /* interpolation step delta along the x and y axis */
} ray_camera_frame_t;
@@ -38,7 +38,7 @@ typedef struct ray_camera_fragment_t {
} ray_camera_fragment_t;
-void ray_camera_frame_prepare(ray_camera_t *camera, ray_camera_frame_t *res_frame);
+void ray_camera_frame_prepare(const ray_camera_t *camera, ray_camera_frame_t *res_frame);
void ray_camera_fragment_begin(ray_camera_frame_t *frame, fb_fragment_t *fb_fragment, ray_ray_t *res_ray, ray_camera_fragment_t *res_fragment);
diff --git a/src/modules/ray/ray_euler.c b/src/modules/ray/ray_euler.c
index 8709fa3..f143e25 100644
--- a/src/modules/ray/ray_euler.c
+++ b/src/modules/ray/ray_euler.c
@@ -5,7 +5,7 @@
#include "ray_euler.h"
/* produce orthonormal basis vectors from euler angles, rotated in the specified order */
-void ray_euler_basis(ray_euler_t *e, ray_3f_t *forward, ray_3f_t *up, ray_3f_t *left)
+void ray_euler_basis(const ray_euler_t *e, ray_3f_t *forward, ray_3f_t *up, ray_3f_t *left)
{
float cos_yaw = cosf(e->yaw);
float sin_yaw = sinf(e->yaw);
diff --git a/src/modules/ray/ray_euler.h b/src/modules/ray/ray_euler.h
index 3a74cab..39da17e 100644
--- a/src/modules/ray/ray_euler.h
+++ b/src/modules/ray/ray_euler.h
@@ -28,6 +28,6 @@ typedef struct ray_euler_t {
#define RAY_EULER_DEGREES(_deg) \
(_deg * (2 * M_PI / 360.0f))
-void ray_euler_basis(ray_euler_t *e, ray_3f_t *forward, ray_3f_t *up, ray_3f_t *left);
+void ray_euler_basis(const ray_euler_t *e, ray_3f_t *forward, ray_3f_t *up, ray_3f_t *left);
#endif
diff --git a/src/modules/ray/ray_render.c b/src/modules/ray/ray_render.c
index c17e1b9..4ca168f 100644
--- a/src/modules/ray/ray_render.c
+++ b/src/modules/ray/ray_render.c
@@ -216,7 +216,7 @@ void ray_render_trace_fragment(ray_render_t *render, fb_fragment_t *fb_fragment)
/* prepare the scene for rendering with camera, must be called whenever anything in the scene+camera pair has been changed. */
/* this is basically a time for the raytracer to precompute whatever it can which otherwise ends up occurring per-ray */
/* the camera is included so primary rays which all have a common origin may be optimized for */
-ray_render_t * ray_render_new(ray_scene_t *scene, ray_camera_t *camera)
+ray_render_t * ray_render_new(const ray_scene_t *scene, const ray_camera_t *camera)
{
ray_render_t *render;
ray_object_t *object;
diff --git a/src/modules/ray/ray_render.h b/src/modules/ray/ray_render.h
index a6d6c67..dfd769f 100644
--- a/src/modules/ray/ray_render.h
+++ b/src/modules/ray/ray_render.h
@@ -8,7 +8,7 @@
typedef struct ray_render_t ray_render_t;
-ray_render_t * ray_render_new(ray_scene_t *scene, ray_camera_t *camera);
+ray_render_t * ray_render_new(const ray_scene_t *scene, const ray_camera_t *camera);
void ray_render_free(ray_render_t *render);
void ray_render_trace_fragment(ray_render_t *render, fb_fragment_t *fb_fragment);
diff --git a/src/modules/ray/ray_render_object.h b/src/modules/ray/ray_render_object.h
index 5b4ce25..1136eee 100644
--- a/src/modules/ray/ray_render_object.h
+++ b/src/modules/ray/ray_render_object.h
@@ -25,7 +25,7 @@ typedef union ray_render_object_t {
* If the object has any pre-calculating to do, this is where it happens.
* The pre-calculated stuff is object-resident under a _prepared struct member.
*/
-static inline ray_render_object_t ray_render_object_prepare(ray_object_t *object, ray_camera_t *camera)
+static inline ray_render_object_t ray_render_object_prepare(const ray_object_t *object, const ray_camera_t *camera)
{
ray_render_object_t prepared = { .type = object->type };
diff --git a/src/modules/ray/ray_render_object_plane.h b/src/modules/ray/ray_render_object_plane.h
index e5c6fa7..6e00089 100644
--- a/src/modules/ray/ray_render_object_plane.h
+++ b/src/modules/ray/ray_render_object_plane.h
@@ -15,7 +15,7 @@ typedef struct ray_render_object_plane_t {
} ray_render_object_plane_t;
-static ray_render_object_plane_t ray_render_object_plane_prepare(ray_object_plane_t *plane, ray_camera_t *camera)
+static ray_render_object_plane_t ray_render_object_plane_prepare(const ray_object_plane_t *plane, const ray_camera_t *camera)
{
ray_render_object_plane_t prepared = { .object = *plane };
diff --git a/src/modules/ray/ray_render_object_point.h b/src/modules/ray/ray_render_object_point.h
index 43e48a1..52c6fd6 100644
--- a/src/modules/ray/ray_render_object_point.h
+++ b/src/modules/ray/ray_render_object_point.h
@@ -14,7 +14,7 @@ typedef struct ray_render_object_point_t {
} ray_render_object_point_t;
-static ray_render_object_point_t ray_render_object_point_prepare(ray_object_point_t *point, ray_camera_t *camera)
+static ray_render_object_point_t ray_render_object_point_prepare(const ray_object_point_t *point, const ray_camera_t *camera)
{
ray_render_object_point_t prepared = { .object = *point };
diff --git a/src/modules/ray/ray_render_object_sphere.h b/src/modules/ray/ray_render_object_sphere.h
index 548eb6b..addf1f5 100644
--- a/src/modules/ray/ray_render_object_sphere.h
+++ b/src/modules/ray/ray_render_object_sphere.h
@@ -21,7 +21,7 @@ typedef struct ray_render_object_sphere_t {
} ray_render_object_sphere_t;
-static ray_render_object_sphere_t ray_render_object_sphere_prepare(ray_object_sphere_t *sphere, ray_camera_t *camera)
+static ray_render_object_sphere_t ray_render_object_sphere_prepare(const ray_object_sphere_t *sphere, const ray_camera_t *camera)
{
ray_render_object_sphere_t prepared = { .object = *sphere };
© All Rights Reserved