score
Home
Classes
Namespaces
Files
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
14
namespace
Threedim
15
{
16
struct
GeometryPort
17
{
18
halp::dynamic_geometry
mesh
;
19
float
transform[16]{
20
1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f,
21
};
22
bool
dirty_mesh =
false
;
23
bool
dirty_transform =
false
;
24
};
25
struct
DeformationControl
26
{
27
enum
enum_type
28
{
29
None,
30
Noise
,
31
Sine
32
} value{};
33
34
enum
widget
35
{
36
enumeration,
37
list,
38
combobox
39
};
40
41
struct
range
42
{
43
std::string_view values[3]{
"None"
,
"Noise"
,
"Sine"
};
44
enum_type init = enum_type::Noise;
45
};
46
47
operator
enum_type&()
noexcept
{
return
value; }
48
operator
const
enum_type&()
const
noexcept
{
return
value; }
49
auto
& operator=(enum_type t)
noexcept
50
{
51
value = t;
52
return
*
this
;
53
}
54
};
55
56
struct
Noise
57
{
58
halp_meta(name,
"Mesh Noise"
)
59
halp_meta(c_name,
"mesh_noise"
)
60
halp_meta(uuid,
"4f493663-3739-43df-94b5-20a31c4dc8aa"
)
61
halp_meta(category,
"Visuals/Meshes/Modifiers"
)
62
halp_meta(description,
"Deform mesh vertices with independently controlled noise on each axis."
)
63
halp_meta(manual_url,
"https://ossia.io/score-docs/processes/meshes.html#noise"
)
64
halp_meta(author,
"Jean-Michaƫl Celerier"
)
65
66
struct
67
{
68
struct :
GeometryPort
69
{
70
halp_meta(name,
"Geometry"
);
71
} geometry;
72
struct :
DeformationControl
73
{
74
halp_meta(name,
"Deformation X"
);
75
} dx;
76
struct :
DeformationControl
77
{
78
halp_meta(name,
"Deformation Y"
);
79
} dy;
80
struct :
DeformationControl
81
{
82
halp_meta(name,
"Deformation Z"
);
83
} dz;
84
halp::hslider_f32<
"Intensity X"
> ix;
85
halp::hslider_f32<
"Intensity Y"
> iy;
86
halp::hslider_f32<
"Intensity Z"
> iz;
87
88
} inputs;
89
90
struct
91
{
92
struct :
GeometryPort
93
{
94
halp_meta(name,
"Geometry"
);
95
} geometry;
96
} outputs;
97
98
Noise
();
99
~Noise
();
100
101
void
operator()();
102
103
int64_t position_in_frames = 0;
104
};
105
}
Threedim::DeformationControl::range
Definition
Noise.hpp:42
Threedim::DeformationControl
Definition
Noise.hpp:26
Threedim::GeometryPort
Definition
Noise.hpp:17
Threedim::Noise
Definition
Noise.hpp:57
Threedim::mesh
Definition
TinyObj.hpp:27