6#include <nlohmann/json.hpp>
8#include "ecs/entity_mapping.h"
9#include "ecs/environment.h"
10#include "resource/asset_type.h"
11#include "ecs/component/animation/animation.h"
12#include "ecs/component/animation/animator.h"
13#include "ecs/component/animation/bone_socket.h"
14#include "ecs/component/audio/audio_listener.h"
15#include "ecs/component/audio/audio_source.h"
16#include "ecs/component/core/hierarchy.h"
17#include "ecs/component/core/name.h"
18#include "ecs/component/core/transform.h"
19#include "ecs/component/physics/character_controller.h"
20#include "ecs/component/physics/collider.h"
21#include "ecs/component/physics/joint.h"
22#include "ecs/component/physics/ragdoll.h"
23#include "ecs/component/physics/rigidbody.h"
24#include "ecs/component/render/camera.h"
25#include "ecs/component/render/decal.h"
26#include "ecs/component/render/irradiance_volume.h"
27#include "ecs/component/render/light.h"
28#include "ecs/component/render/lod.h"
29#include "ecs/component/render/mesh.h"
30#include "ecs/component/render/particle_emitter.h"
31#include "ecs/component/render/reflection_probe.h"
32#include "ecs/component/ui/ui_button.h"
33#include "ecs/component/ui/ui_canvas.h"
34#include "ecs/component/ui/ui_element.h"
35#include "ecs/component/ui/ui_image.h"
36#include "ecs/component/ui/ui_scroll.h"
37#include "ecs/component/ui/ui_text.h"
38#include "system/script/script_component.h"
40namespace Vkm::Engine {
57#define VKM_SCENE_COMPONENTS(P, R, E) \
59 P(Transform, "Transform") \
62 P(Rigidbody, "Rigidbody") \
63 R(Collider, "Collider") \
64 P(CharacterController, "CharacterController") \
66 E(Ragdoll, "Ragdoll") \
70 P(ParticleEmitter, "ParticleEmitter") \
71 R(AudioSource, "AudioSource") \
72 P(AudioListener, "AudioListener") \
73 P(IrradianceVolume, "IrradianceVolume") \
74 P(ReflectionProbe, "ReflectionProbe") \
75 P(Animation, "Animation") \
76 R(Animator, "Animator") \
77 P(BoneSocket, "BoneSocket") \
78 P(ScriptComponent, "Script") \
79 P(UICanvas, "UICanvas") \
80 P(UIElement, "UIElement") \
81 R(UIImage, "UIImage") \
83 P(UIButton, "UIButton") \
84 P(UIScroll, "UIScroll")
99 nlohmann::json save(
const Name&);
100 void load(
const nlohmann::json&,
Name&);
111 void load(
const nlohmann::json&,
Transform&);
113 nlohmann::json save(
const Camera&);
114 void load(
const nlohmann::json&,
Camera&);
116 nlohmann::json save(
const Light&);
117 void load(
const nlohmann::json&,
Light&);
125 void load(
const nlohmann::json&,
Rigidbody&);
148 nlohmann::json save(
const Joint&,
const EntityNamer&);
149 void load(
const nlohmann::json&,
Joint&,
const EntityResolver&);
157 nlohmann::json save(
const Ragdoll&,
const EntityNamer&);
158 void load(
const nlohmann::json&,
Ragdoll&,
const EntityResolver&);
178 void load(
const nlohmann::json&,
BoneSocket&);
207 nlohmann::json save(
const UICanvas&);
208 void load(
const nlohmann::json&,
UICanvas&);
211 void load(
const nlohmann::json&,
UIElement&);
216 nlohmann::json save(
const UIText&);
217 void load(
const nlohmann::json&,
UIText&);
219 nlohmann::json save(
const UIButton&);
220 void load(
const nlohmann::json&,
UIButton&);
222 nlohmann::json save(
const UIScroll&);
223 void load(
const nlohmann::json&,
UIScroll&);
247 void load(
const nlohmann::json&,
Animation&);
267 std::vector<MeshHandle> meshes;
268 std::vector<MaterialHandle> materials;
269 std::vector<SkeletonHandle> skeletons;
270 std::vector<TextureHandle> textures;
271 std::vector<AnimationClipHandle> clips;
272 std::vector<AudioClipHandle> sounds;
297 AssetType
type = AssetType::Count;
320 class UnresolvedScope {
322 UnresolvedScope() =
default;
325 UnresolvedScope(
const UnresolvedScope& other) =
delete;
326 UnresolvedScope& operator=(
const UnresolvedScope& other) =
delete;
328 UnresolvedScope(UnresolvedScope && other) =
delete;
329 UnresolvedScope& operator=(UnresolvedScope && other) =
delete;
Open type-erased resource registry with typed handles and generational lifetimes.
Definition resource_manager.h:46
Central registry managing entities and an open set of component types.
Definition scene.h:29
Per-component (de)serialization to JSON.
Definition component_serializer.h:94
uint32_t loadParentIndex(const nlohmann::json &json)
Read a saved Hierarchy's parent reference as a saved slot.
void emitAssetRefs(const Collider &, AssetRefs &)
Record every asset the component references into refs.
std::vector< UnresolvedRef > takeUnresolvedRefs()
Take the references the loads since the last call could not resolve.
Component representing an animation that can be applied to an entity.
Definition animation.h:17
What drives a rig: the skeleton, the clip playing on it, and the playback position.
Definition animator.h:45
The ear: the pose every spatial source is heard relative to.
Definition audio_listener.h:16
A sound emitter: one clip, how loud, and where it is heard from.
Definition audio_source.h:17
Carried by a weapon, a hat or a muzzle flash to ride a bone of the rig it hangs off.
Definition bone_socket.h:23
Component representing a camera, containing projection and view parameters.
Definition camera.h:25
Turns a desired direction into velocity on a Rigidbody, and reports what the body stands on.
Definition character_controller.h:16
Collision geometry attached to an entity, evaluated in its Transform frame.
Definition collider.h:72
Every asset a set of components references, one list per kind.
Definition component_serializer.h:266
An asset name a load failed to resolve, and the field it was read from.
Definition component_serializer.h:294
AssetType type
Which kind the loader looked it up as.
Definition component_serializer.h:297
A projected decal - bullet holes, blood, scorch marks.
Definition decal.h:16
The scene's lighting environment: sky, night sky and fog.
Definition environment.h:130
Component representing parent-child relationships in an entity hierarchy.
Definition hierarchy.h:16
Baked global illumination: a grid of irradiance probes filling a box.
Definition irradiance_volume.h:21
Ties this entity's body to another, at a point on each.
Definition joint.h:31
Distance-selected geometry for an entity.
Definition lod.h:25
Component representing a light source in the scene.
Definition light.h:34
Component representing a renderable mesh (geometry + material) in the world.
Definition mesh.h:13
Component for giving entities a human-readable name.
Definition name.h:15
CPU-simulated particle emitter - muzzle flashes, impacts, smoke puffs.
Definition particle_emitter.h:18
The physics world's own parameters, read once per fixed step.
Definition physics_settings.h:14
Turns a rig over to physics, and back.
Definition ragdoll.h:49
Local reflection + irradiance probe.
Definition reflection_probe.h:18
Dynamics state for a physics body: motion, material response and mass.
Definition rigidbody.h:31
ECS component attaching owned, polymorphic Behaviors to an entity.
Definition script_component.h:36
Root of a screen-space UI layer.
Definition ui_canvas.h:18
The 2D rect of a UI node - the screen-space analogue of Transform.
Definition ui_element.h:44
A filled quad drawn over its element's resolved rect.
Definition ui_image.h:16
Text drawn within its element's rect, on as many lines as it breaks into.
Definition ui_text.h:24