Skip to content

Commit da8fba0

Browse files
committed
objects: add utilities for vec2f/3f/etc..
1 parent daa5878 commit da8fba0

File tree

3 files changed

+186
-0
lines changed

3 files changed

+186
-0
lines changed

examples/Advanced/UI/Widgets.hpp

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,180 @@ class Knob
162162

163163
void operator()() noexcept { outputs.out = inputs.v.value; }
164164
};
165+
166+
struct Vec2i
167+
{
168+
halp_meta(name, "Vec2i")
169+
halp_meta(c_name, "avnd_vec2i")
170+
halp_meta(category, "Control/Basic")
171+
halp_meta(author, "Jean-Michaël Celerier")
172+
halp_meta(description, "Send an integer pair whenever there is an input message")
173+
halp_meta(
174+
manual_url, "https://ossia.io/score-docs/processes/mapping-utilities.html#vec")
175+
halp_meta(uuid, "4d20454d-de79-4be9-8b50-d288f3ecc33c")
176+
177+
struct
178+
{
179+
halp::spinbox_i32<"X", halp::free_range_max<int>> v1;
180+
halp::spinbox_i32<"Y", halp::free_range_max<int>> v2;
181+
} inputs;
182+
183+
struct
184+
{
185+
halp::callback<"Pair", std::array<int, 2>> out;
186+
} outputs;
187+
188+
void operator()() noexcept
189+
{
190+
outputs.out(std::array<int, 2>{inputs.v1.value, inputs.v2.value});
191+
}
192+
};
193+
194+
struct Vec3i
195+
{
196+
halp_meta(name, "Vec3i")
197+
halp_meta(c_name, "avnd_vec3i")
198+
halp_meta(category, "Control/Basic")
199+
halp_meta(author, "Jean-Michaël Celerier")
200+
halp_meta(description, "Send a Vec3i whenever there is an input message")
201+
halp_meta(
202+
manual_url, "https://ossia.io/score-docs/processes/mapping-utilities.html#vec")
203+
halp_meta(uuid, "f8a894c7-9f8e-42f3-9a6e-ccee1ab5b20d")
204+
205+
struct
206+
{
207+
halp::spinbox_i32<"X", halp::free_range_max<int>> v1;
208+
halp::spinbox_i32<"Y", halp::free_range_max<int>> v2;
209+
halp::spinbox_i32<"Z", halp::free_range_max<int>> v3;
210+
} inputs;
211+
212+
struct
213+
{
214+
halp::callback<"Pair", std::array<int, 3>> out;
215+
} outputs;
216+
217+
void operator()() noexcept
218+
{
219+
outputs.out(std::array<int, 3>{inputs.v1.value, inputs.v2.value, inputs.v3.value});
220+
}
221+
};
222+
struct Vec4i
223+
{
224+
halp_meta(name, "Vec4i")
225+
halp_meta(c_name, "avnd_vec4i")
226+
halp_meta(category, "Control/Basic")
227+
halp_meta(author, "Jean-Michaël Celerier")
228+
halp_meta(description, "Send a Vec4i whenever there is an input message")
229+
halp_meta(
230+
manual_url, "https://ossia.io/score-docs/processes/mapping-utilities.html#vec")
231+
halp_meta(uuid, "b2e60c29-2b9b-41ea-9721-5aa3b994a82f")
232+
233+
struct
234+
{
235+
halp::spinbox_i32<"X", halp::free_range_max<int>> v1;
236+
halp::spinbox_i32<"Y", halp::free_range_max<int>> v2;
237+
halp::spinbox_i32<"Z", halp::free_range_max<int>> v3;
238+
halp::spinbox_i32<"W", halp::free_range_max<int>> v4;
239+
} inputs;
240+
241+
struct
242+
{
243+
halp::callback<"Pair", std::array<int, 4>> out;
244+
} outputs;
245+
246+
void operator()() noexcept
247+
{
248+
outputs.out(
249+
std::array<int, 4>{
250+
inputs.v1.value, inputs.v2.value, inputs.v3.value, inputs.v4.value});
251+
}
252+
};
253+
254+
struct Vec2f
255+
{
256+
halp_meta(name, "Vec2f")
257+
halp_meta(c_name, "avnd_vec2f")
258+
halp_meta(category, "Control/Basic")
259+
halp_meta(author, "Jean-Michaël Celerier")
260+
halp_meta(description, "Send a float pair whenever there is an input message")
261+
halp_meta(
262+
manual_url, "https://ossia.io/score-docs/processes/mapping-utilities.html#vec")
263+
halp_meta(uuid, "d4e4574c-02c0-4b3e-9409-833837ff0921")
264+
265+
struct
266+
{
267+
halp::spinbox_f32<"X", halp::free_range_max<float>> v1;
268+
halp::spinbox_f32<"Y", halp::free_range_max<float>> v2;
269+
} inputs;
270+
271+
struct
272+
{
273+
halp::callback<"Pair", std::array<float, 2>> out;
274+
} outputs;
275+
276+
void operator()() noexcept
277+
{
278+
outputs.out(std::array<float, 2>{inputs.v1.value, inputs.v2.value});
279+
}
280+
};
281+
282+
struct Vec3f
283+
{
284+
halp_meta(name, "Vec3f")
285+
halp_meta(c_name, "avnd_vec3f")
286+
halp_meta(category, "Control/Basic")
287+
halp_meta(author, "Jean-Michaël Celerier")
288+
halp_meta(description, "Send a Vec3f whenever there is an input message")
289+
halp_meta(
290+
manual_url, "https://ossia.io/score-docs/processes/mapping-utilities.html#vec")
291+
halp_meta(uuid, "6e74b962-b102-4d2d-b6f1-850917e8c747")
292+
293+
struct
294+
{
295+
halp::spinbox_f32<"X", halp::free_range_max<float>> v1;
296+
halp::spinbox_f32<"Y", halp::free_range_max<float>> v2;
297+
halp::spinbox_f32<"Z", halp::free_range_max<float>> v3;
298+
} inputs;
299+
300+
struct
301+
{
302+
halp::callback<"Pair", std::array<float, 3>> out;
303+
} outputs;
304+
305+
void operator()() noexcept
306+
{
307+
outputs.out(std::array<float, 3>{inputs.v1.value, inputs.v2.value, inputs.v3.value});
308+
}
309+
};
310+
struct Vec4f
311+
{
312+
halp_meta(name, "Vec4f")
313+
halp_meta(c_name, "avnd_vec4f")
314+
halp_meta(category, "Control/Basic")
315+
halp_meta(author, "Jean-Michaël Celerier")
316+
halp_meta(description, "Send a Vec4f whenever there is an input message")
317+
halp_meta(
318+
manual_url, "https://ossia.io/score-docs/processes/mapping-utilities.html#vec")
319+
halp_meta(uuid, "5ccd5c1f-5614-4c98-9c5b-f0d7e3dfe49f")
320+
321+
struct
322+
{
323+
halp::spinbox_f32<"X", halp::free_range_max<float>> v1;
324+
halp::spinbox_f32<"Y", halp::free_range_max<float>> v2;
325+
halp::spinbox_f32<"Z", halp::free_range_max<float>> v3;
326+
halp::spinbox_f32<"W", halp::free_range_max<float>> v4;
327+
} inputs;
328+
329+
struct
330+
{
331+
halp::callback<"Pair", std::array<float, 4>> out;
332+
} outputs;
333+
334+
void operator()() noexcept
335+
{
336+
outputs.out(
337+
std::array<float, 4>{
338+
inputs.v1.value, inputs.v2.value, inputs.v3.value, inputs.v4.value});
339+
}
340+
};
165341
}

examples/Gpu/ArrayToBuffer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include <halp/controls.hpp>
88
#include <halp/meta.hpp>
99

10+
#include <algorithm>
11+
1012
namespace uo
1113
{
1214
struct ArrayToBuffer

include/avnd/binding/ossia/from_value.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,14 @@ struct from_ossia_value_impl
436436
}
437437
}
438438

439+
template <typename... T>
440+
bool operator()(const ossia::value& src, ossia::value& f)
441+
{
442+
// Used in cases where we have e.g. a tuple<int, ossia::value>
443+
f = src;
444+
return true;
445+
}
446+
439447
template <typename... T>
440448
bool operator()(const ossia::value& src, std::tuple<T...>& f)
441449
{

0 commit comments

Comments
 (0)