DayZ 1.24
Loading...
Searching...
No Matches
PPEClassBase Class Reference

Created once, on manager init. Script-side representation of C++ material class, separate handling. More...

Inheritance diagram for PPEClassBase:
[legend]
Collaboration diagram for PPEClassBase:
[legend]

Protected Member Functions

void PPEClassBase (string mat_path_override="")
 
void Init (string mat_path_override="")
 
void CreateMaterial ()
 
Material GetMaterial ()
 
void CreateDataStructure ()
 
void RegisterMaterialParameters ()
 inserted into associative array by parameter int value, parameter registration order does not matter (still ordered, though)
 
void RegisterParameterScalarBool (int idx, string parameter_name, bool default_value)
 
void RegisterParameterScalarInt (int idx, string parameter_name, int default_value, int min, int max)
 
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 the renderer can handle! When in doubt, try some higher/lower values...
 
void RegisterParameterScalarFloatEx (int idx, string parameter_name, float default_value, float min, float max, typename type)
 WARNING - min/max values are usually taken from Workbench defaults, may not be actual min/max values the renderer can handle! When in doubt, try some higher/lower values...
 
void RegisterParameterColor (int idx, string parameter_name, float r, float g, float b, float a)
 WARNING - min/max values are usually taken from Workbench defaults, may not be actual min/max values the renderer can handle! When in doubt, try some higher/lower values...
 
void RegisterParameterColorEx (int idx, string parameter_name, float r, float g, float b, float a, typename type)
 WARNING - min/max values are usually taken from Workbench defaults, may not be actual min/max values the renderer can handle! When in doubt, try some higher/lower values...
 
void RegisterParameterVector (int idx, string parameter_name, array< float > default_values)
 
void RegisterParameterTexture (int idx, string parameter_name, string default_path)
 
void RegisterParameterResource (int idx, string parameter_name, string default_path)
 
void InsertParamValueData (PPERequestParamDataBase request_data)
 Distributes requester data to the material class structure and links them to appropriate parameter.
 
void RemoveRequest (int req_idx)
 unused, see 'RemoveActiveRequestFromMaterials' for more info
 
void OnUpdate (float timeslice, int order)
 generic update method, take care when overriding!
 
void SetFinalParameterValue (int parameter_idx)
 Clamps the values being set to defaults, if there is no request setting non-zero values on the parameter.
 
void ApplyValueChanges ()
 
void InsertUpdatedParameter (int mat_id)
 
void ParamUpdateRemove (int parameter_idx)
 Queue selected parameter for removal from the update queue.
 
void SetParameterUpdating (int order, int parameter_id)
 Queue specific parameter of this material to update.
 
void ParamUpdateQueueCleanup (int order)
 
string GetDefaultMaterialPath ()
 override this if you want to use different path by default; '.emat' is appended automatically
 
void ChangeMaterialPathUsed (string path)
 
string GetCurrentMaterialPath ()
 
int GetPostProcessEffectID ()
 Overriden in all material classes!
 
PPEMatClassParameterCommandData GetParameterCommandData (int parameter_idx)
 Some PP effects are handled as hard-coded exceptions, outside of material system. Default == PPEExceptions.NONE (systemic behaviour)
 
void DbgPrnt (string text)
 

Protected Attributes

PPEManager m_Manager
 
string m_MaterialPath = ""
 
Material m_Material
 
ref map< int, ref array< int > > m_ParameterUpdateQueueMap
 
ref array< intm_ParameterRemovalQueue
 
ref array< intm_UpdatedParameters
 
ref map< int, ref PPEMatClassParameterCommandDatam_MaterialParamMapStructure
 

Detailed Description

Created once, on manager init. Script-side representation of C++ material class, separate handling.

Definition at line 2 of file PPEMatClassesBase.c.

Constructor & Destructor Documentation

◆ PPEClassBase()

void PPEClassBase::PPEClassBase ( string mat_path_override = "")
inlineprotected

Definition at line 14 of file PPEMatClassesBase.c.

