TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ Evaluate()

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

Implements NodeEditorNode.

Definition at line 8 of file ClampNode.cpp.

9{
10 float mn, mx, vv;
11 mn = 0.0f;
12 mx = 1.0f;
13 vv = 0.5f;
14
15 if (inputPins[0]->IsLinked())
16 {
17 vv = inputPins[0]->other->Evaluate(input).value;
18 }
19
20 else
21 {
22 vv = inpt;
23 }
24
25 if (inputPins[1]->IsLinked())
26 {
27 mn = inputPins[1]->other->Evaluate(input).value;
28 }
29
30 else
31 {
32 mn = minV;
33 }
34
35 if (inputPins[2]->IsLinked())
36 {
37 mx = inputPins[2]->other->Evaluate(input).value;
38 }
39
40 else
41 {
42 mx = maxV;
43 }
44
45 return NodeOutput({ vv > mx ? mx : ( vv < mn ? mn : vv ) });
46}