470{
472
477
479 {
481 }
482
484 {
486
490 }
491
493 {
495 }
496
498 {
499 return PPEConstants.VAR_TYPE_FLOAT;
500 }
501
502 override void Update(
float timeslice, out
Param p_total, out
bool setting_defaults,
int order)
503 {
504 super.Update(timeslice,p_total,setting_defaults,order);
505
506 int active_request_count = 0;
507
509
510 bool setting_value_zero = false;
511
512 float float_value_temp = 0.0;
513 float float_value_default = 0.0;
514 float float_value_total = 0.0;
515
516 if (p_total == null)
517 {
518 p_total = new Param1<float>(0.0);
519 }
520
521 if (m_RequestMap.Count() > 0)
522 {
524 }
525 else
526 {
527
529 m_Parent.ParamUpdateRemove(m_ParameterIndex);
530 return;
531 }
532
533 for ( int i = 0; i < m_RequestMap.Count(); i++ )
534 {
536
537 if (req_data == null)
538 {
539 Error(
"Debug | PPEMatClassParameterFloat | req_data not found! | " +
this +
" | mat/par: " + m_MaterialIndex +
"/" + m_ParameterIndex);
540 continue;
541 }
542
543 setting_value_zero = req_data.IsSettingDefaultValues();
544
545 if (setting_value_zero && !req_data.GetUpdatingDataValues() && !req_data.IsDataActive())
546 {
547
548 continue;
549 }
550
551 if (setting_value_zero)
552 {
553 req_data.m_FloatTarget = 0;
554
555 }
556 else
557 {
558 active_request_count++;
559 }
560
561
562
563 req_data.m_FloatLast = req_data.m_FloatCurrent;
564
565 if (!req_data.GetUpdatingDataValues() && req_data.IsDataActive())
566 {
567 float_value_temp = req_data.m_FloatCurrent;
568 PrepareLayerInfo(req_data.GetPriorityLayer(),float_value_temp,req_data.GetInteractionMask());
569
570 continue;
571 }
572
573 float_value_temp = req_data.m_FloatTarget;
574
575
576 req_data.SetUpdatingDataValues(false);
577 if (setting_value_zero)
578 {
579 req_data.SetDataActive(false);
580
581 }
582 else
583 {
584 float_value_temp = req_data.m_FloatTarget;
585 PrepareLayerInfo(req_data.GetPriorityLayer(),float_value_temp,req_data.GetInteractionMask());
586 }
587
588 req_data.m_FloatCurrent = float_value_temp;
589 }
590
591
592
593 float value;
594 int operator;
595 bool override_active = false;
596
599 else
601
602
603 float_value_default = float_value_total;
604
606 {
607 if ( override_active )
608 break;
609
610 value =
m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_VALUE);
611 operator =
m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_OPERATOR);
612
613 switch (operator)
614 {
616 float_value_total =
Math.
Min(float_value_total,value);
617 break;
618
620 float_value_total =
Math.
Max(float_value_total,value);
621 break;
622
624
625 float_value_total = float_value_total + value;
626 break;
627
629 float_value_total = (1 - float_value_total) * value + float_value_total;
630 break;
631
633
634 float_value_total = float_value_total - value;
635 break;
636
638 float_value_total = float_value_total - value * float_value_total;
639 break;
640
642
643 float_value_total = value - float_value_total;
644 break;
645
647 float_value_total = value * float_value_total - float_value_total;
648 break;
649
651
652 float_value_total = float_value_total * value;
653 break;
654
656 float_value_total = value;
657 break;
658
660 float_value_total = value;
661 break;
662 }
663
664
665 float_value_total =
Math.
Clamp(float_value_total,0,1);
666
668 {
669
670 override_active = true;
671 }
672
673
674 }
675
676 m_CommandLayersArray.Clear();
677
678
679 if (active_request_count == 0)
680 {
682 }
683 else
684 {
686 Param1<float>.Cast(p_total).param1 = res;
687 }
688
689
690 m_Parent.ParamUpdateRemove(m_ParameterIndex);
691
692 m_CurrentValues = p_total;
693 }
694
696 {
698 AddPriorityInfo(layer);
699 }
700
703 {
705 m_CurrentValues = p_total;
706
707 }
708}
709
711{
713 {
715 m_Dependencies.Set(
PostProcessEffectType.Glow,{PPEGlow.PARAM_COLORIZATIONCOLOR, PPEGlow.PARAM_OVERLAYCOLOR});
716 }
717}
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'.