TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ Evaluate()

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

Implements NodeEditorNode.

Definition at line 10 of file BlendNode.cpp.

11{
12 float v1, v2, f;
13 v1 = v2 = f = 0;
14
15 if (inputPins[0]->IsLinked())
16 {
17 v1 = inputPins[0]->other->Evaluate(input).value;
18 }
19
20 else
21 {
22 v1 = value1;
23 }
24
25 if (inputPins[1]->IsLinked())
26 {
27 v2 = inputPins[1]->other->Evaluate(input).value;
28 }
29
30 else
31 {
32 v2 = value2;
33 }
34
35 if (inputPins[2]->IsLinked())
36 {
37 f = inputPins[2]->other->Evaluate(input).value;
38 }
39
40 else
41 {
42 f = factor;
43 }
44
45 return NodeOutput({ f * v1 + (1 - f) * v2 });
46}