3#include "TransformHelper.hpp"
5#include <Threedim/TinyObj.hpp>
6#include <halp/audio.hpp>
7#include <halp/geometry.hpp>
8#include <halp/meta.hpp>
14 halp_meta(category,
"Visuals/Meshes/Primitives")
15 halp_meta(author,
"Jean-Michaël Celerier, vcglib")
16 halp_meta(manual_url,
"https://ossia.io/score-docs/processes/meshes.html#primitive")
22 template <
typename In,
typename Out>
23 void apply_transform(
const In& in, Out& out)
25 out.dirty_transform = computeTRSMatrix(in, out.transform, m_cachedTRS);
30 std::vector<float> complete;
39 halp_meta(category,
"Visuals/Meshes/Primitives")
40 halp_meta(author,
"Jean-Michaël Celerier, vcglib")
41 halp_meta(manual_url,
"https://ossia.io/score-docs/processes/meshes.html#primitive")
42 halp_meta(name,
"Plane")
43 halp_meta(c_name,
"3d_plane")
44 halp_meta(description,
"Generate a subdivided plane mesh with position, rotation and scale controls.")
45 halp_meta(uuid,
"1e923d52-3494-49e8-8698-b001405000da")
52 struct : halp::spinbox_i32<
"H divs.", halp::range{2, 200, 16}>,
Update {} hdivs;
53 struct : halp::spinbox_i32<
"V divs.", halp::range{2, 200, 16}>,
Update {} vdivs;
60 halp_meta(name,
"Geometry");
61 halp::position_normals_texcoords_geometry_plane
mesh;
62 float transform[16]{};
63 bool dirty_mesh =
false;
64 bool dirty_transform =
false;
68 void prepare(halp::setup) { update(); }
72 outputs.geometry.dirty_transform
73 = computeTRSMatrix(inputs, outputs.geometry.transform, m_cachedTRS);
76 std::vector<float> complete;
83 halp_meta(name,
"Cube")
84 halp_meta(c_name,
"3d_cube")
85 halp_meta(description,
"Generate a cube mesh with position, rotation and scale controls.")
86 halp_meta(uuid,
"cf8a328a-1ba6-47f8-929f-2168bdec90b0")
95 void prepare(halp::setup) { update(); }
97 void operator()() { apply_transform(inputs, outputs.geometry); }
103 halp_meta(name,
"Sphere")
104 halp_meta(c_name,
"3d_sphere")
105 halp_meta(description,
"Generate a sphere mesh with position, rotation and scale controls.")
106 halp_meta(uuid,
"fc0df335-d0e9-4ebf-b438-6ba334741c1a")
114 : halp::hslider_i32<
"Subdivisions", halp::range{1, 5, 2}>
120 void prepare(halp::setup) { update(); }
122 void operator()() { apply_transform(inputs, outputs.geometry); }
127 halp_meta(name,
"Icosahedron")
128 halp_meta(c_name,
"3d_ico")
129 halp_meta(description,
"Generate an icosahedron mesh with position, rotation and scale controls.")
130 halp_meta(uuid,
"3ea9f69f-1a0e-49c2-ad16-a88e9ca628a7")
139 void prepare(halp::setup) { update(); }
141 void operator()() { apply_transform(inputs, outputs.geometry); }
146 halp_meta(name,
"Cone")
147 halp_meta(c_name,
"3d_cone")
148 halp_meta(description,
"Generate a cone mesh with position, rotation and scale controls.")
149 halp_meta(uuid,
"8a5718c4-07f0-476b-b720-1c99e5a379a5")
157 : halp::hslider_i32<
"Subdivisions", halp::range{1, 500, 36}>
162 : halp::hslider_f32<
"R1", halp::range{0, 1000, 1}>
167 : halp::hslider_f32<
"R2", halp::range{0, 1000, 10}>
172 : halp::hslider_f32<
"Height", halp::range{0, 1000, 5}>
178 void prepare(halp::setup) { update(); }
180 void operator()() { apply_transform(inputs, outputs.geometry); }
185 halp_meta(name,
"Cylinder")
186 halp_meta(c_name,
"3d_cylinder")
187 halp_meta(description,
"Generate a cylinder mesh with position, rotation and scale controls.")
188 halp_meta(uuid,
"5992830e-80fe-4461-b357-2c9b5c5e48ae")
196 : halp::hslider_i32<
"Slices", halp::range{1, 64, 16}>
201 : halp::hslider_i32<
"Stacks", halp::range{1, 64, 16}>
207 void prepare(halp::setup) { update(); }
209 void operator()() { apply_transform(inputs, outputs.geometry); }
214 halp_meta(name,
"Torus")
215 halp_meta(c_name,
"3d_torus")
216 halp_meta(description,
"Generate a torus mesh with position, rotation and scale controls.")
217 halp_meta(uuid,
"85c5983c-3f4f-4bfe-b8cf-fccdf6ec5faf")
225 : halp::hslider_f32<
"R1", halp::range{0, 100, 10}>
230 : halp::hslider_f32<
"R2", halp::range{0, 100, 1}>
235 : halp::hslider_i32<
"H Divisions", halp::range{1, 50, 24}>
240 : halp::hslider_i32<
"V Divisions", halp::range{1, 50, 12}>
246 void prepare(halp::setup) { update(); }
248 void operator()() { apply_transform(inputs, outputs.geometry); }
Definition TransformHelper.hpp:26
Definition Primitive.hpp:145
Definition Primitive.hpp:81
Definition Primitive.hpp:184
Definition Primitive.hpp:126
Definition Primitive.hpp:37
Definition TinyObj.hpp:98
Definition Primitive.hpp:13
Definition TinyObj.hpp:117
Definition TinyObj.hpp:103
Definition TinyObj.hpp:107
Definition Primitive.hpp:101
Definition Primitive.hpp:213
Definition TinyObj.hpp:112
Definition TinyObj.hpp:27