2#ifndef LIBSBX_SCENES_SCENE_MODULE_HPP_
3#define LIBSBX_SCENES_SCENE_MODULE_HPP_
10#include <libsbx/memory/tracking_allocator.hpp>
12#include <libsbx/math/vector4.hpp>
15#include <libsbx/core/module.hpp>
17#include <libsbx/scenes/scene.hpp>
19namespace sbx::scenes {
25 inline static const auto is_registered = register_module(stage::normal);
38 auto update() ->
void override;
40 auto load_scene(
const std::filesystem::path& path) ->
scenes::scene&;
44 auto save_scene(
const std::filesystem::path& path) ->
void {
50 template<
typename Type, std::invocable<YAML::Node&, const Type&> Save, std::invocable<YAML::Node&> Load>
51 auto register_component(
const std::string& name, Save&& save, Load&& load) ->
void {
52 _component_io_registry.register_component<Type>(name, std::forward<Save>(save), std::forward<Load>(load));
55 auto component_io(
const std::uint32_t
id) -> component_io&;
57 auto has_component_io(
const std::uint32_t
id) -> bool;
59 auto debug_lines() const -> const std::vector<line>&;
61 auto clear_debug_lines() ->
void;
63 auto add_debug_line(const sbx::math::vector3& start, const sbx::math::vector3& end, const sbx::math::color& color) ->
void;
65 auto add_coordinate_arrows(const math::matrix4x4& transform, std::float_t length = 2.0f) ->
void;
67 auto add_debug_plane(const sbx::math::vector3& origin, const sbx::math::vector3& v1, const sbx::math::vector3& v2, std::uint32_t n1, std::uint32_t n2, std::float_t s1, std::float_t s2, const sbx::math::color& color, const sbx::math::color& outline) ->
void;
69 auto add_debug_volume(const math::matrix4x4& matrix, const math::volume& volume, const sbx::math::color& color) ->
void;
71 auto add_debug_box(const math::matrix4x4& matrix, const math::volume& volume, const sbx::math::color& color) ->
void;
73 auto add_debug_circle(const math::vector3& center, const std::float_t radius, const math::vector3& normal, const math::color& color, const std::uint32_t segments = 32) ->
void;
75 auto add_debug_sphere(const math::vector3& center, const std::float_t radius, const math::color& color, const std::uint32_t segments = 32) ->
void;
77 auto add_debug_frustum(const math::matrix4x4& view, const math::matrix4x4& projection, const sbx::math::color& color) ->
void;
81 std::optional<scenes::scene> _scene;
83 component_io_registry _component_io_registry;
85 std::vector<line> _debug_lines{};
Definition: module.hpp:92
Definition: vector4.hpp:24
RGBA color value type.
Definition: color.hpp:48
Definition: scenes_module.hpp:21
RGBA color representation and utilities.
Definition: scenes_module.hpp:29