DayZ 1.24
Loading...
Searching...
No Matches
PPEManager.c File Reference

Go to the source code of this file.

Classes

class  PPEManagerStatic
 Static component of PPE manager, used to hold the instance. More...
 

Functions

void PPEManager ()
 
void Cleanup ()
 
void Init ()
 Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)
 
void InitPPEManagerClassMap ()
 Ordered by 'PostProcessEffectType' for easy access through the same enum; ID saved all the same.
 
void RegisterPPEClass (PPEClassBase material_class)
 Registeres material class and creates data structure within.
 
void SendMaterialValueData (PPERequestParamDataBase data)
 
void SetMaterialParamUpdating (int material_id, int parameter_id, int order)
 Queues material/parameter to update (once)
 
void RemoveMaterialUpdating (int material_id, int order=0)
 Currently unused, requests remain in the hierarchy and are used when needed (slightly faster than constantly re-shuffilng the arrays)
 
void ClearMaterialUpdating ()
 
void SetRequestActive (PPERequesterBase request, bool active)
 Marks requester as 'active'. Currently indistinguiishable from 'updating' requester, can potentially be used for intermittently updated requesters.
 
void SetRequestUpdating (PPERequesterBase request, bool active)
 Marks requester as 'updating' and to be processed on manager update.
 
bool GetExistingRequester (typename req, out PPERequesterBase ret)
 
bool IsAnyRequesterRunning (array< typename > requesters)
 
void RemoveActiveRequestFromMaterials (PPERequesterBase req)
 
void RequestsCleanup ()
 Unused cleanup method, should it be ever needed.
 
void InsertUpdatedMaterial (int mat_id)
 Marks material class as updated and values to be set in the course of update - 'ProcessApplyValueChanges'.
 
void ProcessRequesterUpdates (float timeslice)
 
void ProcessMaterialUpdates (float timeslice)
 
void ProcessApplyValueChanges ()
 
void Update (float timeslice)
 
Param GetPostProcessDefaultValues (int material, int parameter)
 Returns default values as Param. See 'PPEConstants' file for various typedefs used.
 
Param GetPostProcessCurrentValues (int material, int parameter)
 Returns current values as Param. See 'PPEConstants' file for various typedefs used.
 
void ChangePPEMaterial (PostProcessPrioritiesCamera priority, PostProcessEffectType type, string path, bool scriptside_only)
 Changes material file associated with the script material class. Will be used very rarely, mostly set in C++ anyway.
 
void StopAllEffects (int mask=0)
 stops all effects of a certain kind
 
void DbgPrnt (string text)
 

Variables

class PPEManagerStatic CAMERA_ID = 0
 
bool m_ManagerInitialized
 
ref map< int, ref PPEClassBasem_PPEClassMap
 
ref map< int, ref array< int > > m_PPEMaterialUpdateQueueMap
 
ref array< intm_UpdatedMaterials
 
ref array< ref PPERequesterBasem_ExistingPostprocessRequests
 
ref array< ref PPERequesterBasem_UpdatingRequests
 

Function Documentation

◆ ChangePPEMaterial()

void ChangePPEMaterial ( PostProcessPrioritiesCamera priority,
PostProcessEffectType type,
string path,
bool scriptside_only )
protected

Changes material file associated with the script material class. Will be used very rarely, mostly set in C++ anyway.

Definition at line 344 of file PPEManager.c.

