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