253{
255
260
262 {
264 }
265
267 {
269
273 }
274
276 {
278 }
279
281 {
282 return PPEConstants.VAR_TYPE_FLOAT;
283 }
284
285 override void Update(
float timeslice, out
Param p_total, out
bool setting_defaults,
int order)
286 {
287 super.Update(timeslice,p_total,setting_defaults,order);
288
289 int active_request_count = 0;
290
292
293 bool setting_value_zero = false;
294
295 float float_value_temp = 0.0;
296 float float_value_default = 0.0;
297 float float_value_total = 0.0;
298
299 if (p_total == null)
300 {
301 p_total = new Param1<float>(0.0);
302 }
303
304 if (m_RequestMap.Count() > 0)
305 {
307 }
308 else
309 {
310
312 m_Parent.ParamUpdateRemove(m_ParameterIndex);
313 return;
314 }
315
316 for ( int i = 0; i < m_RequestMap.Count(); i++ )
317 {
319
320 if (req_data == null)
321 {
322 Error(
"Debug | PPEMatClassParameterFloat | req_data not found! | " +
this +
" | mat/par: " + m_MaterialIndex +
"/" + m_ParameterIndex);
323 continue;
324 }
325
326 setting_value_zero = req_data.IsSettingDefaultValues();
327
328 if (setting_value_zero && !req_data.GetUpdatingDataValues() && !req_data.IsDataActive())
329 {
330
331 continue;
332 }
333
334 if (setting_value_zero)
335 {
336 req_data.m_FloatTarget = 0;
337
338 }
339 else
340 {
341 active_request_count++;
342 }
343
344
345
346 req_data.m_FloatLast = req_data.m_FloatCurrent;
347
348 if (!req_data.GetUpdatingDataValues() && req_data.IsDataActive())
349 {
350 float_value_temp = req_data.m_FloatCurrent;
351 PrepareLayerInfo(req_data.GetPriorityLayer(),float_value_temp,req_data.GetInteractionMask());
352
353 continue;
354 }
355
356 float_value_temp = req_data.m_FloatTarget;
357
358
359 req_data.SetUpdatingDataValues(false);
360 if (setting_value_zero)
361 {
362 req_data.SetDataActive(false);
363
364 }
365 else
366 {
367 float_value_temp = req_data.m_FloatTarget;
368 PrepareLayerInfo(req_data.GetPriorityLayer(),float_value_temp,req_data.GetInteractionMask());
369 }
370
371 req_data.m_FloatCurrent = float_value_temp;
372 }
373
374
375
376 float value;
377 int operator;
378 bool override_active = false;
379
382 else
384
385
386 float_value_default = float_value_total;
387
389 {
390 if ( override_active )
391 break;
392
393 value =
m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_VALUE);
394 operator =
m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_OPERATOR);
395
396 switch (operator)
397 {
399 float_value_total =
Math.
Min(float_value_total,value);
400 break;
401
403 float_value_total =
Math.
Max(float_value_total,value);
404 break;
405
407
408 float_value_total = float_value_total + value;
409 break;
410
412 float_value_total = (1 - float_value_total) * value + float_value_total;
413 break;
414
416
417 float_value_total = float_value_total - value;
418 break;
419
421 float_value_total = float_value_total - value * float_value_total;
422 break;
423
425
426 float_value_total = value - float_value_total;
427 break;
428
430 float_value_total = value * float_value_total - float_value_total;
431 break;
432
434
435 float_value_total = float_value_total * value;
436 break;
437
439 float_value_total = value;
440 break;
441
443 float_value_total = value;
444 break;
445 }
446
447
448 float_value_total =
Math.
Clamp(float_value_total,0,1);
449
451 {
452
453 override_active = true;
454 }
455
456
457 }
458
459 m_CommandLayersArray.Clear();
460
461
462 if (active_request_count == 0)
463 {
465 }
466 else
467 {
469 Param1<float>.Cast(p_total).param1 = res;
470 }
471
472
473 m_Parent.ParamUpdateRemove(m_ParameterIndex);
474
475 m_CurrentValues = p_total;
476 }
477
479 {
481 AddPriorityInfo(layer);
482 }
483
486 {
488 m_CurrentValues = p_total;
489
490 }
491}
492
494{
496 {
498 m_Dependencies.Set(
PostProcessEffectType.Glow,{PPEGlow.PARAM_COLORIZATIONCOLOR, PPEGlow.PARAM_OVERLAYCOLOR});
499 }
500}
PPOperators
PP operators, specify operation between subsequent layers.
Param4< string, float, float, float > PPETemplateDefFloat
ref map< int, ref ColorValuesData > m_LayerInfo
override void SetParameterValueDefault(inout Param p_total)
No active requests for the mat. parameter value change, sets the value to DEFAULT (zero?...
class PPEMatClassParameterFloat extends PPEMatClassParameterCommandData PPEMatClassParameterFloatSaturation(int mat_idx, int parameter_idx, PPEClassBase parent)
override void InitCuttent()
override int GetParameterVarType()
void PPEMatClassParameterFloat(int mat_idx, int parameter_idx, PPEClassBase parent)
void PrepareLayerInfo(int layer, float value, int operator)
PPETemplateDefFloat m_Float
override void InitDefaults()
void PPERequestParamDataFloat(int requester_idx, int mat_id, int param_id, int data_type=0, int priority=0, int mask=PPOperators.SET, bool relative=false)
Super root of all classes in Enforce script.
Created once, on manager init. Script-side representation of C++ material class, separate handling.
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
PostProcessEffectType
Post-process effect type.
void Error(string err)
Messagebox with error message.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.