summaryrefslogtreecommitdiff
path: root/src/scene.c
diff options
context:
space:
mode:
authoromnisci3nce <omniscient.oce@gmail.com>2024-07-12 12:47:07 +1000
committeromnisci3nce <omniscient.oce@gmail.com>2024-07-12 12:47:07 +1000
commitf74cf52946f4e569a26bc81105537b40be95c2c7 (patch)
tree1d000367350d0e28eb7cfbc800286a0ed30a4e6c /src/scene.c
parentfedba7ff68924ff50022405fc9103a5acf7013fe (diff)
wip: big makeover
Diffstat (limited to 'src/scene.c')
-rw-r--r--src/scene.c91
1 files changed, 46 insertions, 45 deletions
diff --git a/src/scene.c b/src/scene.c
index d9fea05..f6f5fb7 100644
--- a/src/scene.c
+++ b/src/scene.c
@@ -1,56 +1,57 @@
#include "scene.h"
+#include "camera.h"
#include "core.h"
#include "log.h"
#include "maths.h"
#include "render_types.h"
-extern core g_core;
+extern Core g_core;
-void scene_init(scene *s) {
- memset(s, 0, sizeof(scene));
- s->renderables = render_entity_darray_new(10);
- // default camera position - moved slightly along Z axis looking at 0,0,0
- vec3 cam_pos = vec3_create(0, 0, -5);
- s->camera = camera_create(cam_pos, vec3_negate(cam_pos), VEC3_Y, deg_to_rad(45.0));
-}
-void scene_free(scene *s) { render_entity_darray_free(s->renderables); }
+// void scene_init(scene *s) {
+// memset(s, 0, sizeof(scene));
+// s->renderables = render_entity_darray_new(10);
+// // default camera position - moved slightly along Z axis looking at 0,0,0
+// Vec3 cam_pos = vec3_create(0, 0, -5);
+// s->camera = Camera_Create(cam_pos, vec3_negate(cam_pos), VEC3_Y, deg_to_rad(45.0));
+// }
+// void scene_free(scene *s) { render_entity_darray_free(s->renderables); }
-void scene_set_dir_light(directional_light light) { g_core.default_scene.dir_light = light; }
-void scene_add_point_light(point_light light) {
- scene s = g_core.default_scene;
- if (s.point_lights_count == 4) {
- WARN("Already 4 point lights, we can't add more.");
- } else {
- s.point_lights[s.point_lights_count] = light;
- s.point_lights_count++;
- }
-}
-void scene_add_model(model_handle model, transform3d transform) {
- render_entity renderable = { .model = model, .tf = transform };
- render_entity_darray_push(g_core.default_scene.renderables, renderable);
-}
+// void scene_set_dir_light(directional_light light) { g_core.default_scene.dir_light = light; }
+// void scene_add_point_light(point_light light) {
+// scene s = g_core.default_scene;
+// if (s.point_lights_count == 4) {
+// WARN("Already 4 point lights, we can't add more.");
+// } else {
+// s.point_lights[s.point_lights_count] = light;
+// s.point_lights_count++;
+// }
+// }
+// void scene_add_model(model_handle model, transform3d transform) {
+// render_entity renderable = { .model = model, .tf = transform };
+// render_entity_darray_push(g_core.default_scene.renderables, renderable);
+// }
-bool scene_remove_model(model_handle model) {
- scene s = g_core.default_scene;
- for (u32 i = 0; i <= s.renderables->len; i++) {
- if (s.renderables->data[i].model.raw == model.raw) {
- // TODO: add remove function to darray
- }
- }
- return true;
-}
+// bool scene_remove_model(model_handle model) {
+// scene s = g_core.default_scene;
+// for (u32 i = 0; i <= s.renderables->len; i++) {
+// if (s.renderables->data[i].model.raw == model.raw) {
+// // TODO: add remove function to darray
+// }
+// }
+// return true;
+// }
-void scene_set_model_transform(model_handle model, transform3d new_transform) {
- scene s = g_core.default_scene;
- for (u32 i = 0; i <= s.renderables->len; i++) {
- if (s.renderables->data[i].model.raw == model.raw) {
- s.renderables->data[i].tf = new_transform;
- }
- }
-}
+// void scene_set_model_transform(model_handle model, transform3d new_transform) {
+// scene s = g_core.default_scene;
+// for (u32 i = 0; i <= s.renderables->len; i++) {
+// if (s.renderables->data[i].model.raw == model.raw) {
+// s.renderables->data[i].tf = new_transform;
+// }
+// }
+// }
-void scene_set_camera(vec3 pos, vec3 front) {
- scene s = g_core.default_scene;
- s.camera.position = pos;
- s.camera.front = front;
-}
+// void scene_set_camera(vec3 pos, vec3 front) {
+// scene s = g_core.default_scene;
+// s.camera.position = pos;
+// s.camera.front = front;
+// }