DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ PrepareLayerInfo()

void PPEMatClassParameterFloatSaturation::PrepareLayerInfo ( int layer,
float value,
int operator )
protected

См. определение в файле PPEMatClassParameterFloat.c строка 469

470{
471 protected ref map<int,ref array<float,int>> m_LayerInfo; //<priority,<value,operator>>
472
474 protected float m_ValueDefault;
475 protected float m_ValueMin;
476 protected float m_ValueMax;
477
478 void PPEMatClassParameterFloat(int mat_idx, int parameter_idx, PPEClassBase parent)
479 {
481 }
482
483 override void InitDefaults()
484 {
485 Class.CastTo(m_Float,m_Defaults);
486 //m_Float = PPETemplateDefFloat.Cast(m_Defaults);
487 m_ValueDefault = m_Float.param2;
488 m_ValueMin = m_Float.param3;
489 m_ValueMax = m_Float.param4;
490 }
491
492 override void InitCuttent()
493 {
494 m_CurrentValues = new Param1<float>(m_ValueDefault);
495 }
496
497 override int GetParameterVarType()
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 {
523 m_LayerInfo.Clear();
524 }
525 else
526 {
527 //DbgPrnt("m_RequestMap.Count() is zero! Using default values. | mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
529 m_Parent.ParamUpdateRemove(m_ParameterIndex);
530 return;
531 }
532
533 for ( int i = 0; i < m_RequestMap.Count(); i++ )
534 {
535 req_data = PPERequestParamDataFloat.Cast(m_RequestMap.GetElement(i));
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 //DbgPrnt("Is Default, not updating | idx: " + i + " | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
548 continue;
549 }
550
551 if (setting_value_zero)
552 {
553 req_data.m_FloatTarget = 0;//min;
554 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | !data.m_DefaultTargetSet | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | req_data.m_FloatTarget: " + req_data.m_FloatTarget);
555 }
556 else
557 {
558 active_request_count++;
559 }
560
561 //evaluation
562 //--------------------------------
563 req_data.m_FloatLast = req_data.m_FloatCurrent;
564
565 if (!req_data.GetUpdatingDataValues() && req_data.IsDataActive()) //set to exact value, not updating anymore
566 {
567 float_value_temp = req_data.m_FloatCurrent;
568 PrepareLayerInfo(req_data.GetPriorityLayer(),float_value_temp,req_data.GetInteractionMask());
569 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | !req_data.m_UpdatingData | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | not updating, addaing current value into mix: " + float_value_temp);
570 continue;
571 }
572
573 float_value_temp = req_data.m_FloatTarget;
574
575 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
576 req_data.SetUpdatingDataValues(false);
577 if (setting_value_zero)
578 {
579 req_data.SetDataActive(false);
580 //RemovePriorityInfo(req_data.GetPriorityLayer()); //redundant?
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 //MASK handling and calculation
593 float value;
594 int operator;
595 bool override_active = false;
596
597 if ( m_ValueMax == 0.0 )
598 float_value_total = m_ValueDefault; //?
599 else
600 float_value_total = m_ValueDefault / m_ValueMax;
601
602 //float_value_total = Math.InverseLerp(m_ValueMin,m_ValueMax,m_ValueDefault);
603 float_value_default = float_value_total;
604
605 for ( i = 0; i < m_LayerInfo.Count(); i++ )
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 {
615 case PPOperators.LOWEST:
616 float_value_total = Math.Min(float_value_total,value);
617 break;
618
619 case PPOperators.HIGHEST:
620 float_value_total = Math.Max(float_value_total,value);
621 break;
622
623 case PPOperators.ADD:
624 //float_value_total = float_value_total + value - float_value_default;
625 float_value_total = float_value_total + value;
626 break;
627
628 case PPOperators.ADD_RELATIVE:
629 float_value_total = (1 - float_value_total) * value + float_value_total;
630 break;
631
632 case PPOperators.SUBSTRACT:
633 //float_value_total = float_value_total - value + float_value_default;
634 float_value_total = float_value_total - value;
635 break;
636
637 case PPOperators.SUBSTRACT_RELATIVE:
638 float_value_total = float_value_total - value * float_value_total;
639 break;
640
641 case PPOperators.SUBSTRACT_REVERSE:
642 //float_value_total = value - float_value_default - float_value_total;
643 float_value_total = value - float_value_total;
644 break;
645
646 case PPOperators.SUBSTRACT_REVERSE_RELATIVE:
647 float_value_total = value * float_value_total - float_value_total;
648 break;
649
650 case PPOperators.MULTIPLICATIVE:
651 //float_value_total = Math.Lerp(float_value_default, float_value_total, value);
652 float_value_total = float_value_total * value;
653 break;
654
655 case PPOperators.OVERRIDE:
656 float_value_total = value;
657 break;
658
659 case PPOperators.SET:
660 float_value_total = value;
661 break;
662 }
663
664 //DbgPrnt("m_LayerInfo | float_value_total pre-clamp: " + float_value_total + " | i: " + i);
665 float_value_total = Math.Clamp(float_value_total,0,1);
666
667 if ( operator == PPOperators.OVERRIDE )
668 {
669 //DbgPrnt("m_LayerInfo | PPOperators.OVERRIDE at: " + i);
670 override_active = true;
671 }
672
673 //RemovePriorityInfo(m_CommandLayersArray.Get(i));
674 }
675
676 m_CommandLayersArray.Clear();
677
678 //TODO - consider moving this up, if possible
679 if (active_request_count == 0)
680 {
682 }
683 else
684 {
685 float res = Math.Lerp(m_ValueMin,m_ValueMax,float_value_total);
686 Param1<float>.Cast(p_total).param1 = res; //converts back to absolute values
687 }
688
689 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | parameter update end, removing from queue");
690 m_Parent.ParamUpdateRemove(m_ParameterIndex);
691
692 m_CurrentValues = p_total;
693 }
694
695 void PrepareLayerInfo(int layer, float value, int operator)
696 {
697 m_LayerInfo.Set(layer,{value,operator});
698 AddPriorityInfo(layer);
699 }
700
702 override void SetParameterValueDefault(inout Param p_total)
703 {
704 p_total = new Param1<float>(PPETemplateDefFloat.Cast(m_Defaults).param2);
705 m_CurrentValues = p_total;
706 //DbgPrnt("PPEDebug | PPEMatClassParameterFloat - UpdateParameterValues | exit 3 - zero value");
707 }
708}
709
711{
712 void PPEMatClassParameterFloatSaturation(int mat_idx, int parameter_idx, PPEClassBase parent)
713 {
714 m_Dependencies = new map<int,ref array<int>>;
715 m_Dependencies.Set(PostProcessEffectType.Glow,{PPEGlow.PARAM_COLORIZATIONCOLOR, PPEGlow.PARAM_OVERLAYCOLOR});
716 }
717}
map
Определения ControlsXboxNew.c:4
PPOperators
PP operators, specify operation between subsequent layers.
Определения PPEConstants.c:53
Param4< string, float, float, float > PPETemplateDefFloat
Определения PPEConstants.c:87
ref map< int, ref ColorValuesData > m_LayerInfo
Определения PPEMatClassParameterColor.c:44
override void SetParameterValueDefault(inout Param p_total)
No active requests for the mat. parameter value change, sets the value to DEFAULT (zero?...
Определения PPEMatClassParameterFloat.c:476
class PPEMatClassParameterFloat extends PPEMatClassParameterCommandData PPEMatClassParameterFloatSaturation(int mat_idx, int parameter_idx, PPEClassBase parent)
Определения PPEMatClassParameterFloat.c:244
override void InitCuttent()
Определения PPEMatClassParameterFloat.c:266
override int GetParameterVarType()
Определения PPEMatClassParameterFloat.c:271
void PPEMatClassParameterFloat(int mat_idx, int parameter_idx, PPEClassBase parent)
Определения PPEMatClassParameterFloat.c:252
float m_ValueMax
Определения PPEMatClassParameterFloat.c:250
float m_ValueMin
Определения PPEMatClassParameterFloat.c:249
void PrepareLayerInfo(int layer, float value, int operator)
Определения PPEMatClassParameterFloat.c:469
float m_ValueDefault
Определения PPEMatClassParameterFloat.c:248
PPETemplateDefFloat m_Float
Определения PPEMatClassParameterFloat.c:247
override void InitDefaults()
Определения PPEMatClassParameterFloat.c:257
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)
Определения PPERequestData.c:142
Widget m_Parent
Определения SizeToChild.c:92
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения EnMath.c:7
Created once, on manager init. Script-side representation of C++ material class, separate handling.
Определения PPEMatClassesBase.c:3
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
PostProcessEffectType
Post-process effect type.
Определения EnWorld.c:72
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
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'.
proto native volatile void Update()
Определения PlayerSoundManager.c:125