15 {
20 }
override Widget Init()
Definition DayZGame.c:120
void RegisterMaterialParameters()
inserted into associative array by parameter int value, parameter registration order does not matter ...
void CreateDataStructure()

References CreateDataStructure(), CreateMaterial(), Init(), and RegisterMaterialParameters().

Member Function Documentation

◆ ApplyValueChanges()

void PPEClassBase::ApplyValueChanges ( )
inlineprotected

Definition at line 265 of file PPEMatClassesBase.c.

266 {
267 int parameter_id;
268 for (int i = 0; i < m_UpdatedParameters.Count(); i++)
269 {
272 }
273
274 m_UpdatedParameters.Clear();
275 }
void SetFinalParameterValue(int parameter_idx)
Clamps the values being set to defaults, if there is no request setting non-zero values on the parame...
ref array< int > m_UpdatedParameters

References m_UpdatedParameters, and SetFinalParameterValue().

◆ ChangeMaterialPathUsed()

void PPEClassBase::ChangeMaterialPathUsed ( string path)
inlineprotected

Definition at line 318 of file PPEMatClassesBase.c.

319 {
323 }
Material m_Material

References CreateMaterial(), m_Material, m_MaterialPath, and path.

◆ CreateDataStructure()

void PPEClassBase::CreateDataStructure ( )
inlineprotected

Definition at line 43 of file PPEMatClassesBase.c.

44 {
46 //m_ParameterUpdateQueue = new array<int>;
50 }
ref map< int, ref array< int > > m_ParameterUpdateQueueMap
ref array< int > m_ParameterRemovalQueue
ref map< int, ref PPEMatClassParameterCommandData > m_MaterialParamMapStructure

References m_MaterialParamMapStructure, m_ParameterRemovalQueue, m_ParameterUpdateQueueMap, and m_UpdatedParameters.

Referenced by PPEClassBase().

◆ CreateMaterial()

void PPEClassBase::CreateMaterial ( )
inlineprotected

Definition at line 31 of file PPEMatClassesBase.c.

32 {
33 if (m_MaterialPath != "")
34 m_Material = GetGame().GetWorld().GetMaterial(m_MaterialPath);
35 }
proto native CGame GetGame()

References GetGame(), m_Material, and m_MaterialPath.

Referenced by ChangeMaterialPathUsed(), and PPEClassBase().

◆ DbgPrnt()

void PPEClassBase::DbgPrnt ( string text)
inlineprotected

Definition at line 372 of file PPEMatClassesBase.c.

373 {
374 //Debug.Log(""+text);
375 }

◆ GetCurrentMaterialPath()

string PPEClassBase::GetCurrentMaterialPath ( )
inlineprotected

Definition at line 325 of file PPEMatClassesBase.c.

326 {
327 return m_MaterialPath;
328 }

References m_MaterialPath.

◆ GetDefaultMaterialPath()

string PPEClassBase::GetDefaultMaterialPath ( )
protected

override this if you want to use different path by default; '.emat' is appended automatically

Referenced by Init().

◆ GetMaterial()

Material PPEClassBase::GetMaterial ( )
inlineprotected

Definition at line 37 of file PPEMatClassesBase.c.

38 {
39 return m_Material;
40 }

References m_Material.

◆ GetParameterCommandData()

PPEMatClassParameterCommandData PPEClassBase::GetParameterCommandData ( int parameter_idx)
inlineprotected

Some PP effects are handled as hard-coded exceptions, outside of material system. Default == PPEExceptions.NONE (systemic behaviour)

Definition at line 342 of file PPEMatClassesBase.c.

343 {
345 }

References m_MaterialParamMapStructure.

Referenced by PPEDOF::SetFinalParameterValue(), PPEExposureNative::SetFinalParameterValue(), PPEEyeAccomodationNative::SetFinalParameterValue(), PPELightIntensityParamsNative::SetFinalParameterValue(), and SetFinalParameterValue().

◆ GetPostProcessEffectID()

int PPEClassBase::GetPostProcessEffectID ( )
inlineprotected

