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