345 {
346 if (m_PPEClassMap.Contains(type))
347 {
349 typename name = mat_class.Type();
351 postprocess_capsule.ChangeMaterialPathUsed(path);
352
353 if (postprocess_capsule.GetMaterial() == 0x0)
354 {
355 Debug.Log("PPEManager | Invalid material path " + path + " used for " + name);
356 return;
357 }
358
359 //m_PPEClassMap.Remove(type);
361 }
362
363 //can be sent script-side only to adapt to c++ options changes
364 if (!scriptside_only)
366 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
class PPEManagerStatic CAMERA_ID
ref map< int, ref PPEClassBase > m_PPEClassMap
Definition PPEManager.c:58
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133
Created once, on manager init. Script-side representation of C++ material class, separate handling.
proto native void SetCameraPostProcessEffect(int cam, int priority, PostProcessEffectType type, string materialPath)

References CAMERA_ID, Debug::Log(), m_PPEClassMap, name, path, and SetCameraPostProcessEffect().

◆ Cleanup()

void Cleanup ( )
protected

Definition at line 70 of file PPEManager.c.

71 {
72 PPERequesterBank.Cleanup();
73
75 {
78 m_UpdatingRequests.Clear();
79 m_PPEClassMap.Clear();
80 }
81 }
ref map< int, ref array< int > > m_PPEMaterialUpdateQueueMap
Definition PPEManager.c:59
bool m_ManagerInitialized
Definition PPEManager.c:57
ref array< ref PPERequesterBase > m_ExistingPostprocessRequests
Definition PPEManager.c:61
ref array< ref PPERequesterBase > m_UpdatingRequests
Definition PPEManager.c:62

References m_ExistingPostprocessRequests, m_ManagerInitialized, m_PPEClassMap, m_PPEMaterialUpdateQueueMap, and m_UpdatingRequests.

◆ ClearMaterialUpdating()

void ClearMaterialUpdating ( )
protected

Definition at line 183 of file PPEManager.c.

184 {
186 }

References m_PPEMaterialUpdateQueueMap.

Referenced by ProcessApplyValueChanges().

◆ DbgPrnt()

void DbgPrnt ( string text)
protected

Definition at line 381 of file PPEManager.c.

382 {
383 //Debug.Log(""+text);
384 }

◆ GetExistingRequester()

bool GetExistingRequester ( typename req ,
out PPERequesterBase ret )
protected

Definition at line 220 of file PPEManager.c.

221 {
222 int idx = m_ExistingPostprocessRequests.Find(PPERequesterBank.GetRequester(req));
223 if (idx > -1)
224 {
226 return true;
227 }
228 return false;
229 }

References m_ExistingPostprocessRequests.

Referenced by IsAnyRequesterRunning().

◆ GetPostProcessCurrentValues()

Param GetPostProcessCurrentValues ( int material,
int parameter )
protected

Returns current values as Param. See 'PPEConstants' file for various typedefs used.

Definition at line 335 of file PPEManager.c.

336 {
338 return mat_class.GetParameterCommandData(parameter).GetCurrentValues();
339 }

References m_PPEClassMap.

◆ GetPostProcessDefaultValues()

Param GetPostProcessDefaultValues ( int material,
int parameter )
protected

Returns default values as Param. See 'PPEConstants' file for various typedefs used.

Definition at line 328 of file PPEManager.c.

329 {
331 return mat_class.GetParameterCommandData(parameter).GetDefaultValues();
332 }

References m_PPEClassMap.

◆ Init()

void Init ( )
protected

Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)

Definition at line 84 of file PPEManager.c.

85 {
86 //DbgPrnt("PPEDebug | PPEManager | m_ManagerInitialized: " + m_ManagerInitialized);
88 {
94
95 GetGame().GetUpdateQueue(CALL_CATEGORY_GUI).Insert(this.Update); //can be safely and easily 'disabled' here
97 }
98 }
ref array< int > m_UpdatedMaterials
Definition PPEManager.c:60
void InitPPEManagerClassMap()
Ordered by 'PostProcessEffectType' for easy access through the same enum; ID saved all the same.
Definition PPEManager.c:101
proto native CGame GetGame()
const int CALL_CATEGORY_GUI
Definition tools.c:9
proto native volatile void Update()

References CALL_CATEGORY_GUI, GetGame(), InitPPEManagerClassMap(), m_ExistingPostprocessRequests, m_ManagerInitialized, m_PPEMaterialUpdateQueueMap, m_UpdatedMaterials, m_UpdatingRequests, and Update().

◆ InitPPEManagerClassMap()

void InitPPEManagerClassMap ( )
protected

Ordered by 'PostProcessEffectType' for easy access through the same enum; ID saved all the same.

Definition at line 101 of file PPEManager.c.

