Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
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
Blend2D< Class T >::m_Weights
ref array< float > m_Weights
Definition
blend2d.c:9
Blend2D< Class T >::Insert
void Insert(float posX, float posY, T value)
Insert new value at coordinate [posX, posY].
Definition
blend2d.c:26
Blend2D< Class T >::m_Values
ref array< T > m_Values
Definition
blend2d.c:8
Blend2D< Class T >::Clear
void Clear()
Empty the blend structure.
Definition
blend2d.c:37
Blend2D< Class T >::Blend
T Blend(float posX, float posY)
Definition
blend2d.c:48
Blend2D< Class T >::m_Positions
ref array< vector > m_Positions
Definition
blend2d.c:7
Blend2D< Class T >::Blend2D
void Blend2D()
Create new blend structure.
Definition
blend2d.c:15
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
Math3D::BlendCartesian
static proto void BlendCartesian(vector samplePosition, notnull array< vector > inPositions, notnull array< float > outWeights)
Output 2D blend space weights for inPositions when sampled at samplePosition.
Vector
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
Games
Dayz
scripts
3_game
tools
blend2d.c
Generated by
1.17.0