-
Notifications
You must be signed in to change notification settings - Fork 0
/
fn_fractal.cpp
46 lines (38 loc) · 1.42 KB
/
fn_fractal.cpp
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
#include "fn_fractal.h"
FNFractal::FNFractal(int type) {
_frac_type = static_cast<FractalType>(type);
switch(_frac_type) {
case FractalType::FBm:
default:
_frac_node = _FastNoise::New<_FastNoise::FractalFBm>();
break;
}
}
Ref<FNFractal> FNFractal::new_fractal(int type) {
Ref<FNFractal> fractal(new FNFractal(type));
return fractal;
}
void FNFractal::set_source(FNGenerator *src) {
_frac_node->SetSource(src->_get_smart_node());
}
void FNFractal::_bind_methods() {
_bind_frac_type_enum();
ClassDB::bind_static_method("FNFractal",
D_METHOD("new_fractal", "type"),
&FNFractal::new_fractal);
ClassDB::bind_method(D_METHOD("set_source", "src"),
&FNFractal::set_source);
ClassDB::bind_method(D_METHOD("set_gain", "value"),
&FNFractal::set_gain);
ClassDB::bind_method(D_METHOD("set_weighted_strength", "value"),
&FNFractal::set_weighted_strength);
ClassDB::bind_method(D_METHOD("set_octave_count", "value"),
&FNFractal::set_octave_count);
ClassDB::bind_method(D_METHOD("set_lacunarity", "value"),
&FNFractal::set_lacunarity);
}
void FNFractal::_bind_frac_type_enum() {
ClassDB::bind_integer_constant("FNFractal", "FractalType", "FBm", 0);
ClassDB::bind_integer_constant("FNFractal", "FractalType", "Ridged", 1);
ClassDB::bind_integer_constant("FNFractal", "FractalType", "PingPong", 2);
}