diff --git a/src/api/c-ray.c b/src/api/c-ray.c index 3147922c..384f1d04 100644 --- a/src/api/c-ray.c +++ b/src/api/c-ray.c @@ -263,14 +263,16 @@ void cr_destroy_renderer(struct cr_renderer *ext) { struct cr_scene; // Do we want multiple scenes anyway? -struct cr_scene *cr_scene_create(struct cr_renderer *r) { - (void)r; - return NULL; +struct cr_scene *cr_scene_create(struct cr_renderer *ext) { + if (!ext) return NULL; + struct renderer *r = (struct renderer *)ext; + return (struct cr_scene *)r->scene; } -void cr_scene_destroy(struct cr_scene *s) { - //TODO - (void)s; +void cr_scene_destroy(struct cr_scene *ext) { + if (!ext) return; + struct world *s = (struct world *)ext; + scene_destroy(s); } struct cr_object; diff --git a/src/datatypes/scene.c b/src/datatypes/scene.c index b4be8d7b..d70bb4d6 100644 --- a/src/datatypes/scene.c +++ b/src/datatypes/scene.c @@ -19,7 +19,7 @@ #include "poly.h" //Free scene data -void destroyScene(struct world *scene) { +void scene_destroy(struct world *scene) { if (scene) { camera_arr_free(&scene->cameras); for (size_t i = 0; i < scene->meshes.count; ++i) { diff --git a/src/datatypes/scene.h b/src/datatypes/scene.h index 64f0d0f4..aebfc815 100644 --- a/src/datatypes/scene.h +++ b/src/datatypes/scene.h @@ -38,4 +38,4 @@ struct world { float backgroundOffset; }; -void destroyScene(struct world *scene); +void scene_destroy(struct world *scene);