Loading...
Searching...
No Matches
SceneGroup.hpp
1#pragma once
2#include <Threedim/TinyObj.hpp>
3#include <halp/controls.hpp>
4#include <halp/meta.hpp>
5
6#include <ossia/dataflow/geometry_port.hpp>
7
8#include <Gfx/Graph/GpuResourceRegistry.hpp>
9
10#include <QQuaternion>
11
12#include <cstdint>
13#include <memory>
14#include <string>
15
16class QRhiResourceUpdateBatch;
17
18namespace score::gfx
19{
20class RenderList;
21struct Edge;
22}
23
24namespace Threedim
25{
26
27// Wraps up to 4 scene inputs under a single named parent scene_node
28// with its own TRS. The group name becomes addressable by downstream
29// filters / overrides via the usual path pattern — so
30// `SceneGroup(name="ProsceniumSet")` +
31// `SceneGraphFilter(paths=["/ProsceniumSet/**"])` is the canonical
32// "bundle and tag a subset" pattern.
33//
34// Materials / animations / cameras / skeletons / environment are
35// merged additively from all inputs (first-wins on singletons like
36// active_camera_id and environment), same convention as
37// MergeGeometries / merge_scenes.
39{
40public:
41 halp_meta(name, "Scene Group")
42 halp_meta(category, "Visuals/3D/Scene")
43 halp_meta(c_name, "scene_group")
44 halp_meta(authors, "ossia team")
45 halp_meta(
46 manual_url,
47 "https://ossia.io/score-docs/processes/scene-group.html")
48 halp_meta(uuid, "8a3b5e2d-7c4f-4b9e-9d1a-6f8e2c5d3a7b")
49
50 struct ins
51 {
52 struct { halp_meta(name, "Scene 0"); ossia::scene_spec scene; uint8_t dirty{0}; } scene0;
53 struct { halp_meta(name, "Scene 1"); ossia::scene_spec scene; uint8_t dirty{0}; } scene1;
54 struct { halp_meta(name, "Scene 2"); ossia::scene_spec scene; uint8_t dirty{0}; } scene2;
55 struct { halp_meta(name, "Scene 3"); ossia::scene_spec scene; uint8_t dirty{0}; } scene3;
56
57 // Port-driven rebuild: controls trigger rebuild(); upstream scene
58 // inputs detected in operator()().
59 struct : halp::lineedit<"Name", "">
60 { void update(SceneGroup& n) { n.rebuild(); } } name;
61 struct : PositionControl
62 { void update(SceneGroup& n) { n.rebuild(); } } position;
63 struct : RotationControl
64 { void update(SceneGroup& n) { n.rebuild(); } } rotation;
65 struct : ScaleControl
66 { void update(SceneGroup& n) { n.rebuild(); } } scale;
67 } inputs;
68
69 struct outs
70 {
71 struct { halp_meta(name, "Scene Out"); ossia::scene_spec scene; uint8_t dirty{0}; } scene_out;
72 } outputs;
73
74 void rebuild();
75 void operator()();
76
77 void init(score::gfx::RenderList& r, QRhiResourceUpdateBatch& res);
78 void update(
79 score::gfx::RenderList& r, QRhiResourceUpdateBatch& res,
81 void release(score::gfx::RenderList& r);
82
83 std::shared_ptr<const ossia::scene_state> m_cached_out;
84 uint8_t m_pending_dirty{0xFF};
85 const ossia::scene_state* m_cached_in[4]{};
86 int64_t m_cached_ver[4]{-1, -1, -1, -1};
87 int64_t m_version_counter{0};
88
90 ossia::gpu_slot_ref m_xform_ref{};
91};
92
93}
Definition SceneGroup.hpp:39
List of nodes to be rendered to an output.
Definition RenderList.hpp:30
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
Definition TinyObj.hpp:98
Definition TinyObj.hpp:103
Definition TinyObj.hpp:107
Definition SceneGroup.hpp:51
Definition SceneGroup.hpp:70
Connection between two score::gfx::Port.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:103
Definition GpuResourceRegistry.hpp:84