TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ Evaluate()

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

Implements NodeEditorNode.

Definition at line 9 of file PixelateNode.cpp.

10{
11 float x = 1;
12
13 if (input.maxZ == 0)
14 {
15 input.maxZ = 1;
16 }
17
18 float currX = input.x / input.maxX;
19 float currY = input.y / input.maxY;
20 float currZ = input.z / input.maxZ;
21 float boxX = floorf(currX / pixelSize);
22 float boxY = floorf(currY / pixelSize);
23 float boxZ = floorf(currZ / pixelSize);
24 input.x = boxX * pixelSize * input.maxX;
25 input.y = boxY * pixelSize * input.maxY;
26 input.z = boxZ * pixelSize * input.maxZ;
27
28 if(inputPins[0]->IsLinked())
29 return NodeOutput({ inputPins[0]->other->Evaluate(input).value });
30 return NodeOutput({0.0f});
31}