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