ppelightintensityparamsnative.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //---------------------------------------------------------
  2. //Native exceptions - legacy methods for direct access to specific postprocesses. Each one is evaluated and handled separately, this just connects them to the system.
  3. //!g_Game.NightVissionLightParams, does not directly use materials. Controls light multiplication and filmgrain noise intensity (multiplier)
  4. class PPELightIntensityParamsNative: PPEClassBase
  5. {
  6. //g_Game.SetEVValue
  7. static const int PARAM_LIGHT_MULT = 0;
  8. static const int PARAM_NOISE_MULT = 1;
  9. static const int L_0_NVG = 100;
  10. static const int L_0_TOXIC_TINT = 200;
  11. static const int L_1_NVG = 100;
  12. static const int L_1_TOXIC_TINT = 200;
  13. override int GetPostProcessEffectID()
  14. {
  15. return PPEExceptions.NVLIGHTPARAMS;
  16. }
  17. override void RegisterMaterialParameters()
  18. {
  19. RegisterParameterScalarFloat(PARAM_LIGHT_MULT,"lightIntensityMul",1.0,0.0,50.0); //some reasonable values
  20. RegisterParameterScalarFloat(PARAM_NOISE_MULT,"noiseIntensity",0.0,0.0,50.0); //some reasonable values
  21. }
  22. override void ApplyValueChanges()
  23. {
  24. if (m_UpdatedParameters.Count() > 0)
  25. {
  26. SetFinalParameterValue(-1); //unique handling
  27. }
  28. m_UpdatedParameters.Clear();
  29. }
  30. //! Overriden to handle the specific exception
  31. override void SetFinalParameterValue(int parameter_idx)
  32. {
  33. array<float> array_values = new array<float>;
  34. for (int i = 0; i < PARAM_NOISE_MULT + 1; i++)
  35. {
  36. Param values = GetParameterCommandData(i).GetCurrentValues();
  37. float value_var_float = Param1<float>.Cast(values).param1;
  38. array_values.Insert(value_var_float);
  39. }
  40. g_Game.NightVissionLightParams(array_values.Get(PARAM_LIGHT_MULT),array_values.Get(PARAM_NOISE_MULT));
  41. //DbgPrnt("PPEDebug | SetFinalParameterValue | PPELightIntensityParamsNative | float val: " + value_var_float);
  42. }
  43. }