Loading...
Searching...
No Matches
PCLToGeometry.hpp
1#pragma once
2
3#include <Threedim/TinyObj.hpp>
4#include <boost/container/vector.hpp>
5#include <halp/controls.hpp>
6#include <halp/geometry.hpp>
7#include <halp/meta.hpp>
8
9#include <halp/texture.hpp>
10#include <ossia/detail/pod_vector.hpp>
11
12namespace halp
13{
15{
16 void* handle{};
17 int bytesize{};
18};
19
20template <static_string lit>
22{
23 static clang_buggy_consteval auto name() { return std::string_view{lit.value}; }
24
25 operator const halp::gpu_buffer&() const noexcept { return buffer; }
26 operator halp::gpu_buffer&() noexcept { return buffer; }
27
28 halp::gpu_buffer buffer{};
29};
30
32{
33 struct buffers
34 {
35 struct
36 {
37 enum
38 {
39 dynamic,
40 vertex
41 };
42 void* handle{};
43 int size{};
44 bool dirty{};
45 } main_buffer;
46 } buffers;
47
48 struct bindings
49 {
50 struct
51 {
52 enum
53 {
54 per_vertex
55 };
56 int stride = 3 * sizeof(float);
57 int step_rate = 1;
58 } position_binding;
59 };
60
62 {
63 struct
64 {
65 enum
66 {
67 position
68 };
69 using datatype = float[3];
70 int32_t offset = 0;
71 int32_t binding = 0;
72 } position;
73 };
74
75 struct
76 {
77 struct
78 {
79 static constexpr auto buffer() { return &buffers::main_buffer; }
80 int offset = 0;
81 } input0;
82 } input;
83
84 int vertices = 0;
85 enum
86 {
87 triangles,
88 counter_clockwise,
89 cull_back
90 };
91};
92
93}
94namespace Threedim
95{
96
98{
99public:
100 halp_meta(name, "Pointcloud to mesh")
101 halp_meta(category, "Visuals/3D")
102 halp_meta(c_name, "pointcloud_to_mesh")
103 halp_meta(manual_url, "https://ossia.io/score-docs/processes/pointcloud-to-mesh.html")
104 halp_meta(uuid, "2450ffbf-04ed-4b42-8848-69f200d2742a")
105
106 struct ins
107 {
108 halp::buffer_input<"Buffer"> in;
109 PositionControl position;
110 RotationControl rotation;
111 ScaleControl scale;
112 } inputs;
113
114 struct
115 {
116 struct
117 {
118 halp_meta(name, "Geometry");
119 halp::position_color_packed_geometry mesh;
120 float transform[16]{};
121 bool dirty_mesh = false;
122 bool dirty_transform = false;
123 } geometry;
124 } outputs;
125
126 PCLToMesh();
127 void create_mesh(std::span<float> v);
128 void operator()();
129
130 std::vector<float> complete;
131};
132
133
135{
136public:
137 halp_meta(name, "Pointcloud to mesh")
138 halp_meta(category, "Visuals/3D")
139 halp_meta(c_name, "pointcloud_to_mesh")
140 halp_meta(manual_url, "https://ossia.io/score-docs/processes/pointcloud-to-mesh.html")
141 halp_meta(uuid, "2450ffbf-04ed-4b42-8848-69f200d2742a")
142
143 enum BufferType
144 {
145 XYZ,
146 XYZ_RGB,
147 XYZW,
148 XYZW_RGBA
149 };
150 struct ins
151 {
152 halp::gpu_buffer_input<"Buffer"> in;
153 PositionControl position;
154 RotationControl rotation;
155 ScaleControl scale;
156 halp::enum_t<BufferType, "Buffer type"> type;
157 } inputs;
158
159 struct
160 {
161 struct
162 {
163 // Use Noiuse::dynamic_geometry
164 halp_meta(name, "Geometry");
165 halp::dynamic_gpu_geometry mesh;
166 float transform[16]{};
167 bool dirty_mesh = false;
168 bool dirty_transform = false;
169 } geometry;
170 } outputs;
171
172 PCLToMesh2();
173 void create_mesh(std::span<float> v);
174 void operator()();
175
176 std::vector<float> complete;
177};
178}
Definition PCLToGeometry.hpp:135
Definition PCLToGeometry.hpp:98
Definition PCLToGeometry.hpp:151
Definition PCLToGeometry.hpp:107
Definition TinyObj.hpp:64
Definition TinyObj.hpp:69
Definition TinyObj.hpp:73
Definition TinyObj.hpp:19
Definition PCLToGeometry.hpp:22
Definition PCLToGeometry.hpp:15
Definition PCLToGeometry.hpp:62
Definition PCLToGeometry.hpp:49
Definition PCLToGeometry.hpp:34
Definition PCLToGeometry.hpp:32