◆ Init()

void PPEClassBase::Init ( string mat_path_override = "")
inlineprotected

Definition at line 22 of file PPEMatClassesBase.c.

23 {
24 if (mat_path_override != "")
26 else
29 }
string GetDefaultMaterialPath()
override this if you want to use different path by default; '.emat' is appended automatically
PPEManager m_Manager
Static component of PPE manager, used to hold the instance.
Definition PPEManager.c:3
static PPEManager GetPPEManager()
Returns the manager instance singleton.
Definition PPEManager.c:27

References GetDefaultMaterialPath(), PPEManagerStatic::GetPPEManager(), m_Manager, and m_MaterialPath.

◆ InsertParamValueData()

void PPEClassBase::InsertParamValueData ( PPERequestParamDataBase request_data)
inlineprotected

Distributes requester data to the material class structure and links them to appropriate parameter.

Definition at line 147 of file PPEMatClassesBase.c.

148 {
150 bool exists = m_MaterialParamMapStructure.Find(request_data.GetParameterID(), param_data);
151 if (!exists)
152 {
153 Error("PPEClassBase | InsertParamValueData | mat/par/req: " + GetPostProcessEffectID() + "/" + request_data.GetParameterID() + "/" + request_data.GetRequesterIDX() + " not registered in m_MaterialParamMapStructure!");
154 return;
155 }
156
157 request_data.SetDataActive(true);
158 request_data.SetUpdatingDataValues(true); //marks request data as updating
159 param_data.InsertRequestData(request_data);//<request_ID, data>
160
161 //DbgPrnt("PPEDebug | InsertParamValueData | mat/par/req: " + GetPostProcessEffectID() + "/" + request_data.GetParameterID() + "/" + request_data.GetRequesterIDX() + " | requester: " + request_data.m_Requester);
162 }
int GetPostProcessEffectID()
Overriden in all material classes!
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

References Error(), GetPostProcessEffectID(), and m_MaterialParamMapStructure.

◆ InsertUpdatedParameter()

void PPEClassBase::InsertUpdatedParameter ( int mat_id)
inlineprotected

Definition at line 277 of file PPEMatClassesBase.c.

278 {
279 if (m_UpdatedParameters.Find(mat_id) == -1)
281 }

References m_UpdatedParameters.

Referenced by OnUpdate().

◆ OnUpdate()

void PPEClassBase::OnUpdate ( float timeslice,
int order )
inlineprotected

generic update method, take care when overriding!

Definition at line 197 of file PPEMatClassesBase.c.

198 {
199 int parameter_idx = -1;
200 //DbgPrnt("PPEDebug | PPEClassBase - OnUpdate | mat_id: " + GetPostProcessEffectID());
201
202 if (m_ParameterUpdateQueueMap.Contains(order))
203 {
204 //Print(m_ParameterUpdateQueueMap.Get(order));
205 for (int i = 0; i < m_ParameterUpdateQueueMap.Get(order).Count(); i++)
206 {
207 //DbgPrnt("PPEDebug | PPEClassBase - OnUpdate | parameter_idx: " + m_ParameterUpdateQueue.Get(i));
208 Param p_values; //TODO - move to material classes?
209 bool setting_defaults = false;
212
214 }
215 m_Manager.InsertUpdatedMaterial(GetPostProcessEffectID());
216
218 }
219 /*if ( !m_ParameterUpdateQueueMap.Contains(order) || m_ParameterUpdateQueueMap.Get(order).Count() < 1 )
220 m_Manager.RemoveMaterialUpdating(GetPostProcessEffectID(),order); //stops material from updating when no parameters are.*/
221 }
void ParamUpdateQueueCleanup(int order)
void InsertUpdatedParameter(int mat_id)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12

References Count, GetPostProcessEffectID(), InsertUpdatedParameter(), m_Manager, m_MaterialParamMapStructure, m_ParameterUpdateQueueMap, and ParamUpdateQueueCleanup().

◆ ParamUpdateQueueCleanup()

