#pragma once #include "MinimalEngine.h" #include "Graphics/Graphics.h" #include "LightEnvironment.h" #include "Physics/PhysicsSystem.h" #include "FluidScene.h" #include namespace Seele { DECLARE_REF(Material) DECLARE_REF(Entity) class Scene { public: Scene(Gfx::PGraphics graphics); ~Scene(); void bakeLighting(); void update(float deltaTime); entt::entity createEntity() { return registry.create(); } void destroyEntity(entt::entity identifier) { registry.destroy(identifier); } template Component& attachComponent(entt::entity entity, Args&&... args) { return registry.emplace(entity, std::forward(args)...); } template Component& accessComponent(entt::entity entity) { return registry.get(entity); } template const Component& accessComponent(entt::entity entity) const { return registry.get(entity); } template void view(Func func) requires std::is_invocable_v || std::is_invocable_v { registry.view().each(func); } template auto constructCallback() { return registry.on_construct(); } template auto destroyCallback() { return registry.on_destroy(); } PLightEnvironment getLightEnvironment() { return lightEnv; } PFluidScene getFluidScene() { return fluidScene; } Gfx::PGraphics getGraphics() const { return graphics; } entt::registry registry; private: Gfx::PGraphics graphics; OLightEnvironment lightEnv; OFluidScene fluidScene; PhysicsSystem physics; Array lightMaps; }; DEFINE_REF(Scene) } // namespace Seele