267{
269
274
276 {
278 }
279
281 {
283
287 }
288
290 {
292 }
293
295 {
296 return PPEConstants.VAR_TYPE_FLOAT;
297 }
298
299 override void Update(
float timeslice, out
Param p_total, out
bool setting_defaults,
int order)
300 {
301 super.Update(timeslice,p_total,setting_defaults,order);
302
303 int active_request_count = 0;
304
306
307 bool setting_value_zero = false;
308
309 float float_value_temp = 0.0;
310 float float_value_default = 0.0;
311 float float_value_total = 0.0;
312
313 if (p_total == null)
314 {
315 p_total = new Param1<float>(0.0);
316 }
317
318 if (m_RequestMap.Count() > 0)
319 {
321 }
322 else
323 {
324
326 m_Parent.ParamUpdateRemove(m_ParameterIndex);
327 return;
328 }
329
330 for ( int i = 0; i < m_RequestMap.Count(); i++ )
331 {
333
334 if (req_data == null)
335 {
336 Error(
"Debug | PPEMatClassParameterFloat | req_data not found! | " +
this +
" | mat/par: " + m_MaterialIndex +
"/" + m_ParameterIndex);
337 continue;
338 }
339
340 setting_value_zero = req_data.IsSettingDefaultValues();
341
342 if (setting_value_zero && !req_data.GetUpdatingDataValues() && !req_data.IsDataActive())
343 {
344
345 continue;
346 }
347
348 if (setting_value_zero)
349 {
350 req_data.m_FloatTarget = 0;
351
352 }
353 else
354 {
355 active_request_count++;
356 }
357
358
359
360 req_data.m_FloatLast = req_data.m_FloatCurrent;
361
362 if (!req_data.GetUpdatingDataValues() && req_data.IsDataActive())
363 {
364 float_value_temp = req_data.m_FloatCurrent;
365 PrepareLayerInfo(req_data.GetPriorityLayer(),float_value_temp,req_data.GetInteractionMask());
366
367 continue;
368 }
369
370 float_value_temp = req_data.m_FloatTarget;
371
372
373 req_data.SetUpdatingDataValues(false);
374 if (setting_value_zero)
375 {
376 req_data.SetDataActive(false);
377
378 }
379 else
380 {
381 float_value_temp = req_data.m_FloatTarget;
382 PrepareLayerInfo(req_data.GetPriorityLayer(),float_value_temp,req_data.GetInteractionMask());
383 }
384
385 req_data.m_FloatCurrent = float_value_temp;
386 }
387
388
389
390 float value;
391 int operator;
392 bool override_active = false;
393
396 else
398
399
400 float_value_default = float_value_total;
401
403 {
404 if ( override_active )
405 break;
406
407 value =
m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_VALUE);
408 operator =
m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_OPERATOR);
409
410 switch (operator)
411 {
413 float_value_total =
Math.
Min(float_value_total,value);
414 break;
415
417 float_value_total =
Math.
Max(float_value_total,value);
418 break;
419
421
422 float_value_total = float_value_total + value;
423 break;
424
426 float_value_total = (1 - float_value_total) * value + float_value_total;
427 break;
428
430
431 float_value_total = float_value_total - value;
432 break;
433
435 float_value_total = float_value_total - value * float_value_total;
436 break;
437
439
440 float_value_total = value - float_value_total;
441 break;
442
444 float_value_total = value * float_value_total - float_value_total;
445 break;
446
448
449 float_value_total = float_value_total * value;
450 break;
451
453 float_value_total = value;
454 break;
455
457 float_value_total = value;
458 break;
459 }
460
461
462 float_value_total =
Math.
Clamp(float_value_total,0,1);
463
465 {
466
467 override_active = true;
468 }
469
470
471 }
472
473 m_CommandLayersArray.Clear();
474
475
476 if (active_request_count == 0)
477 {
479 }
480 else
481 {
483 Param1<float>.Cast(p_total).param1 = res;
484 }
485
486
487 m_Parent.ParamUpdateRemove(m_ParameterIndex);
488
489 m_CurrentValues = p_total;
490 }
491
493 {
495 AddPriorityInfo(layer);
496 }
497
500 {
502 m_CurrentValues = p_total;
503
504 }
505}
506
508{
510 {
512 m_Dependencies.Set(
PostProcessEffectType.Glow,{PPEGlow.PARAM_COLORIZATIONCOLOR, PPEGlow.PARAM_OVERLAYCOLOR});
513 }
514}
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'.