5 protected int m_Operator;
11 m_Operator =
operator;
24 void SetOperator(
int operator)
26 m_Operator =
operator;
66 return PPEConstants.VAR_TYPE_COLOR;
69 override void Update(
float timeslice, out
Param p_total, out
bool setting_defaults,
int order)
71 super.Update(timeslice,p_total,setting_defaults,order);
73 int active_request_count = 0;
75 PPERequestParamDataColor req_data;
77 bool setting_value_zero =
false;
81 bool color_total_override_set =
false;
86 p_total =
new Param4<float,float,float,float>(0.0,0.0,0.0,0.0);
89 if (m_RequestMap.Count() > 0)
97 m_Parent.ParamUpdateRemove(m_ParameterIndex);
102 for (
int i = 0; i < m_RequestMap.Count(); i++ )
104 req_data = PPERequestParamDataColor.Cast(m_RequestMap.GetElement(i));
106 if (req_data ==
null)
108 Error(
"PPEMatClassParameterColor | req_data not found! | " +
this +
" | mat/par: " + m_MaterialIndex +
"/" + m_ParameterIndex);
112 setting_value_zero = req_data.IsSettingDefaultValues();
115 if (setting_value_zero && !req_data.GetUpdatingDataValues() && !req_data.IsDataActive())
121 active_request_count++;
125 req_data.m_ColorLast = req_data.m_ColorCurrent;
127 if (!req_data.GetUpdatingDataValues() && req_data.IsDataActive())
129 color_values_temp.Copy(req_data.m_ColorCurrent);
130 PrepareLayerInfo(req_data.GetPriorityLayer(),{color_values_temp[0],color_values_temp[1],color_values_temp[2],color_values_temp[3]},req_data.GetInteractionMask());
135 if (setting_value_zero)
137 req_data.m_ColorTarget = {0.0,0.0,0.0,0.0};
142 req_data.SetUpdatingDataValues(
false);
143 if (setting_value_zero)
145 req_data.SetDataActive(
false);
150 color_values_temp.Copy(req_data.m_ColorTarget);
151 PrepareLayerInfo(req_data.GetPriorityLayer(),{color_values_temp[0],color_values_temp[1],color_values_temp[2],color_values_temp[3]},req_data.GetInteractionMask());
154 req_data.m_ColorCurrent.Copy(color_values_temp);
162 bool override_active =
false;
168 if ( override_active )
171 values =
m_LayerInfo.Get(m_CommandLayersArray.Get(i)).GetValues();
172 operator =
m_LayerInfo.Get(m_CommandLayersArray.Get(i)).GetOperator();
234 color_values_total.Copy(values);
238 color_values_total.Copy(values);
246 override_active =
true;
252 m_CommandLayersArray.Clear();
254 if ( m_MaterialIndex == 15 && m_ParameterIndex == 21 )
261 if ( active_request_count <= 0 )
267 Param4<float,float,float,float>.Cast(p_total).param1 = color_values_total[0];
268 Param4<float,float,float,float>.Cast(p_total).param2 = color_values_total[1];
269 Param4<float,float,float,float>.Cast(p_total).param3 = color_values_total[2];
270 Param4<float,float,float,float>.Cast(p_total).param4 = color_values_total[3];
274 m_Parent.ParamUpdateRemove(m_ParameterIndex);
276 ModifyResultValues(p_total);
278 m_CurrentValues = p_total;
288 tmp.SetValues(values);
289 tmp.SetOperator(
operator);
297 AddPriorityInfo(layer);
308 Param4<float,float,float,float>.Cast(p_total).param1 =
m_ColorDefaults[0];
309 Param4<float,float,float,float>.Cast(p_total).param2 =
m_ColorDefaults[1];
310 Param4<float,float,float,float>.Cast(p_total).param3 =
m_ColorDefaults[2];
311 Param4<float,float,float,float>.Cast(p_total).param4 =
m_ColorDefaults[3];
313 m_CurrentValues = p_total;
319 override void ModifyResultValues(inout
Param result_values)
321 super.ModifyResultValues(result_values);
325 float saturation_coef = Param1<float>.Cast(par).param1;
327 float r = Param4<float,float,float,float>.Cast(result_values).param1;
328 float g = Param4<float,float,float,float>.Cast(result_values).param2;
329 float b = Param4<float,float,float,float>.Cast(result_values).param3;
330 float a = Param4<float,float,float,float>.Cast(result_values).param4;
332 float highest_channel =
Math.Max(
Math.Max(r,g),b);
333 saturation_coef =
Easing.EaseOutSine(saturation_coef);
335 r =
Math.Lerp(highest_channel,r,saturation_coef);
336 g =
Math.Lerp(highest_channel,g,saturation_coef);
337 b =
Math.Lerp(highest_channel,b,saturation_coef);
341 Param4<float,float,float,float>.Cast(result_values).param1 = r;
342 Param4<float,float,float,float>.Cast(result_values).param2 = g;
343 Param4<float,float,float,float>.Cast(result_values).param3 = b;
344 Param4<float,float,float,float>.Cast(result_values).param4 = a;