102 {
103 if (m_PPEClassMap)
104 delete m_PPEClassMap;
106
107 RegisterPPEClass(new PPENone()); //dummy
132 }
void RegisterPPEClass(PPEClassBase material_class)
Registeres material class and creates data structure within.
Definition PPEManager.c:135
ChromAber - PostProcessEffectType.ChromAber.
Definition PPEChromAber.c:3
ColorGrading - PostProcessEffectType.ColorGrading.
Colors - PostProcessEffectType.Colors.
Definition PPEColors.c:4
DOF postprocess, does not directly use materials.
Definition PPEDOF.c:6
DepthOfField - PostProcessEffectType.DepthOfField.
DynamicBlur - PostProcessEffectType.DynamicBlur.
EV postprocess, does not directly use materials.
Eye Accomodation postprocess, does not directly use materials.
FXAA - PostProcessEffectType.FXAA.
Definition PPEFXAA.c:3
FilmGrain - PostProcessEffectType.FilmGrain.
Definition PPEFilmGrain.c:7
GaussFilter - PostProcessEffectType.GaussFilter.
Glow - PostProcessEffectType.Glow.
Definition PPEGlow.c:8
GodRays - PostProcessEffectType.GodRays.
Definition PPEGodRays.c:3
HBAO - PostProcessEffectType.HBAO.
Definition PPEHBAO.c:4
g_Game.NightVissionLightParams, does not directly use materials. Controls light multiplication and fi...
Median - PostProcessEffectType.Median.
Definition PPEMedian.c:4
Dummy class - PostProcessEffectType.None.
Definition PPENone.c:3
RadialBlur - PostProcessEffectType.RadialBlur.
Rain - PostProcessEffectType.Rain.
Definition PPERain.c:3
Rotation Blur.
Definition PPERotBlur.c:3
SMAA - PostProcessEffectType.SMAA.
Definition PPESMAA.c:3
SSAO - PostProcessEffectType.SSAO.
Definition PPESSAO.c:3
SunMask - PostProcessEffectType.SunMask.
Definition PPESunMask.c:4
UnderWater - PostProcessEffectType.UnderWater.
WetDistort - PostProcessEffectType.WetDistort.

References m_PPEClassMap, and RegisterPPEClass().

Referenced by Init().

◆ InsertUpdatedMaterial()

void InsertUpdatedMaterial ( int mat_id)
protected

Marks material class as updated and values to be set in the course of update - 'ProcessApplyValueChanges'.

Definition at line 266 of file PPEManager.c.

267 {
268 if (m_UpdatedMaterials.Find(mat_id) == -1)
270 }

References m_UpdatedMaterials.

◆ IsAnyRequesterRunning()

bool IsAnyRequesterRunning ( array< typename > requesters)
protected

Definition at line 231 of file PPEManager.c.

232 {
233 foreach (typename requesterType : requesters)
234 {
237 if (ppeRequester && ppeRequester.IsRequesterRunning())
238 return true;
239 }
240
241 return false;
242 }
bool GetExistingRequester(typename req, out PPERequesterBase ret)
Definition PPEManager.c:220

References GetExistingRequester().

◆ PPEManager()

void PPEManager ( )
protected

Definition at line 64 of file PPEManager.c.

65 {
67 PPERequesterBank.Init();
68 }

References m_ManagerInitialized.

Referenced by PPEManagerStatic::CreateManagerStatic().

◆ ProcessApplyValueChanges()

void ProcessApplyValueChanges ( )
protected

Definition at line 302 of file PPEManager.c.

303 {
304 int material_id;
305 for (int i = 0; i < m_UpdatedMaterials.Count(); i++)
306 {
309 mat_class.ApplyValueChanges();
310 }
311
312 m_UpdatedMaterials.Clear();
314 }
void ClearMaterialUpdating()
Definition PPEManager.c:183

References ClearMaterialUpdating(), m_PPEClassMap, and m_UpdatedMaterials.

Referenced by Update().

◆ ProcessMaterialUpdates()

void ProcessMaterialUpdates ( float timeslice)
protected

Definition at line 287 of file PPEManager.c.

288 {
289 for (int i = 0; i < m_PPEMaterialUpdateQueueMap.Count(); i++) //orders (levels?)
290 {
291 //DbgPrnt("PPEDebug | ProcessMaterialUpdates | GetKey " + i + ": " + m_PPEMaterialUpdateQueueMap.GetKey(i));
292 //DbgPrnt("PPEDebug | ProcessMaterialUpdates | GetElement - count " + i + ": " + m_PPEMaterialUpdateQueueMap.GetElement(i).Count());
293
294 for (int j = 0; j < m_PPEMaterialUpdateQueueMap.GetElement(i).Count(); j++)
295 {
297 mat_class.OnUpdate(timeslice, i);
298 }
299 }
300 }

References Count, m_PPEClassMap, and m_PPEMaterialUpdateQueueMap.