void PPEClassBase::ParamUpdateQueueCleanup ( int order)
inlineprotected

Definition at line 300 of file PPEMatClassesBase.c.

301 {
302 //DbgPrnt("PPEDebug | PPEClassBase - ParamUpdateQueueCleanup | mat_id: " + GetPostProcessEffectID() + " | UpdateQueue count: " + m_ParameterUpdateQueue.Count());
303 //DbgPrnt("PPEDebug | PPEClassBase - ParamUpdateQueueCleanup | mat_id: " + GetPostProcessEffectID() + " | RemovalQueue count: " + m_ParameterRemovalQueue.Count());
304 for (int i = 0; i < m_ParameterUpdateQueueMap.Get(order).Count(); i++)
305 {
307 {
308 //DbgPrnt("PPEDebug | PPEClassBase - ParamUpdateQueueCleanup | removing update of: " + m_ParameterUpdateQueue.Get(i));
309 //m_ParameterUpdateQueue.RemoveItem(m_ParameterUpdateQueue.Get(i));
310 }
311 }
312 m_ParameterUpdateQueueMap.Get(order).Clear();
313 }

References Count, m_ParameterRemovalQueue, and m_ParameterUpdateQueueMap.

Referenced by OnUpdate().

◆ ParamUpdateRemove()

void PPEClassBase::ParamUpdateRemove ( int parameter_idx)
inlineprotected

Queue selected parameter for removal from the update queue.

Definition at line 284 of file PPEMatClassesBase.c.

285 {
288 }

References m_ParameterRemovalQueue.

◆ RegisterMaterialParameters()

void PPEClassBase::RegisterMaterialParameters ( )
protected

inserted into associative array by parameter int value, parameter registration order does not matter (still ordered, though)

Referenced by PPEClassBase().

◆ RegisterParameterColor()

void PPEClassBase::RegisterParameterColor ( int idx,
string parameter_name,
float r,
float g,
float b,
float a )
inlineprotected

WARNING - min/max values are usually taken from Workbench defaults, may not be actual min/max values the renderer can handle! When in doubt, try some higher/lower values...

Definition at line 98 of file PPEMatClassesBase.c.

99 {
102 parameter_data.RegisterDefaults(p);
104 }
Param5< string, float, float, float, float > PPETemplateDefColor
void PPEMatClassParameterColor(int mat_idx, int parameter_idx, PPEClassBase parent)

References GetPostProcessEffectID(), m_MaterialParamMapStructure, and PPEMatClassParameterColor().

Referenced by PPEColors::RegisterMaterialParameters(), and PPEGlow::RegisterMaterialParameters().

◆ RegisterParameterColorEx()

void PPEClassBase::RegisterParameterColorEx ( int idx,
string parameter_name,
float r,
float g,
float b,
float a,
typename type  )
inlineprotected

WARNING - min/max values are usually taken from Workbench defaults, may not be actual min/max values the renderer can handle! When in doubt, try some higher/lower values...

Definition at line 107 of file PPEMatClassesBase.c.

108 {
111 bool boo = Class.CastTo(parameter_data, type.Spawn());
112 //Print("RegisterParameterColorEx: " + boo );
113 parameter_data.RegisterDefaults(p);
114 parameter_data.SetMaterialIndex(GetPostProcessEffectID());
115 parameter_data.SetParameterIndex(idx);
116 parameter_data.SetParent(this);
118 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), GetPostProcessEffectID(), and m_MaterialParamMapStructure.

Referenced by PPEColors::RegisterMaterialParameters(), and PPEGlow::RegisterMaterialParameters().

◆ RegisterParameterResource()

void PPEClassBase::RegisterParameterResource ( int idx,
string parameter_name,
string default_path )
inlineprotected

◆ RegisterParameterScalarBool()

void PPEClassBase::RegisterParameterScalarBool ( int idx,
string parameter_name,
bool default_value )
inlineprotected

◆ RegisterParameterScalarFloat()

