Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
ppedof.c
Go to the documentation of this file.
1//---------------------------------------------------------
2//Native exceptions - legacy methods for direct access to specific postprocesses. Each one is evaluated and handled separately, this just connects them to the system.
3
6{
7 //g_Game.OverrideDOF(bool enable, float focusDistance, float focusLength, float focusLengthNear, float blur, float focusDepthOffset);
8 static const int PARAM_ENABLE = 0;
9 static const int PARAM_FOCUS_DIST = 1;
10 static const int PARAM_FOCUS_LEN = 2;
11 static const int PARAM_FOCUS_LEN_NEAR = 3;
12 static const int PARAM_BLUR = 4;
13 static const int PARAM_FOCUS_DEPTH_OFFSET = 5;
14
15 static const int L_0_ADS = 100;
16 static const int L_1_ADS = 100;
17 static const int L_2_ADS = 100;
18 static const int L_3_ADS = 100;
19 static const int L_4_ADS = 100;
20 static const int L_5_ADS = 100;
21
22 override int GetPostProcessEffectID()
23 {
24 return PPEExceptions.DOF;
25 }
26
27 override void RegisterMaterialParameters()
28 {
29 //no known max. 1000 used as max
30 RegisterParameterScalarBool(PARAM_ENABLE,"Enable",false);
31
32 RegisterParameterScalarFloat(PARAM_FOCUS_DIST,"FocusDistance",2.0,0.0,1000.0); //2.0f used in code with null camera interpolation
33 RegisterParameterScalarFloat(PARAM_FOCUS_LEN,"FocusLength",-1.0,-1.0,1000.0); //-1.0f used as code default
34 RegisterParameterScalarFloat(PARAM_FOCUS_LEN_NEAR,"FocusLengthNear",-1.0,-1.0,1000.0); //-1.0f used as code default
35 RegisterParameterScalarFloat(PARAM_BLUR,"Blur",1.0,0.0,1000.0); //1.0f used in code with null camera interpolation
36 RegisterParameterScalarFloat(PARAM_FOCUS_DEPTH_OFFSET,"FocusDepthOffset",0.0,0.0,1000.0); //0.0f used as code default
37 }
38
39 override void ApplyValueChanges()
40 {
41 if (m_UpdatedParameters.Count() > 0)
42 {
43 SetFinalParameterValue(-1); //unique handling
44 }
45
46 m_UpdatedParameters.Clear();
47 }
48
50 override void SetFinalParameterValue(int parameter_idx)
51 {
52 Param enabled_par = GetParameterCommandData(PARAM_ENABLE).GetCurrentValues();
53 bool is_enabled = Param1<bool>.Cast(enabled_par).param1;
54
55 if (is_enabled)
56 {
57 array<float> array_values = {-1.0};
58
59 for (int i = 1; i < PARAM_FOCUS_DEPTH_OFFSET + 1; i++)
60 {
62 float value_var_float = Param1<float>.Cast(values).param1;
63 array_values.Insert(value_var_float);
64 }
65
66 g_Game.OverrideDOF(true, array_values.Get(PARAM_FOCUS_DIST), array_values.Get(PARAM_FOCUS_LEN), array_values.Get(PARAM_FOCUS_LEN_NEAR), array_values.Get(PARAM_BLUR), array_values.Get(PARAM_FOCUS_DEPTH_OFFSET));
67 }
68 else
69 {
70 g_Game.OverrideDOF(false,0.0,0.0,0.0,0.0,1.0);
71 }
72 }
73}
Created once, on manager init. Script-side representation of C++ material class, separate handling.
void RegisterParameterScalarFloat(int idx, string parameter_name, float default_value, float min, float max)
WARNING - min/max values are usually taken from Workbench defaults, may not be actual min/max values ...
void RegisterParameterScalarBool(int idx, string parameter_name, bool default_value)
PPEMatClassParameterCommandData GetParameterCommandData(int parameter_idx)
Some PP effects are handled as hard-coded exceptions, outside of material system. Default == PPEExcep...
ref array< int > m_UpdatedParameters
DOF postprocess, does not directly use materials.
Definition ppedof.c:6
Param GetCurrentValues()
Careful, only actual values, WITHOUT string.
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZGame g_Game
Definition dayzgame.c:3868
PPEExceptions