DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
PPEManager.c
См. документацию.
1
3{
4 static ref PPEManager m_Manager;
5
6 static void CreateManagerStatic()
7 {
8 if (m_Manager)
9 {
10 Debug.Log("PPEManagerStatic | CreateManagerStatic - PPEManager already exists");
11 return;
12 }
13
15 }
16
18 {
19 if (m_Manager)
20 {
21 m_Manager.Cleanup();
22 delete m_Manager;
23 }
24 }
25
28 {
29 return m_Manager;
30 }
31}
32
53class PPEManager extends Managed
54{
55 const int CAMERA_ID = 0;
56
57 protected bool m_ManagerInitialized;
58 protected ref map<int, ref PPEClassBase> m_PPEClassMap; //contains sorted postprocess classes, IDs in 'PostProcessEffectType' // <MaterialID,<material_class>>
59 protected ref map<int, ref array<int>> m_PPEMaterialUpdateQueueMap; //multiple levels of update queues, to allow for multiple dependent updates during same frame (greedy?)
61 protected ref array<ref PPERequesterBase> m_ExistingPostprocessRequests; //which requests are active overall. Does not have to be updating ATM!
62 protected ref array<ref PPERequesterBase> m_UpdatingRequests; //which requests are currently updating and processing
63
65 {
67 PPERequesterBank.Init();
68 }
69
70 void Cleanup()
71 {
72 PPERequesterBank.Cleanup();
73
75 {
78 m_UpdatingRequests.Clear();
79 m_PPEClassMap.Clear();
80 }
81 }
82
84 void Init()
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 }
99
137
139 protected void RegisterPPEClass(PPEClassBase material_class)
140 {
141 m_PPEClassMap.Set(material_class.GetPostProcessEffectID(), material_class);
142 }
143
145 {
146 //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]);
147 PPEClassBase mat_class = m_PPEClassMap.Get(data.GetMaterialID());
148 mat_class.InsertParamValueData(data);
149 SetMaterialParamUpdating(data.GetMaterialID(),data.GetParameterID(),PPEConstants.DEPENDENCY_ORDER_BASE);
150 }
151
153 void SetMaterialParamUpdating(int material_id, int parameter_id, int order)
154 {
155 if ( order > PPEConstants.DEPENDENCY_ORDER_HIGHEST )
156 {
157 //DbgPrnt("PPEDebug | PPEManager - SetMaterialParamUpdating | Order higher than max, ignoring! | mat/par/ord: " + material_id + "/" + parameter_id + "/" + order);
158 return;
159 }
160
161 PPEClassBase mat_class = m_PPEClassMap.Get(material_id);
162
163 //DbgPrnt("PPEDebug | PPEManager - SetMaterialParamUpdating | mat/par: " + material_id + "/" + parameter_id);
164 //insert material into queue
165 if ( !m_PPEMaterialUpdateQueueMap.Contains(order) )
167
168 int found = m_PPEMaterialUpdateQueueMap.Get(order).Find(material_id);
169 if ( found == -1 )
170 {
171 m_PPEMaterialUpdateQueueMap.Get(order).Insert(material_id);
172 }
173
174 mat_class.SetParameterUpdating(order,parameter_id);
175 }
176
178 void RemoveMaterialUpdating(int material_id, int order = 0)
179 {
180 if ( m_PPEMaterialUpdateQueueMap.Contains(order) )
181 {
182 m_PPEMaterialUpdateQueueMap.Get(order).RemoveItem(material_id);
183
184 if ( m_PPEMaterialUpdateQueueMap.Get(order).Count() == 0)
185 m_PPEMaterialUpdateQueueMap.Remove(order);
186 }
187 }
188
189 protected void ClearMaterialUpdating()
190 {
192 }
193
195 void SetRequestActive(PPERequesterBase request, bool active)
196 {
197 int found = m_ExistingPostprocessRequests.Find(request);
198 if ( active && found == -1 )
199 {
200 m_ExistingPostprocessRequests.Insert(request);
201 }
202 else if ( !active && found > -1 ) //should always be found in this case, redundant?
203 {
204 //RemoveActiveRequestFromMaterials(request);
205
206 m_ExistingPostprocessRequests.Remove(found);
207 }
208 }
209
211 void SetRequestUpdating(PPERequesterBase request, bool active)
212 {
214 {
215 Debug.Log("PPEManager | SetRequestUpdating | !m_UpdatingRequests");
216 return;
217 }
218
219 int idx = m_UpdatingRequests.Find(request);
220
221 if ( active && idx == -1 )
222 {
223 m_UpdatingRequests.Insert(request);
224 }
225 else if ( !active && idx > -1 )
226 {
227 m_UpdatingRequests.Remove(idx);
228 }
229 }
230
231 // Just a getter
232 bool GetExistingRequester(typename req, out PPERequesterBase ret)
233 {
234 int idx = m_ExistingPostprocessRequests.Find(PPERequesterBank.GetRequester(req));
235 if (idx > -1)
236 {
237 ret = m_ExistingPostprocessRequests.Get(idx);
238 return true;
239 }
240 return false;
241 }
242
244 {
245 foreach (typename requesterType : requesters)
246 {
247 PPERequesterBase ppeRequester;
248 GetExistingRequester(requesterType, ppeRequester);
249 if (ppeRequester && ppeRequester.IsRequesterRunning())
250 return true;
251 }
252
253 return false;
254 }
255
261 {
262 int count = req.GetActiveRequestStructure().Count();
263 int mat_id;
264 for (int i = 0; i < count; i++)
265 {
266 mat_id = req.GetActiveRequestStructure().GetKey(i);
267 PPEClassBase mat_class = m_PPEClassMap.Get(mat_id);
268 mat_class.RemoveRequest(req.GetRequesterIDX());
269 }
270 }
271
273 protected void RequestsCleanup()
274 {
275 }
276
278 void InsertUpdatedMaterial(int mat_id)
279 {
280 if ( m_UpdatedMaterials.Find(mat_id) == -1 )
281 m_UpdatedMaterials.Insert(mat_id);
282 }
283
284 //---------//
285 //PROCESSING
286 //---------//
287 protected void ProcessRequesterUpdates(float timeslice)
288 {
290 for (int i = 0; i < m_UpdatingRequests.Count(); i++)
291 {
292 //DbgPrnt("PPEDebug | ProcessRequesterUpdates | m_UpdatingRequests[i]: " + m_UpdatingRequests[i]);
293 req = m_UpdatingRequests.Get(i);
294 if (req)
295 req.OnUpdate(timeslice);
296 }
297 }
298
299 protected void ProcessMaterialUpdates(float timeslice)
300 {
301 for (int i = 0; i < m_PPEMaterialUpdateQueueMap.Count(); i++) //orders (levels?)
302 {
303 //DbgPrnt("PPEDebug | ProcessMaterialUpdates | GetKey " + i + ": " + m_PPEMaterialUpdateQueueMap.GetKey(i));
304 //DbgPrnt("PPEDebug | ProcessMaterialUpdates | GetElement - count " + i + ": " + m_PPEMaterialUpdateQueueMap.GetElement(i).Count());
305
306 for (int j = 0; j < m_PPEMaterialUpdateQueueMap.GetElement(i).Count(); j++)
307 {
308 PPEClassBase mat_class = m_PPEClassMap.Get(m_PPEMaterialUpdateQueueMap.GetElement(i).Get(j));
309 mat_class.OnUpdate(timeslice,i);
310 }
311 }
312 }
313
315 {
316 int material_id;
317 for (int i = 0; i < m_UpdatedMaterials.Count(); i++)
318 {
319 material_id = m_UpdatedMaterials.Get(i);
320 PPEClassBase mat_class = m_PPEClassMap.Get(material_id);
321 mat_class.ApplyValueChanges();
322 }
323
324 m_UpdatedMaterials.Clear();
326 }
327
328 void Update(float timeslice)
329 {
331 return;
332
333 ProcessRequesterUpdates(timeslice);
334 ProcessMaterialUpdates(timeslice);
336 RequestsCleanup(); //unused
337 }
338
340 Param GetPostProcessDefaultValues(int material, int parameter)
341 {
342 PPEClassBase mat_class = m_PPEClassMap.Get(material);
343 return mat_class.GetParameterCommandData(parameter).GetDefaultValues();
344 }
345
347 Param GetPostProcessCurrentValues(int material, int parameter)
348 {
349 PPEClassBase mat_class = m_PPEClassMap.Get(material);
350 return mat_class.GetParameterCommandData(parameter).GetCurrentValues();
351 }
352
353 //TODO - certain C++ events may change the actual material path with a graphics option changes. Reflect this on script-side!
354 //Currently only SSAY/HBAO affected...welp.
356 void ChangePPEMaterial(PostProcessPrioritiesCamera priority, PostProcessEffectType type, string path, bool scriptside_only)
357 {
358 if (m_PPEClassMap.Contains(type))
359 {
360 PPEClassBase mat_class = m_PPEClassMap.Get(type);
361 typename name = mat_class.Type();
362 PPEClassBase postprocess_capsule = PPEClassBase.Cast(name.Spawn());
363 postprocess_capsule.ChangeMaterialPathUsed(path);
364
365 if (postprocess_capsule.GetMaterial() == 0x0)
366 {
367 Debug.Log("PPEManager | Invalid material path " + path + " used for " + name );
368 return;
369 }
370
371 //m_PPEClassMap.Remove(type);
372 m_PPEClassMap.Set(type,postprocess_capsule);
373 }
374
375 //can be sent script-side only to adapt to c++ options changes
376 if (!scriptside_only)
378 }
379
381 void StopAllEffects(int mask = 0)
382 {
384 {
386 {
387 if (requester.GetCategoryMask() & mask)
388 {
389 requester.Stop();
390 }
391 }
392 }
393 }
394
395 void DbgPrnt(string text)
396 {
397 //Debug.Log(""+text);
398 }
399};
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
map
Определения ControlsXboxNew.c:4
string path
Определения OptionSelectorMultistate.c:142
PostProcessPrioritiesCamera
PPE type priorities, C++ based. DO NOT CHANGE ORDER! Used only when calling 'SetCameraPostProcessEffe...
Определения PPEConstants.c:3
void DbgPrnt(string text)
Определения PPEManager.c:395
ref map< int, ref array< int > > m_PPEMaterialUpdateQueueMap
Определения PPEManager.c:59
bool m_ManagerInitialized
Определения PPEManager.c:57
ref array< ref PPERequesterBase > m_ExistingPostprocessRequests
Определения PPEManager.c:61
void PPEManager()
Определения PPEManager.c:64
void SetRequestActive(PPERequesterBase request, bool active)
Marks requester as 'active'. Currently indistinguiishable from 'updating' requester,...
Определения PPEManager.c:195
void InsertUpdatedMaterial(int mat_id)
Marks material class as updated and values to be set in the course of update - 'ProcessApplyValueChan...
Определения PPEManager.c:278
class PPEManagerStatic CAMERA_ID
void RequestsCleanup()
Unused cleanup method, should it be ever needed.
Определения PPEManager.c:273
bool IsAnyRequesterRunning(array< typename > requesters)
Определения PPEManager.c:243
void ProcessRequesterUpdates(float timeslice)
Определения PPEManager.c:287
void ProcessApplyValueChanges()
Определения PPEManager.c:314
ref array< int > m_UpdatedMaterials
Определения PPEManager.c:60
ref map< int, ref PPEClassBase > m_PPEClassMap
Определения PPEManager.c:58
void InitPPEManagerClassMap()
Ordered by 'PostProcessEffectType' for easy access through the same enum; ID saved all the same.
Определения PPEManager.c:101
ref array< ref PPERequesterBase > m_UpdatingRequests
Определения PPEManager.c:62
Param GetPostProcessDefaultValues(int material, int parameter)
Returns default values as Param. See 'PPEConstants' file for various typedefs used.
Определения PPEManager.c:340
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,...
Определения PPEManager.c:356
void RegisterPPEClass(PPEClassBase material_class)
Registeres material class and creates data structure within.
Определения PPEManager.c:139
void RemoveActiveRequestFromMaterials(PPERequesterBase req)
Определения PPEManager.c:260
void SetMaterialParamUpdating(int material_id, int parameter_id, int order)
Queues material/parameter to update (once)
Определения PPEManager.c:153
void SendMaterialValueData(PPERequestParamDataBase data)
Определения PPEManager.c:144
void ClearMaterialUpdating()
Определения PPEManager.c:189
void RemoveMaterialUpdating(int material_id, int order=0)
Currently unused, requests remain in the hierarchy and are used when needed (slightly faster than con...
Определения PPEManager.c:178
void SetRequestUpdating(PPERequesterBase request, bool active)
Marks requester as 'updating' and to be processed on manager update.
Определения PPEManager.c:211
void ProcessMaterialUpdates(float timeslice)
Определения PPEManager.c:299
bool GetExistingRequester(typename req, out PPERequesterBase ret)
Определения PPEManager.c:232
Param GetPostProcessCurrentValues(int material, int parameter)
Returns current values as Param. See 'PPEConstants' file for various typedefs used.
Определения PPEManager.c:347
@ Count
Определения RandomGeneratorSyncManager.c:8
override ScriptInvoker GetUpdateQueue(int call_category)
Определения DayZGame.c:1192
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.
Определения Debug.c:122
Определения Debug.c:2
static void Init()
Определения PPERequesterBank.c:51
void StopAllEffects()
Определения GameplayEffectWidgets_base.c:12
static void Cleanup()
Определения PPERequesterBank.c:61
TODO doc.
Определения EnScript.c:118
ChromAber - PostProcessEffectType.ChromAber.
Определения PPEChromAber.c:3
void ChangeMaterialPathUsed(string path)
Определения PPEMatClassesBase.c:326
void InsertParamValueData(PPERequestParamDataBase request_data)
Distributes requester data to the material class structure and links them to appropriate parameter.
Определения PPEMatClassesBase.c:151
Material GetMaterial()
Определения PPEMatClassesBase.c:41
void RemoveRequest(int req_idx)
unused, see 'RemoveActiveRequestFromMaterials' for more info
Определения PPEMatClassesBase.c:170
void ApplyValueChanges()
Определения PPEMatClassesBase.c:269
void OnUpdate(float timeslice, int order)
generic update method, take care when overriding!
Определения PPEMatClassesBase.c:201
void SetParameterUpdating(int order, int parameter_id)
Queue specific parameter of this material to update.
Определения PPEMatClassesBase.c:295
int GetPostProcessEffectID()
Overriden in all material classes!
Определения PPEMatClassesBase.c:339
PPEMatClassParameterCommandData GetParameterCommandData(int parameter_idx)
Some PP effects are handled as hard-coded exceptions, outside of material system. Default == PPEExcep...
Определения PPEMatClassesBase.c:350
Created once, on manager init. Script-side representation of C++ material class, separate handling.
Определения PPEMatClassesBase.c:3
ColorGrading - PostProcessEffectType.ColorGrading.
Определения PPEColorGrading.c:4
Colors - PostProcessEffectType.Colors.
Определения PPEColors.c:4
DOF postprocess, does not directly use materials.
Определения PPEDOF.c:6
DepthOfField - PostProcessEffectType.DepthOfField.
Определения PPEDepthOfField.c:4
Distort - PostProcessEffectType.Distort.
Определения PPEDistort.c:3
DynamicBlur - PostProcessEffectType.DynamicBlur.
Определения PPEDynamicBlur.c:3
EV postprocess, does not directly use materials.
Определения PPEExposureNative.c:6
Eye Accomodation postprocess, does not directly use materials.
Определения PPEEyeAccomodationNative.c:6
FXAA - PostProcessEffectType.FXAA.
Определения PPEFXAA.c:3
FilmGrain - PostProcessEffectType.FilmGrain.
Определения PPEFilmGrain.c:7
GaussFilter - PostProcessEffectType.GaussFilter.
Определения PPEGaussFilter.c:3
Ghost - PostProcessEffectType.Ghost.
Определения PPEGhost.c:3
Glow - PostProcessEffectType.Glow.
Определения PPEGlow.c:8
GodRays - PostProcessEffectType.GodRays.
Определения PPEGodRays.c:3
HBAO - PostProcessEffectType.HBAO.
Определения PPEHBAO.c:4
g_Game.NightVissionLightParams, does not directly use materials. Controls light multiplication and fi...
Определения PPELightIntensityParamsNative.c:6
static void CreateManagerStatic()
Определения PPEManager.c:6
static PPEManager GetPPEManager()
Returns the manager instance singleton.
Определения PPEManager.c:27
static void DestroyManagerStatic()
Определения PPEManager.c:17
static ref PPEManager m_Manager
Определения PPEManager.c:4
Static component of PPE manager, used to hold the instance.
Определения PPEManager.c:3
Param GetCurrentValues()
Careful, only actual values, WITHOUT string.
Param GetDefaultValues()
Careful, formating is such, that param1 is ALWAYS string, containing parameter name,...
Median - PostProcessEffectType.Median.
Определения PPEMedian.c:4
Dummy class - PostProcessEffectType.None.
Определения PPENone.c:3
RadialBlur - PostProcessEffectType.RadialBlur.
Определения PPERadialBlur.c:3
Rain - PostProcessEffectType.Rain.
Определения PPERain.c:3
int GetParameterID()
Определения PPERequestData.c:74
int GetMaterialID()
Определения PPERequestData.c:69
Data for one material parameter, requester side.
Определения PPERequestData.c:3
int GetRequesterIDX()
Returns requester index.
Определения PPERequestPlatformsBase.c:65
void OnUpdate(float delta)
Определения PPERequestPlatformsBase.c:336
bool IsRequesterRunning()
Определения PPERequestPlatformsBase.c:53
map< int, ref map< int, ref PPERequestParamDataBase > > GetActiveRequestStructure()
Определения PPERequestPlatformsBase.c:319
Rotation Blur.
Определения PPERotBlur.c:3
SMAA - PostProcessEffectType.SMAA.
Определения PPESMAA.c:3
SSAO - PostProcessEffectType.SSAO.
Определения PPESSAO.c:3
SunMask - PostProcessEffectType.SunMask.
Определения PPESunMask.c:4
UnderWater - PostProcessEffectType.UnderWater.
Определения PPEUnderWater.c:3
WetDistort - PostProcessEffectType.WetDistort.
Определения PPEWetDistort.c:3
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
PostProcessEffectType
Post-process effect type.
Определения EnWorld.c:72
proto native void SetCameraPostProcessEffect(int cam, int priority, PostProcessEffectType type, string materialPath)
const int CALL_CATEGORY_GUI
Определения tools.c:9
proto native volatile void Update()
Определения PlayerSoundManager.c:125