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 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};
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
56struct 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/3D/Modifiers")
62 halp_meta(manual_url, "https://ossia.io/score-docs/processes/meshes.html#noise")
63 halp_meta(author, "Jean-Michaƫl Celerier")
64
65 struct
66 {
67 struct : GeometryPort
68 {
69 halp_meta(name, "Geometry");
70 } geometry;
71 struct : DeformationControl
72 {
73 halp_meta(name, "Deformation X");
74 } dx;
75 struct : DeformationControl
76 {
77 halp_meta(name, "Deformation Y");
78 } dy;
79 struct : DeformationControl
80 {
81 halp_meta(name, "Deformation Z");
82 } dz;
83 halp::hslider_f32<"Intensity X"> ix;
84 halp::hslider_f32<"Intensity Y"> iy;
85 halp::hslider_f32<"Intensity Z"> iz;
86
87 } inputs;
88
89 struct
90 {
91 struct : GeometryPort
92 {
93 halp_meta(name, "Geometry");
94 } geometry;
95 } outputs;
96
97 Noise();
98 ~Noise();
99
100 void operator()();
101
102 int64_t position_in_frames = 0;
103};
104}
Definition Noise.hpp:26
Definition Noise.hpp:17
Definition Noise.hpp:57
Definition TinyObj.hpp:19