20{
21 if (isDefault)
23 float res, sc, x, y;
24 res = sc = x = y = 0.0f;
25 int channel = 0;
26
27 if (inputPins[0]->IsLinked())
28 {
29 x = inputPins[0]->other->Evaluate(input).value;
30 }
31
32 else
33 {
34 x = input.texX;
35 }
36
37 if (inputPins[1]->IsLinked())
38 {
39 y = inputPins[1]->other->Evaluate(input).value;
40 }
41
42 else
43 {
44 y = input.texY;
45 }
46
47 if (inputPins[2]->IsLinked())
48 {
49 sc = inputPins[2]->other->Evaluate(input).value;
50 }
51
52 else
53 {
54 sc = scale;
55 }
56
57 x = (x * 2.0f - 1.0f) * sc - posi[0];
58 y = (y * 2.0f - 1.0f) * sc - posi[1];
59 float cr = cos(rota * 3.1415926535f / 180.0f);
60 float sr = sin(rota * 3.1415926535f / 180.0f);
61 float tx = x;
62 float ty = y;
63 x = tx * cr - ty * sr;
64 y = tx * sr + ty * cr;
65 x = x * 0.5f + 0.5f;
66 y = y * 0.5f + 0.5f;
67 x = fract(x);
68 y = fract(y);
69 int xC = (int)(x * (heightmap->GetWidth()-1));
70 int yC = (int)(y * (heightmap->GetHeight()-1));
71
72
73 mutex.lock();
74
75 res = heightmap->Sample(x, y, interpolated) / 65536.0;
76 if (!autoTiled)
77 {
78 if(x > numTiles || y > numTiles || x < 0 || y < 0)
80 }
81
82 if(npScale)
83 {
84 res = res * 2.0f - 1.0f;
85 }
86
87 if(inv)
88 {
89 res = 1.0f - res;
90 }
91
92 mutex.unlock();
94}