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