-
Notifications
You must be signed in to change notification settings - Fork 0
/
fn_basic_generators.h
142 lines (99 loc) · 3.29 KB
/
fn_basic_generators.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#ifndef gd_fastnoise2_BASICGENERATORS_H
#define gd_fastnoise2_BASICGENERATORS_H
#include <FastNoise/Generators/BasicGenerators.h>
#include "fn_generator.h"
namespace _FastNoise = FastNoise;
class FNConstant : public FNGenerator {
GDCLASS(FNConstant, FNGenerator)
public:
FNConstant();
void set_value(float value) { _node->SetValue(value); }
virtual _FastNoise::SmartNode<_FastNoise::Generator> _get_smart_node() const override {
return _node;
}
protected:
static void _bind_methods();
private:
_FastNoise::SmartNode<_FastNoise::Constant> _node;
};
class FNWhite : public FNGenerator {
GDCLASS(FNWhite, FNGenerator)
public:
FNWhite();
virtual _FastNoise::SmartNode<_FastNoise::Generator> _get_smart_node() const override {
return _node;
}
protected:
static void _bind_methods();
private:
_FastNoise::SmartNode<_FastNoise::White> _node;
};
class FNCheckerboard : public FNGenerator {
GDCLASS(FNCheckerboard, FNGenerator)
public:
FNCheckerboard();
void set_size(float value) { _node->SetSize(value); }
virtual _FastNoise::SmartNode<_FastNoise::Generator> _get_smart_node() const override {
return _node;
}
protected:
static void _bind_methods();
private:
_FastNoise::SmartNode<_FastNoise::Checkerboard> _node;
};
class FNSineWave : public FNGenerator {
GDCLASS(FNSineWave, FNGenerator)
public:
FNSineWave();
void set_scale(float value) { _node->SetScale(value); }
virtual _FastNoise::SmartNode<_FastNoise::Generator> _get_smart_node() const override {
return _node;
}
protected:
static void _bind_methods();
private:
_FastNoise::SmartNode<_FastNoise::SineWave> _node;
};
class FNPositionOutput : public FNGenerator {
GDCLASS(FNPositionOutput, FNGenerator)
public:
FNPositionOutput();
void set_x(float multiplier, float offset = 0.0f) {
_node->Set<_FastNoise::Dim::X>(multiplier, offset);
}
void set_y(float multiplier, float offset = 0.0f) {
_node->Set<_FastNoise::Dim::Y>(multiplier, offset);
}
void set_z(float multiplier, float offset = 0.0f) {
_node->Set<_FastNoise::Dim::Z>(multiplier, offset);
}
void set_w(float multiplier, float offset = 0.0f) {
_node->Set<_FastNoise::Dim::W>(multiplier, offset);
}
virtual _FastNoise::SmartNode<_FastNoise::Generator> _get_smart_node() const override {
return _node;
}
protected:
static void _bind_methods();
private:
_FastNoise::SmartNode<_FastNoise::PositionOutput> _node;
};
class FNDistanceToPoint : public FNGenerator {
GDCLASS(FNDistanceToPoint, FNGenerator)
public:
FNDistanceToPoint();
void set_source(FNGenerator *gen) { _node->SetSource(gen->_get_smart_node()); }
void set_distance_function(int64_t func);
void set_x_scale(float value) { _node->SetScale<_FastNoise::Dim::X>(value); }
void set_y_scale(float value) { _node->SetScale<_FastNoise::Dim::Y>(value); }
void set_z_scale(float value) { _node->SetScale<_FastNoise::Dim::Z>(value); }
void set_w_scale(float value) { _node->SetScale<_FastNoise::Dim::W>(value); }
virtual _FastNoise::SmartNode<_FastNoise::Generator> _get_smart_node() const override {
return _node;
}
protected:
static void _bind_methods();
private:
_FastNoise::SmartNode<_FastNoise::DistanceToPoint> _node;
};
#endif