Loading...
Searching...
No Matches
Noise.hpp
1#pragma once
2
3/* SPDX-License-Identifier: GPL-3.0-or-later */
4
5#include <halp/controls.hpp>
6#include <halp/geometry.hpp>
7#include <halp/meta.hpp>
8
9#include <cstdlib>
10#include <cstring>
11#include <random>
12#include <span>
13
14namespace Threedim
15{
17{
18 halp::dynamic_geometry mesh;
19 float transform[16]{};
20 bool dirty_mesh = false;
21 bool dirty_transform = false;
22};
24{
25 enum enum_type
26 {
27 None,
28 Noise,
29 Sine
30 } value{};
31
32 enum widget
33 {
34 enumeration,
35 list,
36 combobox
37 };
38
39 struct range
40 {
41 std::string_view values[3]{"None", "Noise", "Sine"};
42 enum_type init = enum_type::Noise;
43 };
44
45 operator enum_type&() noexcept { return value; }
46 operator const enum_type&() const noexcept { return value; }
47 auto& operator=(enum_type t) noexcept
48 {
49 value = t;
50 return *this;
51 }
52};
53
54struct Noise
55{
56 halp_meta(name, "Mesh Noise")
57 halp_meta(c_name, "mesh_noise")
58 halp_meta(uuid, "4f493663-3739-43df-94b5-20a31c4dc8aa")
59 halp_meta(category, "Visuals/3D/Modifiers")
60 halp_meta(manual_url, "https://ossia.io/score-docs/processes/meshes.html#noise")
61 halp_meta(author, "Jean-Michaƫl Celerier")
62
63 struct
64 {
65 struct : GeometryPort
66 {
67 halp_meta(name, "Geometry");
68 } geometry;
69 struct : DeformationControl
70 {
71 halp_meta(name, "Deformation X");
72 } dx;
73 struct : DeformationControl
74 {
75 halp_meta(name, "Deformation Y");
76 } dy;
77 struct : DeformationControl
78 {
79 halp_meta(name, "Deformation Z");
80 } dz;
81 halp::hslider_f32<"Intensity X"> ix;
82 halp::hslider_f32<"Intensity Y"> iy;
83 halp::hslider_f32<"Intensity Z"> iz;
84
85 } inputs;
86
87 struct
88 {
89 struct : GeometryPort
90 {
91 halp_meta(name, "Geometry");
92 } geometry;
93 } outputs;
94
95 Noise();
96 ~Noise();
97
98 struct tick
99 {
100 int frames;
101 int64_t position_in_frames;
102 };
103
104 void operator()(tick);
105};
106}
Definition Noise.hpp:24
Definition Noise.hpp:17
Definition Noise.hpp:99
Definition Noise.hpp:55
Definition TinyObj.hpp:18