Loading...
Searching...
No Matches
GeometryToBuffer.hpp
1#pragma once
2#include <Threedim/GeometryToBufferStrategies.hpp>
3#include <halp/buffer.hpp>
4
5namespace Threedim
6{
8{
9public:
10 halp_meta(name, "Extract buffer")
11 halp_meta(category, "Visuals/Utilities")
12 halp_meta(c_name, "extract_attribute")
13 halp_meta(description, "Extract a selected vertex attribute from geometry into a GPU buffer.")
14 halp_meta(manual_url, "https://ossia.io/score-docs/processes/extract-buffer.html")
15 halp_meta(uuid, "207ab744-1f3e-4e72-9a77-db6017cf3dd5")
16
17 // FIXME allow to use strings instead.
18 enum Attribute
19 {
20 Position,
21 TexCoord,
22 Color,
23 Normal,
24 Tangent,
25
26 Attribute_0,
27 Attribute_1,
28 Attribute_2,
29 Attribute_3,
30 Attribute_4,
31 Attribute_5,
32 Attribute_6,
33 Attribute_7,
34 Attribute_8,
35
36 Index,
37
38 Buffer_0,
39 Buffer_1,
40 Buffer_2,
41 Buffer_3,
42 Buffer_4,
43 Buffer_5,
44 Buffer_6,
45 Buffer_7,
46 Buffer_8
47 };
48
49 struct ins
50 {
51 struct
52 {
53 halp_meta(name, "Geometry");
54 halp::dynamic_gpu_geometry mesh;
55 float transform[16]{};
56 bool dirty_mesh = false;
57 bool dirty_transform = false;
58 } geometry;
59
60 halp::combobox_t<"Attribute", Attribute> attribute;
61 halp::toggle<"Pad vec3 to vec4"> pad_to_vec4;
62 } inputs;
63
64 struct
65 {
66 halp::gpu_buffer_output<"Buffer"> buffer;
67 } outputs;
68
70
71 void init(score::gfx::RenderList& renderer, QRhiResourceUpdateBatch& res);
72
73 void update(
74 score::gfx::RenderList& renderer, QRhiResourceUpdateBatch& res,
76
77 void release(score::gfx::RenderList& r);
78
79 void runInitialPasses(
80 score::gfx::RenderList& renderer, QRhiCommandBuffer& commands,
81 QRhiResourceUpdateBatch*& res, score::gfx::Edge& edge);
82
83 void operator()();
84
85private:
86 [[nodiscard]] static halp::attribute_semantic
87 toAttributeLocation(Attribute attr) noexcept;
88 void releaseStrategy();
89 void updateOutput();
90
91 ExtractionStrategyVariant m_strategy;
92 Attribute m_currentAttribute{Position};
93 ossia::geometry::gpu_buffer m_currentBuffer{};
94 bool m_currentPadToVec4{false};
95};
96}
Definition GeometryToBuffer.hpp:8
List of nodes to be rendered to an output.
Definition RenderList.hpp:36
Definition GeometryToBuffer.hpp:50
Definition TinyObj.hpp:27
Connection between two score::gfx::Port.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:236