277{
279
284
286 {
288 }
289
291 {
293
297 }
298
300 {
302 }
303
305 {
306 return PPEConstants.VAR_TYPE_FLOAT;
307 }
308
309 override void Update(
float timeslice, out
Param p_total, out
bool setting_defaults,
int order)
310 {
311 super.Update(timeslice,p_total,setting_defaults,order);
312
313 int active_request_count = 0;
314
316
317 bool setting_value_zero = false;
318
319 float float_value_temp = 0.0;
320 float float_value_default = 0.0;
321 float float_value_total = 0.0;
322
323 if (p_total == null)
324 {
325 p_total = new Param1<float>(0.0);
326 }
327
328 if (m_RequestMap.Count() > 0)
329 {
331 }
332 else
333 {
334
336 m_Parent.ParamUpdateRemove(m_ParameterIndex);
337 return;
338 }
339
340 for ( int i = 0; i < m_RequestMap.Count(); i++ )
341 {
343
344 if (req_data == null)
345 {
346 Error(
"Debug | PPEMatClassParameterFloat | req_data not found! | " +
this +
" | mat/par: " + m_MaterialIndex +
"/" + m_ParameterIndex);
347 continue;
348 }
349
350 setting_value_zero = req_data.IsSettingDefaultValues();
351
352 if (setting_value_zero && !req_data.GetUpdatingDataValues() && !req_data.IsDataActive())
353 {
354
355 continue;
356 }
357
358 if (setting_value_zero)
359 {
360 req_data.m_FloatTarget = 0;
361
362 }
363 else
364 {
365 active_request_count++;
366 }
367
368
369
370 req_data.m_FloatLast = req_data.m_FloatCurrent;
371
372 if (!req_data.GetUpdatingDataValues() && req_data.IsDataActive())
373 {
374 float_value_temp = req_data.m_FloatCurrent;
375 PrepareLayerInfo(req_data.GetPriorityLayer(),float_value_temp,req_data.GetInteractionMask());
376
377 continue;
378 }
379
380 float_value_temp = req_data.m_FloatTarget;
381
382
383 req_data.SetUpdatingDataValues(false);
384 if (setting_value_zero)
385 {
386 req_data.SetDataActive(false);
387
388 }
389 else
390 {
391 float_value_temp = req_data.m_FloatTarget;
392 PrepareLayerInfo(req_data.GetPriorityLayer(),float_value_temp,req_data.GetInteractionMask());
393 }
394
395 req_data.m_FloatCurrent = float_value_temp;
396 }
397
398
399
400 float value;
401 int operator;
402 bool override_active = false;
403
406 else
408
409
410 float_value_default = float_value_total;
411
413 {
414 if ( override_active )
415 break;
416
417 value =
m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_VALUE);
418 operator =
m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_OPERATOR);
419
420 switch (operator)
421 {
423 float_value_total =
Math.
Min(float_value_total,value);
424 break;
425
427 float_value_total =
Math.
Max(float_value_total,value);
428 break;
429
431
432 float_value_total = float_value_total + value;
433 break;
434
436 float_value_total = (1 - float_value_total) * value + float_value_total;
437 break;
438
440
441 float_value_total = float_value_total - value;
442 break;
443
445 float_value_total = float_value_total - value * float_value_total;
446 break;
447
449
450 float_value_total = value - float_value_total;
451 break;
452
454 float_value_total = value * float_value_total - float_value_total;
455 break;
456
458
459 float_value_total = float_value_total * value;
460 break;
461
463 float_value_total = value;
464 break;
465
467 float_value_total = value;
468 break;
469 }
470
471
472 float_value_total =
Math.
Clamp(float_value_total,0,1);
473
475 {
476
477 override_active = true;
478 }
479
480
481 }
482
483 m_CommandLayersArray.Clear();
484
485
486 if (active_request_count == 0)
487 {
489 }
490 else
491 {
493 Param1<float>.Cast(p_total).param1 = res;
494 }
495
496
497 m_Parent.ParamUpdateRemove(m_ParameterIndex);
498
499 m_CurrentValues = p_total;
500 }
501
503 {
505 AddPriorityInfo(layer);
506 }
507
510 {
512 m_CurrentValues = p_total;
513
514 }
515}
516
518{
520 {
522 m_Dependencies.Set(
PostProcessEffectType.Glow,{PPEGlow.PARAM_COLORIZATIONCOLOR, PPEGlow.PARAM_OVERLAYCOLOR});
523 }
524}
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'.