void PPEClassBase::RegisterParameterScalarFloat ( int idx,
string parameter_name,
float default_value,
float min,
float max )
inlineprotected

WARNING - min/max values are usually taken from Workbench defaults, may not be actual min/max values the renderer can handle! When in doubt, try some higher/lower values...

Definition at line 73 of file PPEMatClassesBase.c.

74 {
76
78 parameter_data.RegisterDefaults(p);
80 }
Param4< string, float, float, float > PPETemplateDefFloat
void PPEMatClassParameterFloat(int mat_idx, int parameter_idx, PPEClassBase parent)

References GetPostProcessEffectID(), m_MaterialParamMapStructure, and PPEMatClassParameterFloat().

Referenced by PPEDOF::RegisterMaterialParameters(), PPEExposureNative::RegisterMaterialParameters(), PPEEyeAccomodationNative::RegisterMaterialParameters(), PPELightIntensityParamsNative::RegisterMaterialParameters(), PPEChromAber::RegisterMaterialParameters(), PPEColors::RegisterMaterialParameters(), PPEDepthOfField::RegisterMaterialParameters(), PPEDynamicBlur::RegisterMaterialParameters(), PPEFilmGrain::RegisterMaterialParameters(), PPEGaussFilter::RegisterMaterialParameters(), PPEGlow::RegisterMaterialParameters(), PPEGodRays::RegisterMaterialParameters(), PPEHBAO::RegisterMaterialParameters(), PPERadialBlur::RegisterMaterialParameters(), PPERain::RegisterMaterialParameters(), PPERotBlur::RegisterMaterialParameters(), PPESSAO::RegisterMaterialParameters(), PPEUnderWater::RegisterMaterialParameters(), and PPEWetDistort::RegisterMaterialParameters().

◆ RegisterParameterScalarFloatEx()

void PPEClassBase::RegisterParameterScalarFloatEx ( int idx,
string parameter_name,
float default_value,
float min,
float max,
typename type  )
inlineprotected

WARNING - min/max values are usually taken from Workbench defaults, may not be actual min/max values the renderer can handle! When in doubt, try some higher/lower values...

Definition at line 83 of file PPEMatClassesBase.c.

84 {
86
88 bool boo = Class.CastTo(parameter_data, type.Spawn());
89 //Print("RegisterParameterColorEx: " + boo );
90 parameter_data.RegisterDefaults(p);
91 parameter_data.SetMaterialIndex(GetPostProcessEffectID());
92 parameter_data.SetParameterIndex(idx);
93 parameter_data.SetParent(this);
95 }

References Class::CastTo(), GetPostProcessEffectID(), m_MaterialParamMapStructure, and PPEMatClassParameterFloat().

Referenced by PPEColors::RegisterMaterialParameters(), and PPEGlow::RegisterMaterialParameters().

◆ RegisterParameterScalarInt()

◆ RegisterParameterTexture()

void PPEClassBase::RegisterParameterTexture ( int idx,
string parameter_name,
string default_path )
inlineprotected

◆ RegisterParameterVector()

void PPEClassBase::RegisterParameterVector ( int idx,
string parameter_name,
array< float > default_values )
inlineprotected

◆ RemoveRequest()

void PPEClassBase::RemoveRequest ( int req_idx)
inlineprotected

unused, see 'RemoveActiveRequestFromMaterials' for more info

Definition at line 166 of file PPEMatClassesBase.c.

