7#include "hellfire/assets/AssetManager.h"
8#include "hellfire/scene/Scene.h"
9#include "hellfire/ecs/components/MeshComponent.h"
10#include "hellfire/ecs/RenderableComponent.h"
19 for (
const auto id: scene.get_all_entities() | std::views::keys) {
20 Entity* entity = scene.get_entity(id);
21 if (!entity)
continue;
23 resolve_entity(*entity);
29 if (
auto* mesh = entity.get_component<MeshComponent>()) {
30 AssetID id = mesh->get_mesh_asset();
36 if (
auto* renderable = entity.get_component<RenderableComponent>()) {
37 AssetID id = renderable->get_material_asset();
std::shared_ptr< Mesh > get_mesh(AssetID id)
std::shared_ptr< Material > get_material(AssetID id)
void resolve(Scene &scene)
void resolve_entity(Entity &entity)
SceneAssetResolver(AssetManager &assets)
void destroy_scene(Scene *scene)
CameraComponent * get_active_camera() const
void save_current_scene()
bool save_scene(Scene *scene)
Scene * create_scene(const std::string &name="GameScene")
Scene * load_scene(const std::filesystem::path &filename)
std::optional< AssetID > get_scene_asset_id(Scene *scene) const
void set_active_camera(EntityID camera) const
std::optional< AssetID > get_active_scene_asset_id() const
SceneActivatedCallback scene_activated_callback_
Scene * get_active_scene() const
bool save_scene_as(const std::string &filename, Scene *scene)
std::vector< Scene * > scenes_
std::vector< Scene * > get_scenes()
std::unordered_map< Scene *, AssetID > scene_asset_ids_
EntityID find_entity_by_name(const std::string &name)
std::vector< EntityID > get_camera_entities() const
Scene * load_scene(AssetID asset_id, const std::filesystem::path &filename)
void update(float delta_time)
Manages a collection of entities and their hierarchical relationships.
Entity * find_entity_by_name(const std::string &name)
Finds an entity by its name.
Scene(std::string name="Unnamed")
Constructs a new Scene with an optional name.
void set_playing(bool active)
virtual void update(float delta_time)
Updates all entities in the scene.
void set_default_camera(EntityID camera_id)
Sets the default camera for the scene.
CameraComponent * get_default_camera() const
void set_source_filename(const std::filesystem::path &filename)
const std::filesystem::path & get_source_filename() const
void register_all_components()
constexpr AssetID INVALID_ASSET_ID
static bool serialize(std::ostream &output, const Scene *scene)
static bool deserialize(std::istream &input, Scene *scene)