summaryrefslogtreecommitdiff
path: root/src/modules/ray/ray.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2017-12-09 22:26:19 -0800
committerVito Caputo <vcaputo@pengaru.com>2017-12-10 12:13:41 -0800
commit3249e0e65e7a9361eb3604d46496182fda9f83c0 (patch)
tree8e1c435b82ec084d3d61acbc691e74374e7f4315 /src/modules/ray/ray.c
parenta8ab3d7cff5a7dc3085fd592109866b2d8700e30 (diff)
ray: add module context ray_context_t
Before I can clean up the ray_scene_t._prepared kludge I need a place to keep state from frame prepare to render, enter context. Future commits will migrate the _prepared stuff into a separate ray_render_t which is constructed on prepare then acted on in fragment render. Then spatial acceleration structures may be added, constructed at prepare phase and shared across the concurrent rendering.
Diffstat (limited to 'src/modules/ray/ray.c')
-rw-r--r--src/modules/ray/ray.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/modules/ray/ray.c b/src/modules/ray/ray.c
index 8688ad9..5f6326d 100644
--- a/src/modules/ray/ray.c
+++ b/src/modules/ray/ray.c
@@ -117,6 +117,22 @@ static ray_scene_t scene = {
static float r;
+typedef struct ray_context_t {
+} ray_context_t;
+
+
+static void * ray_create_context(void)
+{
+ return calloc(1, sizeof(ray_context_t));
+}
+
+
+static void ray_destroy_context(void *context)
+{
+ free(context);
+}
+
+
static int ray_fragmenter(void *context, const fb_fragment_t *fragment, unsigned num, fb_fragment_t *res_fragment)
{
return fb_fragment_tile_single(fragment, 64, num, res_fragment);
@@ -165,6 +181,8 @@ static void ray_render_fragment(void *context, fb_fragment_t *fragment)
rototiller_module_t ray_module = {
+ .create_context = ray_create_context,
+ .destroy_context = ray_destroy_context,
.prepare_frame = ray_prepare_frame,
.render_fragment = ray_render_fragment,
.name = "ray",
© All Rights Reserved