Referenced by Update().

◆ ProcessRequesterUpdates()

void ProcessRequesterUpdates ( float timeslice)
protected

Definition at line 275 of file PPEManager.c.

276 {
278 for (int i = 0; i < m_UpdatingRequests.Count(); i++)
279 {
280 //DbgPrnt("PPEDebug | ProcessRequesterUpdates | m_UpdatingRequests[i]: " + m_UpdatingRequests[i]);
281 req = m_UpdatingRequests.Get(i);
282 if (req)
283 req.OnUpdate(timeslice);
284 }
285 }

References m_UpdatingRequests.

Referenced by Update().

◆ RegisterPPEClass()

void RegisterPPEClass ( PPEClassBase material_class)
protected

Registeres material class and creates data structure within.

Definition at line 135 of file PPEManager.c.

136 {
137 m_PPEClassMap.Set(material_class.GetPostProcessEffectID(), material_class);
138 }

References m_PPEClassMap.

Referenced by InitPPEManagerClassMap().

◆ RemoveActiveRequestFromMaterials()

void RemoveActiveRequestFromMaterials ( PPERequesterBase req)
protected

/brief Originally designed to rip the requester data from all relevant mat/params, but that proved too costly and volatile. /note Still, it is here, use at your own peril.

Definition at line 248 of file PPEManager.c.

249 {
250 int count = req.GetActiveRequestStructure().Count();
251 int mat_id;
252 for (int i = 0; i < count; i++)
253 {
254 mat_id = req.GetActiveRequestStructure().GetKey(i);
256 mat_class.RemoveRequest(req.GetRequesterIDX());
257 }
258 }

References m_PPEClassMap.

◆ RemoveMaterialUpdating()

void RemoveMaterialUpdating ( int material_id,
int order = 0 )
protected

Currently unused, requests remain in the hierarchy and are used when needed (slightly faster than constantly re-shuffilng the arrays)

Definition at line 172 of file PPEManager.c.

173 {
175 {
177
178 if (m_PPEMaterialUpdateQueueMap.Get(order).Count() == 0)
180 }
181 }

References m_PPEMaterialUpdateQueueMap.

◆ RequestsCleanup()

void RequestsCleanup ( )
protected

Unused cleanup method, should it be ever needed.

Definition at line 261 of file PPEManager.c.

262 {
263 }

Referenced by Update().

◆ SendMaterialValueData()

void SendMaterialValueData ( PPERequestParamDataBase data)
protected

Definition at line 140 of file PPEManager.c.

141 {
142 //DbgPrnt("DataVerification | m_ColorTarget | SendMaterialValueData: " + PPERequestParamDataColor.Cast(data).m_ColorTarget[0] + "/" + PPERequestParamDataColor.Cast(data).m_ColorTarget[1] + "/" + PPERequestParamDataColor.Cast(data).m_ColorTarget[2] + "/" + PPERequestParamDataColor.Cast(data).m_ColorTarget[3]);
143 PPEClassBase mat_class = m_PPEClassMap.Get(data.GetMaterialID());
144 mat_class.InsertParamValueData(data);
145 SetMaterialParamUpdating(data.GetMaterialID(), data.GetParameterID(), PPEConstants.DEPENDENCY_ORDER_BASE);
146 }
void SetMaterialParamUpdating(int material_id, int parameter_id, int order)
Queues material/parameter to update (once)
Definition PPEManager.c:149

References m_PPEClassMap, and SetMaterialParamUpdating().

◆ SetMaterialParamUpdating()

void SetMaterialParamUpdating ( int material_id,
int parameter_id,
int order )
protected

Queues material/parameter to update (once)

Definition at line 149 of file PPEManager.c.

150 {
151 if (order > PPEConstants.DEPENDENCY_ORDER_HIGHEST)
152 {
153 //DbgPrnt("PPEDebug | PPEManager - SetMaterialParamUpdating | Order higher than max, ignoring! | mat/par/ord: " + material_id + "/" + parameter_id + "/" + order);
154 return;
155 }
156
158
159 //DbgPrnt("PPEDebug | PPEManager - SetMaterialParamUpdating | mat/par: " + material_id + "/" + parameter_id);
160 //insert material into queue
161 if (!m_PPEMaterialUpdateQueueMap.Contains(order))
163
165 if (found == -1)
167
168 mat_class.SetParameterUpdating(order, parameter_id);
169 }

References m_PPEClassMap, and m_PPEMaterialUpdateQueueMap.

Referenced by SendMaterialValueData().

◆ SetRequestActive()

void SetRequestActive ( PPERequesterBase request,
bool active )
protected

Marks requester as 'active'. Currently indistinguiishable from 'updating' requester, can potentially be used for intermittently updated requesters.

Definition at line 189 of file PPEManager.c.

190 {
192 if (active && found == -1)
194 else if (!active && found > -1) //should always be found in this case, redundant?
195 {
196 //RemoveActiveRequestFromMaterials(request);
197
199 }
200 }

References m_ExistingPostprocessRequests.

◆ SetRequestUpdating()

void SetRequestUpdating ( PPERequesterBase request,
bool active )
protected

Marks requester as 'updating' and to be processed on manager update.

Definition at line 203 of file PPEManager.c.

204 {
206 {
207 Debug.Log("PPEManager | SetRequestUpdating | !m_UpdatingRequests");
208 return;
209 }
210
211 int idx = m_UpdatingRequests.Find(request);
212
213 if (active && idx == -1)
215 else if (!active && idx > -1)
216 m_UpdatingRequests.Remove(idx);
217 }

References Debug::Log(), and m_UpdatingRequests.

◆ StopAllEffects()

void StopAllEffects ( int mask = 0)
protected

stops all effects of a certain kind

Definition at line 369 of file PPEManager.c.

370 {
372 {
374 {
375 if (requester.GetCategoryMask() & mask)
376 requester.Stop();
377 }
378 }
379 }

References m_ExistingPostprocessRequests.

◆ Update()

void Update ( float timeslice)
protected

Definition at line 316 of file PPEManager.c.

317 {
319 return;
320
324 RequestsCleanup(); //unused
325 }
void RequestsCleanup()
Unused cleanup method, should it be ever needed.
Definition PPEManager.c:261
void ProcessRequesterUpdates(float timeslice)
Definition PPEManager.c:275
void ProcessApplyValueChanges()
Definition PPEManager.c:302
void ProcessMaterialUpdates(float timeslice)
Definition PPEManager.c:287

References m_ManagerInitialized, ProcessApplyValueChanges(), ProcessMaterialUpdates(), ProcessRequesterUpdates(), and RequestsCleanup().

Variable Documentation

◆ CAMERA_ID

class PPEManagerStatic CAMERA_ID = 0

/brief Postprocess manager, responsible for updates, receiving, and re-distributing requester data to their respective destinations. /par Basic post process flow outline: Getting a registered 'PPERequester' instance from the 'PPERequesterBank'

/par Launching the requester, either through an overriden 'Start' method, or custom method with some setters (both flag it as active and to be processed)

/par On render update, PPEManager: Handles queued requester changes, re-distributes individual commands to material structure

/par Updates the material/parameter structure and calculates the blend values

/par Sets the final values via native functions (only called once per changed parameter - optimization stonks)

/note Requester serves as a centralized platform for specific effec/group of effects. Although technically the direct commands to mat/param would be feasible, this allows for easier control of effect groups, /note and clearer command hierarchy (no value setters without clear parentage).

Referenced by ChangePPEMaterial().

◆ m_ExistingPostprocessRequests

ref array<ref PPERequesterBase> m_ExistingPostprocessRequests
protected

Definition at line 61 of file PPEManager.c.

Referenced by Cleanup(), GetExistingRequester(), Init(), SetRequestActive(), and StopAllEffects().

◆ m_ManagerInitialized

bool m_ManagerInitialized
protected

Definition at line 57 of file PPEManager.c.

Referenced by Cleanup(), Init(), PPEManager(), and Update().

◆ m_PPEClassMap

◆ m_PPEMaterialUpdateQueueMap

ref map<int, ref array<int> > m_PPEMaterialUpdateQueueMap
protected

◆ m_UpdatedMaterials

ref array<int> m_UpdatedMaterials
protected

Definition at line 60 of file PPEManager.c.

Referenced by Init(), InsertUpdatedMaterial(), and ProcessApplyValueChanges().

◆ m_UpdatingRequests

ref array<ref PPERequesterBase> m_UpdatingRequests
protected

Definition at line 62 of file PPEManager.c.

Referenced by Cleanup(), Init(), ProcessRequesterUpdates(), and SetRequestUpdating().