Loading...
Searching...
No Matches
Primitive.hpp
1#pragma once
2
3#include <Threedim/TinyObj.hpp>
4#include <halp/audio.hpp>
5#include <halp/geometry.hpp>
6#include <halp/meta.hpp>
7
8namespace Threedim
9{
11{
12 halp_meta(category, "Visuals/3D/Primitives")
13 halp_meta(author, "Jean-Michaƫl Celerier, vcglib")
14 halp_meta(manual_url, "https://ossia.io/score-docs/processes/meshes.html#primitive")
15
16 void operator()() { }
17 PrimitiveOutputs outputs;
18 std::vector<float> complete;
19};
20
22{
23public:
24 halp_meta(name, "Plane")
25 halp_meta(c_name, "3d_plane")
26 halp_meta(uuid, "1e923d52-3494-49e8-8698-b001405000da")
27
28 struct
29 {
30 PositionControl position;
31 RotationControl rotation;
32 ScaleControl scale;
33 halp::spinbox_i32<"H divs.", halp::range{1, 1000, 16}> hdivs;
34 halp::spinbox_i32<"V divs.", halp::range{1, 1000, 16}> vdivs;
35 } inputs;
36
37 void prepare(halp::setup) { update(); }
38 void update();
39};
40
42{
43public:
44 halp_meta(name, "Cube")
45 halp_meta(c_name, "3d_cube")
46 halp_meta(uuid, "cf8a328a-1ba6-47f8-929f-2168bdec90b0")
47
48 struct
49 {
50 PositionControl position;
51 RotationControl rotation;
52 ScaleControl scale;
53 } inputs;
54
55 void prepare(halp::setup) { update(); }
56 void update();
57};
58
60{
61public:
62 halp_meta(name, "Sphere")
63 halp_meta(c_name, "3d_sphere")
64 halp_meta(uuid, "fc0df335-d0e9-4ebf-b438-6ba334741c1a")
65
66 struct
67 {
68 PositionControl position;
69 RotationControl rotation;
70 ScaleControl scale;
71 struct
72 : halp::hslider_i32<"Subdivisions", halp::range{1, 5, 2}>
73 , Update
74 {
75 } subdiv;
76 } inputs;
77
78 void prepare(halp::setup) { update(); }
79 void update();
80};
81
83{
84 halp_meta(name, "Icosahedron")
85 halp_meta(c_name, "3d_ico")
86 halp_meta(uuid, "3ea9f69f-1a0e-49c2-ad16-a88e9ca628a7")
87
88 struct
89 {
90 PositionControl position;
91 RotationControl rotation;
92 ScaleControl scale;
93 } inputs;
94
95 void prepare(halp::setup) { update(); }
96 void update();
97};
98
100{
101 halp_meta(name, "Cone")
102 halp_meta(c_name, "3d_cone")
103 halp_meta(uuid, "8a5718c4-07f0-476b-b720-1c99e5a379a5")
104
105 struct
106 {
107 PositionControl position;
108 RotationControl rotation;
109 ScaleControl scale;
110 struct
111 : halp::hslider_i32<"Subdivisions", halp::range{1, 500, 36}>
112 , Update
113 {
114 } subdiv;
115 struct
116 : halp::hslider_f32<"R1", halp::range{0, 1000, 1}>
117 , Update
118 {
119 } r1;
120 struct
121 : halp::hslider_f32<"R2", halp::range{0, 1000, 10}>
122 , Update
123 {
124 } r2;
125 struct
126 : halp::hslider_f32<"Height", halp::range{0, 1000, 5}>
127 , Update
128 {
129 } h;
130 } inputs;
131
132 void prepare(halp::setup) { update(); }
133 void update();
134};
135
137{
138 halp_meta(name, "Cylinder")
139 halp_meta(c_name, "3d_cylinder")
140 halp_meta(uuid, "5992830e-80fe-4461-b357-2c9b5c5e48ae")
141
142 struct
143 {
144 PositionControl position;
145 RotationControl rotation;
146 ScaleControl scale;
147 struct
148 : halp::hslider_i32<"Slices", halp::range{1, 1000, 64}>
149 , Update
150 {
151 } slices;
152 struct
153 : halp::hslider_i32<"Stacks", halp::range{1, 1000, 64}>
154 , Update
155 {
156 } stacks;
157 } inputs;
158
159 void prepare(halp::setup) { update(); }
160 void update();
161};
162
164{
165 halp_meta(name, "Torus")
166 halp_meta(c_name, "3d_torus")
167 halp_meta(uuid, "85c5983c-3f4f-4bfe-b8cf-fccdf6ec5faf")
168
169 struct
170 {
171 PositionControl position;
172 RotationControl rotation;
173 ScaleControl scale;
174 struct
175 : halp::hslider_f32<"R1", halp::range{0, 100, 10}>
176 , Update
177 {
178 } r1;
179 struct
180 : halp::hslider_f32<"R2", halp::range{0, 100, 1}>
181 , Update
182 {
183 } r2;
184 struct
185 : halp::hslider_i32<"H Divisions", halp::range{1, 50, 24}>
186 , Update
187 {
188 } hdiv;
189 struct
190 : halp::hslider_i32<"V Divisions", halp::range{1, 50, 12}>
191 , Update
192 {
193 } vdiv;
194 } inputs;
195
196 void prepare(halp::setup) { update(); }
197 void update();
198};
199
200}
Definition Primitive.hpp:100
Definition Primitive.hpp:42
Definition Primitive.hpp:137
Definition Primitive.hpp:83
Definition Primitive.hpp:22
Definition TinyObj.hpp:63
Definition Primitive.hpp:11
Definition TinyObj.hpp:82
Definition TinyObj.hpp:68
Definition TinyObj.hpp:72
Definition Primitive.hpp:60
Definition Primitive.hpp:164
Definition TinyObj.hpp:77