Loading...
Searching...
No Matches
StructureSynth.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#include <ossia/detail/mutex.hpp>
9#include <ossia/detail/pod_vector.hpp>
10
11#include <thread>
12
13namespace Threedim
14{
15
17{
18public:
19 halp_meta(name, "Structure Synth")
20 halp_meta(category, "Visuals/3D")
21 halp_meta(c_name, "structure_synth")
22 halp_meta(manual_url, "https://ossia.io/score-docs/processes/structure-synth.html")
23 halp_meta(uuid, "bb8f3d77-4cfd-44ce-9c43-b64c54a748ab")
24
25 struct ins
26 {
27 struct : halp::lineedit<"Program", "">
28 {
29 halp_meta(language, "eisenscript")
30 // Request a computation according to the currently defined program
31 void update(StrucSynth& g)
32 {
33 if(this->value.empty())
34 return;
35
36 using namespace std::literals;
37 g.worker.request(this->value);
38 }
39 } program;
40
41 PositionControl position;
42 RotationControl rotation;
43 ScaleControl scale;
44 struct : halp::impulse_button<"Regenerate">
45 {
46 void update(StrucSynth& g) { g.inputs.program.update(g); }
47 } regen;
48 } inputs;
49
50 struct
51 {
52 struct : halp::mesh
53 {
54 halp_meta(name, "Geometry");
55 halp::position_normals_geometry mesh;
56 } geometry;
57 } outputs;
58
59 void operator()();
60
61 struct worker
62 {
63 std::function<void(std::string)> request;
64
65 // Called back in a worker thread
66 // The returned function will be later applied in this object's processing thread
67 static std::function<void(StrucSynth&)> work(std::string_view s);
68 } worker;
69
70 using float_vec = boost::container::vector<float, ossia::pod_allocator<float>>;
71 float_vec m_vertexData;
72};
73
74}
Definition StructureSynth.hpp:17
Definition TinyObj.hpp:64
Definition TinyObj.hpp:69
Definition TinyObj.hpp:73
Definition StructureSynth.hpp:26
Definition StructureSynth.hpp:62
Definition TinyObj.hpp:19