Loading...
Searching...
No Matches
BufferLoader.hpp
1#pragma once
2#include <Gfx/Graph/Node.hpp>
3#include <Gfx/Graph/NodeRenderer.hpp>
4#include <Gfx/Graph/RenderList.hpp>
5
6#include <ossia/detail/mutex.hpp>
7#include <ossia/detail/pod_vector.hpp>
8
9#include <Threedim/Ply.hpp>
10#include <Threedim/TinyObj.hpp>
11#include <halp/buffer.hpp>
12#include <halp/controls.hpp>
13#include <halp/file_port.hpp>
14#include <halp/geometry.hpp>
15#include <halp/meta.hpp>
16
17namespace Threedim
18{
19
21{
22public:
23 halp_meta(name, "Splat loader")
24 halp_meta(category, "Visuals/Meshes")
25 halp_meta(c_name, "buffer_loader")
26 halp_meta(authors, "Jean-Michaƫl Celerier, miniPLY authors")
27 halp_meta(manual_url, "https://ossia.io/score-docs/processes/meshes.html#splat-loader")
28 halp_meta(description, "Loads gaussian splats from a PLY model")
29 halp_meta(uuid, "bab30770-d6d7-4727-ad43-38eacdd910a7")
30
31 struct ins
32 {
33 struct obj_t : halp::file_port<"3DGS PLY file", halp::mmap_file_view>
34 {
35 halp_meta(extensions, "3DGS files (*.ply)");
36 static std::function<void(SplatLoader&)> process(file_type data)
37 {
38 auto loaded = Threedim::GaussianSplatsFromPly(data.filename);
39 return [l = std::move(loaded)](SplatLoader& self) mutable {
40 std::swap(self.m_splat_data.buffer, l.buffer);
41 self.m_splat_data.splatCount = l.splatCount;
42 self.m_splat_data.shRestCount = l.shRestCount;
43 self.m_changed = true;
44 };
45 }
46 } obj;
47 } inputs;
48
49 struct
50 {
51 halp::gpu_buffer_output<"Output"> buffer;
52 } outputs;
53
54 void init(score::gfx::RenderList& renderer, QRhiResourceUpdateBatch& res);
55
56 void update(
57 score::gfx::RenderList& renderer, QRhiResourceUpdateBatch& res,
59
60 void release(score::gfx::RenderList& r);
61
62 void runInitialPasses(
63 score::gfx::RenderList& renderer, QRhiCommandBuffer& commands,
64 QRhiResourceUpdateBatch*& res, score::gfx::Edge& edge);
65
66 void operator()();
67 QRhiBuffer* m_last_buffer{};
68 GaussianSplatData m_splat_data;
69 bool m_changed{};
70};
71
72}
Definition BufferLoader.hpp:21
List of nodes to be rendered to an output.
Definition RenderList.hpp:19
Definition Ply.hpp:27
Connection between two score::gfx::Port.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:71