Unravel Engine C++ Reference
Loading...
Searching...
No Matches
defaults.h
Go to the documentation of this file.
1#pragma once
2#include <engine/engine_export.h>
3
6#include <base/basetypes.hpp>
7#include <context/context.hpp>
8#include <engine/ecs/ecs.h>
14
15namespace unravel
16{
17
23{
29 static auto init(rtti::context& ctx) -> bool;
30
36 static auto deinit(rtti::context& ctx) -> bool;
37
43 static auto init_assets(rtti::context& ctx) -> bool;
44
52 static auto create_embedded_mesh_entity(rtti::context& ctx, scene& scn, const std::string& name) -> entt::handle;
53
63 static auto create_prefab_at(rtti::context& ctx,
64 scene& scn,
65 const std::string& key,
66 const camera& cam,
67 math::vec2 pos) -> entt::handle;
68
77 static auto create_prefab_at(rtti::context& ctx,
78 scene& scn,
79 const std::string& key,
80 math::vec3 pos) -> entt::handle;
81
89 static auto create_prefab_at(rtti::context& ctx,
90 scene& scn,
91 const std::string& key) -> entt::handle;
101 static auto create_mesh_entity_at(rtti::context& ctx,
102 scene& scn,
103 const std::string& key,
104 const camera& cam,
105 math::vec2 pos) -> entt::handle;
106
115 static auto create_mesh_entity_at(rtti::context& ctx,
116 scene& scn,
117 const std::string& key,
118 math::vec3 pos = {0.0f, 0.0f, 0.0f}) -> entt::handle;
119
128 static auto create_light_entity(rtti::context& ctx, scene& scn, light_type type, const std::string& name)
129 -> entt::handle;
130
139 static auto create_reflection_probe_entity(rtti::context& ctx, scene& scn, probe_type type, const std::string& name)
140 -> entt::handle;
141
149 static auto create_camera_entity(rtti::context& ctx, scene& scn, const std::string& name) -> entt::handle;
150
158 static auto create_ui_document_entity(rtti::context& ctx, scene& scn, const std::string& name) -> entt::handle;
159
167 static auto create_text_entity(rtti::context& ctx, scene& scn, const std::string& name) -> entt::handle;
168
174 static void create_default_3d_scene(rtti::context& ctx, scene& scn);
175
181 static void focus_camera_on_entities(entt::handle camera, const std::vector<entt::handle>& entities);
182
189 static void focus_camera_on_entities(entt::handle camera,
190 const std::vector<entt::handle>& entities,
191 float duration);
192
200 static void focus_camera_on_bounds(entt::handle camera,
201 const math::bsphere& bounds,
202 float duration);
203
211 static void focus_camera_on_bounds(entt::handle camera,
212 const math::bbox& bounds,
213 float duration);
214
223 template<typename T>
225 scene& scn,
226 const asset_handle<T>& asset,
227 const usize32_t& size);
228
235
241 static auto calc_bounds_global(entt::handle entity, int depth = -1) -> math::bbox;
242
248 static auto calc_bounds_sphere_global(entt::handle entity, bool use_bbox_diagonal = true) -> math::bsphere;
249
250private:
258 static auto create_default_3d_scene_for_preview(rtti::context& ctx, scene& scn, const usize32_t& size)
259 -> entt::handle;
260
261 // Internal helper for timed focus transitions (shared between bbox and bsphere variants)
262 static void run_camera_focus_transition(entt::handle camera,
263 const math::vec3& target_center,
264 float radius,
265 bool keep_rotation,
266 float duration);
267};
268
269} // namespace unravel
manifold_type type
Provides storage for common representation of spherical bounding volume, and wraps up common function...
Definition bsphere.h:18
Class representing a camera. Contains functionality for manipulating and updating a camera....
Definition camera.h:35
std::string name
Definition hub.cpp:27
probe_type
Enum class representing the type of reflection probe.
light_type
Enum representing the type of light.
Definition light.h:14
entt::entity entity
Represents a handle to an asset, providing access and management functions.
Storage for box vector values and wraps up common functionality.
Definition bbox.h:21
Provides default initialization and creation functions for various entities and assets.
Definition defaults.h:23
static auto create_reflection_probe_entity(rtti::context &ctx, scene &scn, probe_type type, const std::string &name) -> entt::handle
Creates a reflection probe entity.
Definition defaults.cpp:559
static void focus_camera_on_bounds(entt::handle camera, const math::bsphere &bounds, float duration)
Focuses a camera on bounds with a timed transition.
static auto init_assets(rtti::context &ctx) -> bool
Initializes default assets.
Definition defaults.cpp:290
static auto init(rtti::context &ctx) -> bool
Initializes default settings and assets.
Definition defaults.cpp:254
static auto create_ui_document_entity(rtti::context &ctx, scene &scn, const std::string &name) -> entt::handle
Creates a UI document entity.
Definition defaults.cpp:597
static void focus_camera_on_entities(entt::handle camera, const std::vector< entt::handle > &entities)
Focuses a camera on a specified entity.
Definition defaults.cpp:783
static auto create_text_entity(rtti::context &ctx, scene &scn, const std::string &name) -> entt::handle
Creates a text entity.
Definition defaults.cpp:604
static void create_default_3d_scene_for_asset_preview(rtti::context &ctx, scene &scn, const asset_handle< T > &asset, const usize32_t &size)
Creates a default 3D scene for asset preview.
static auto create_embedded_mesh_entity(rtti::context &ctx, scene &scn, const std::string &name) -> entt::handle
Creates an embedded mesh entity.
Definition defaults.cpp:422
static auto calc_bounds_sphere_global(entt::handle entity, bool use_bbox_diagonal=true) -> math::bsphere
Calculates the bounding sphere of an entity.
Definition defaults.cpp:854
static auto calc_bounds_global(entt::handle entity, int depth=-1) -> math::bbox
Calculates the bounding box of an entity.
Definition defaults.cpp:837
static auto create_light_entity(rtti::context &ctx, scene &scn, light_type type, const std::string &name) -> entt::handle
Creates a light entity.
Definition defaults.cpp:527
static auto create_prefab_at(rtti::context &ctx, scene &scn, const std::string &key, const camera &cam, math::vec2 pos) -> entt::handle
Creates a prefab entity at a specified position.
Definition defaults.cpp:468
static void focus_camera_on_bounds(entt::handle camera, const math::bbox &bounds, float duration)
Focuses a camera on bounds with a timed transition.
static void create_default_3d_scene_for_editing(rtti::context &ctx, scene &scn)
Creates a default 3D scene for editing.
Definition defaults.cpp:635
static auto create_camera_entity(rtti::context &ctx, scene &scn, const std::string &name) -> entt::handle
Creates a camera entity.
Definition defaults.cpp:581
static auto create_mesh_entity_at(rtti::context &ctx, scene &scn, const std::string &key, const camera &cam, math::vec2 pos) -> entt::handle
Creates a mesh entity at a specified position.
Definition defaults.cpp:512
static void create_default_3d_scene(rtti::context &ctx, scene &scn)
Creates a default 3D scene.
Definition defaults.cpp:615
static auto deinit(rtti::context &ctx) -> bool
Deinitializes default settings and assets.
Definition defaults.cpp:261
Represents a scene in the ACE framework, managing entities and their relationships.
Definition scene.h:21