TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ Evaluate()

NodeOutput NoiseValueCubicNode::Evaluate ( NodeInputParam  input,
NodeEditorPin pin 
)
virtual

Implements NodeEditorNode.

Definition at line 7 of file NoiseValueCubicNode.cpp.

8{
9 if(!inputPins[0]->IsLinked())
10 {
11 noiseGen->SetSeed(seed);
12 }
13
14 else
15 {
16 noiseGen->SetSeed((int)inputPins[0]->other->Evaluate(input).value);
17 }
18
19 if (!inputPins[2]->IsLinked())
20 {
21 noiseGen->SetFrequency(frequency);
22 }
23
24 else
25 {
26 noiseGen->SetFrequency(inputPins[2]->other->Evaluate(input).value);
27 }
28
29 if(fractalType == 0)
30 {
31 noiseGen->SetFractalType(FastNoiseLite::FractalType::FractalType_None);
32 }
33
34 else if (fractalType == 1)
35 {
36 noiseGen->SetFractalType(FastNoiseLite::FractalType::FractalType_FBm);
37 }
38
39 else if (fractalType == 2)
40 {
41 noiseGen->SetFractalType(FastNoiseLite::FractalType::FractalType_Ridged);
42 }
43
44 else if (fractalType == 3)
45 {
46 noiseGen->SetFractalType(FastNoiseLite::FractalType::FractalType_PingPong);
47 }
48
49 else
50 {
51 noiseGen->SetFractalType(FastNoiseLite::FractalType::FractalType_None);
52 }
53
54 if (!inputPins[1]->IsLinked())
55 {
56 noiseGen->SetFractalOctaves(octaves);
57 }
58
59 else
60 {
61 noiseGen->SetFrequency(inputPins[1]->other->Evaluate(input).value);
62 }
63
64 if (!inputPins[3]->IsLinked())
65 {
66 noiseGen->SetFractalLacunarity(lacunarity);
67 }
68
69 else
70 {
71 noiseGen->SetFractalLacunarity(inputPins[3]->other->Evaluate(input).value);
72 }
73
74 if (!inputPins[4]->IsLinked())
75 {
76 noiseGen->SetFractalGain(gain);
77 }
78
79 else
80 {
81 noiseGen->SetFractalGain(inputPins[4]->other->Evaluate(input).value);
82 }
83
84 if (!inputPins[5]->IsLinked())
85 {
86 noiseGen->SetFractalWeightedStrength(weightedStrength);
87 }
88
89 else
90 {
91 noiseGen->SetFractalWeightedStrength(inputPins[5]->other->Evaluate(input).value);
92 }
93
94 if (!inputPins[6]->IsLinked())
95 {
96 noiseGen->SetFractalPingPongStrength(pingPongStrength);
97 }
98
99 else
100 {
101 noiseGen->SetFractalPingPongStrength(inputPins[6]->other->Evaluate(input).value);
102 }
103
104 float st = strength;
105
106 if (inputPins[7]->IsLinked())
107 {
108 st = inputPins[7]->other->Evaluate(input).value;
109 }
110
111 return NodeOutput({ noiseGen->GetNoise(input.x, input.y, input.z) * st });
112}