167 {
168 /*for (int i = 0; i < m_ActiveMaterialRequestMap.Count(); i++)
169 {
170 ActiveParameterRequestsMap dbg = m_ActiveMaterialRequestMap.Get(i);
171 //DbgPrnt("PPEDebug | dbg size: " + dbg.Count());
172
173 if ( m_ActiveMaterialRequestMap.Get(i).Contains(req_idx) )
174 {
175 m_ActiveMaterialRequestMap.Get(i).Remove(req_idx);
176
177 dbg = m_ActiveMaterialRequestMap.Get(i);
178
179 if ( !m_ActiveMaterialRequestMap.Get(i) || m_ActiveMaterialRequestMap.Get(i).Count() < 1 )
180 {
181 if (m_ParameterUpdateQueue.IsValidIndex(i))
182 {
183 DbgPrnt("PPEDebug | PPEClassBase - RemoveRequest | Removing: " + i);
184 DbgPrnt("PPEDebug | PPEClassBase - RemoveRequest | exit 4 - last request removal");
185 m_ParameterRemovalQueue.Insert(m_ParameterUpdateQueue.Get(i));
186 }
187 else
188 DbgPrnt("PPEDebug | PPEClassBase - RemoveRequest | Update queue no. " + i + " already removed!");
189 }
190 }
191 //Adds to update one more time
192 m_Manager.SetMaterialParamUpdating(GetPostProcessEffectID(),i);
193 }*/
194 }

◆ SetFinalParameterValue()

void PPEClassBase::SetFinalParameterValue ( int parameter_idx)
inlineprotected

Clamps the values being set to defaults, if there is no request setting non-zero values on the parameter.

Definition at line 224 of file PPEMatClassesBase.c.

225 {
228
229 switch (var_type)
230 {
231 case PPEConstants.VAR_TYPE_BOOL:
232 bool value_var_bool = Param1<bool>.Cast(values).param1;
233
235 //Print("DebugValues | PPEConstants.VAR_TYPE_BOOL | bool val: " + value_var_bool);
236 break;
237
238 case PPEConstants.VAR_TYPE_INT:
239 int value_var_int = Param1<int>.Cast(values).param1;
240
242 //Print("DebugValues | PPEConstants.VAR_TYPE_BOOL | bool val: " + value_var_bool);
243 break;
244
245 case PPEConstants.VAR_TYPE_FLOAT:
246 float value_var_float = Param1<float>.Cast(values).param1;
247
249 //Print("DebugValues | PPEConstants.VAR_TYPE_FLOAT | float val: " + value_var_float);
250 break;
251
252 case PPEConstants.VAR_TYPE_COLOR:
253 float color[4] = {0, 0, 0, 0};
258
260 //Print("DebugValues | PPEConstants.VAR_TYPE_COLOR | color val:: " + color[0] + " " + color[1] + " " + color[2] + " " + color[3]);
261 break;
262 }
263 }
proto void SetParamByIndex(int paramIndex, void value)
PPEMatClassParameterCommandData GetParameterCommandData(int parameter_idx)
Some PP effects are handled as hard-coded exceptions, outside of material system. Default == PPEExcep...
Param GetCurrentValues()
Careful, only actual values, WITHOUT string.

References PPEMatClassParameterCommandData::GetCurrentValues(), GetParameterCommandData(), PPEMatClassParameterCommandData::GetParameterVarType(), m_Material, and Material::SetParamByIndex().

Referenced by ApplyValueChanges().

◆ SetParameterUpdating()

void PPEClassBase::SetParameterUpdating ( int order,
int parameter_id )
inlineprotected

Queue specific parameter of this material to update.

Definition at line 291 of file PPEMatClassesBase.c.

292 {
293 if (!m_ParameterUpdateQueueMap.Contains(order))
295
296 if (m_ParameterUpdateQueueMap.Get(order).Find(parameter_id) == -1)
298 }

References m_ParameterUpdateQueueMap.

Member Data Documentation

◆ m_Manager

PPEManager PPEClassBase::m_Manager
protected

Definition at line 4 of file PPEMatClassesBase.c.

Referenced by Init(), and OnUpdate().

◆ m_Material

Material PPEClassBase::m_Material
protected

◆ m_MaterialParamMapStructure

◆ m_MaterialPath

string PPEClassBase::m_MaterialPath = ""
protected

◆ m_ParameterRemovalQueue

ref array<int> PPEClassBase::m_ParameterRemovalQueue
protected

◆ m_ParameterUpdateQueueMap

ref map<int, ref array<int> > PPEClassBase::m_ParameterUpdateQueueMap
protected

◆ m_UpdatedParameters


The documentation for this class was generated from the following file: