Dayz Explorer
1.29.162510
Loading...
Searching...
No Matches
blend2d.c
Go to the documentation of this file.
1
//----------------------------------------------------------------------------------------
2
/*
3
Allows weighted blending of values defined by their 2D position in space.
4
*/
5
class
Blend2D<
Class
T>
6
{
7
private
ref
array<vector>
m_Positions;
8
private
ref
array<T>
m_Values;
9
private
ref
array<float>
m_Weights;
10
11
//----------------------------------------------------------------------------------------
15
void
Blend2D()
16
{
17
m_Positions = {};
18
m_Weights = {};
19
m_Values = {};
20
}
21
22
//----------------------------------------------------------------------------------------
26
void
Insert(
float
posX,
float
posY, T value)
27
{
28
m_Positions.Insert(
Vector
(posX, posY, 0));
29
m_Values.Insert(value);
30
m_Weights.Insert(0);
31
}
32
33
//----------------------------------------------------------------------------------------
37
void
Clear
()
38
{
39
m_Positions.Clear();
40
m_Values.Clear();
41
m_Weights.Clear();
42
}
43
44
//----------------------------------------------------------------------------------------
45
/*
46
Evaluate and return the result of the blend sampled at coordinate [posX, posY].
47
*/
48
T Blend(
float
posX,
float
posY)
49
{
50
vector
samplePosition =
Vector
(posX, posY, 0);
51
Math3D
.BlendCartesian(samplePosition, m_Positions, m_Weights);
52
53
T result;
54
int
numValues = m_Values.Count();
55
for
(
int
v = 0; v < numValues; ++v)
56
{
57
result += (m_Values[v] * m_Weights[v]);
58
}
59
60
return
result;
61
}
62
63
}
64
65
//----------------------------------------------------------------------------------------
66
typedef
Blend2D<vector>
Blend2DVector
;
Blend2DVector
class Blend2D< Class T > Blend2DVector
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
Math3D
Definition
enmath3d.c:28
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
vector
Definition
enconvert.c:119
Vector
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
Clear
void Clear(bool clearFile=false)
Definition
scriptconsoleenfscripttab.c:359
Daten
3_game
tools
blend2d.c
Generated by
1.16.1