Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
pperhmp_lvl3.c
Go to the documentation of this file.
1class PPERequester_HeavyMetalPoisoning_3 extends PPERequester_GameplayBase
2{
3 const float WAVE_PROGRESS_MIN = 0;
4 const float WAVE_PROGRESS_MAX = Math.PI;
5 const float WAVE_AMPLITUDE_COEF = 0.7; //utilized values clamped to <-1,1> range, this affects the duration of plateau and steepness of change
6 const float WAVE_TILT = -0.12; //anything in the closed range of (1,-1), left to right. UNDEFINED for '0' value!
7
8 const float DISTORT_MIN = 0;
9 const float DISTORT_MAX = -0.8;
10
11 //const float PULSING_FREQUENCY = 1.0;
12
13 float m_ProgressAngle;
14 float m_CurveValue;
15 float m_CurveValueClamped;
16 float m_LenseOffsetAngle;
17 float m_LenseOffsetDist;
18
19 void SetInitialLenseOffset(float offsetAngle, float offsetDistance = 0.5)
20 {
21 m_LenseOffsetAngle = offsetAngle;
22 m_LenseOffsetDist = Math.Clamp(offsetDistance,0,1);
23 }
24
25 void SetEffectProgress(float progress) //0..1
26 {
27 m_ProgressAngle = Math.Lerp(WAVE_PROGRESS_MIN,WAVE_PROGRESS_MAX,progress);
28 m_CurveValue = (1 / WAVE_TILT) * (Math.Atan((WAVE_TILT * Math.Sin(m_ProgressAngle)) / (1 - WAVE_TILT * Math.Cos(m_ProgressAngle)))) * WAVE_AMPLITUDE_COEF;
29 m_CurveValueClamped = Math.Clamp(m_CurveValue,-1,1);
30
31 float distort = Math.Lerp(DISTORT_MIN,DISTORT_MAX,m_CurveValueClamped);
32 float centerX = Math.Lerp(0,m_LenseOffsetDist,Math.Sin(m_ProgressAngle + m_LenseOffsetAngle));
33 float centerY = Math.Lerp(0,m_LenseOffsetDist,Math.Cos(m_ProgressAngle + m_LenseOffsetAngle));
34 float chromAbb = Math.AbsFloat(m_CurveValueClamped); //scale
35
36 float chromShiftR = 0.1;
37 float chromShiftG = 0;
38 float chromShiftB = 0.75;
39
40 float alpha01 = Math.Sin( -Math.PI_HALF + 7 * m_ProgressAngle) * 0.5 + 0.5;
41 vector colabA = "-1 -1 -0.85";
42 vector colabB = "0 0 0";
43 vector absim = vector.Lerp(colabA, colabB, alpha01);
44
45 array<float> color_mod = {absim[0], absim[1], absim[2], 1.0};
46
47 vector coloverA = "0 0 0";
48 vector coloverB = "0.25 0.9 0.1";
49 vector oversim = vector.Lerp(coloverA, coloverB, m_CurveValueClamped);
50
51 array<float> color_overlay = {oversim[0], oversim[1], oversim[2], 0.5};
52
53 SetTargetValueFloat(PostProcessEffectType.Distort,PPEDistort.PARAM_DISTORT,false, distort,PPEDistort.L_0_HMP,PPOperators.ADD);
54 SetTargetValueFloat(PostProcessEffectType.Distort,PPEDistort.PARAM_CENTERX,false, centerX,PPEDistort.L_1_HMP,PPOperators.ADD);
55 SetTargetValueFloat(PostProcessEffectType.Distort,PPEDistort.PARAM_CENTERY,false, centerY,PPEDistort.L_2_HMP,PPOperators.ADD);
56 SetTargetValueFloat(PostProcessEffectType.Distort,PPEDistort.PARAM_CHROM_ABB,true, chromAbb,PPEDistort.L_3_HMP,PPOperators.ADD);
57 SetTargetValueFloat(PostProcessEffectType.Distort,PPEDistort.PARAM_CHROM_ABB_SHIFTR,true, chromShiftR,PPEDistort.L_4_HMP,PPOperators.SET);
58 SetTargetValueFloat(PostProcessEffectType.Distort,PPEDistort.PARAM_CHROM_ABB_SHIFTG,true, chromShiftG,PPEDistort.L_5_HMP,PPOperators.SET);
59 SetTargetValueFloat(PostProcessEffectType.Distort,PPEDistort.PARAM_CHROM_ABB_SHIFTB,true, chromShiftB,PPEDistort.L_6_HMP,PPOperators.SET);
60 SetTargetValueColor(PostProcessEffectType.Distort,PPEDistort.PARAM_CHROM_COLOR_MOD,color_mod,PPEDistort.L_7_HMP,PPOperators.ADD);
61
62 SetTargetValueColor(PostProcessEffectType.Glow,PPEGlow.PARAM_COLORIZATIONCOLOR,color_overlay,PPEGlow.L_23_HMP,PPOperators.ADD);
63 }
64}
Definition enmath.c:7
Distort - PostProcessEffectType.Distort.
Definition ppedistort.c:3
Glow - PostProcessEffectType.Glow.
Definition ppeglow.c:8
base, not to be used directly, would lead to layering collisions!
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
PostProcessEffectType
Post-process effect type.
Definition enworld.c:72
PPOperators
PP operators, specify operation between subsequent layers.
void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)
void SetTargetValueColor(int mat_id, int param_idx, array< float > val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)