ppedistort.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //!Distort - PostProcessEffectType.Distort
  2. class PPEDistort: PPEClassBase
  3. {
  4. static const int PARAM_DISTORT = 0; //! Lens distortion magnitude, x > 0 = barrel distortion, x < 0 = pincushion distortion
  5. static const int PARAM_CENTERX = 1; //! Lens center X direction (-1 = left, 0 = center, 1 = right)
  6. static const int PARAM_CENTERY = 2; //! Lens center Y direction (-1 = top, 0 = center, 1 = bottom)
  7. static const int PARAM_CHROM_ABB = 3; //! Maximum value of chromatic abberation, 0 = disable - note that chrom. aberr depends on amount of distortion
  8. static const int PARAM_CHROM_ABB_SHIFTR = 4; //! Chromatic abberation red channel shift magnitude. 0 = none
  9. static const int PARAM_CHROM_ABB_SHIFTG = 5; //! Chromatic abberation green channel shift magnitude. 0 = none, 1 = default
  10. static const int PARAM_CHROM_ABB_SHIFTB = 6; //! Chromatic abberation blue channel shift magnitude. 0 = none, 2 = default
  11. static const int PARAM_CHROM_COLOR_MOD = 7; //! Color modulation effect. (red, green, blue, scale) (0,0,0,0) = default
  12. static const int PARAM_DISTORT_WEIGHT = 8; //! Distortion applied to imagine. 1 = all, 0 = none, applied only to ChromAbber
  13. //layering info
  14. static const int L_0_HMP = 100;
  15. static const int L_1_HMP = 100;
  16. static const int L_2_HMP = 100;
  17. static const int L_3_HMP = 100;
  18. static const int L_4_HMP = 100;
  19. static const int L_5_HMP = 100;
  20. static const int L_6_HMP = 100;
  21. static const int L_7_HMP = 100;
  22. override int GetPostProcessEffectID()
  23. {
  24. return PostProcessEffectType.Distort;
  25. }
  26. override string GetDefaultMaterialPath()
  27. {
  28. return "Graphics/Materials/postprocess/distort";
  29. }
  30. override void RegisterMaterialParameters()
  31. {
  32. RegisterParameterScalarFloat(PARAM_DISTORT, "Distort", 0, -5, 5);
  33. RegisterParameterScalarFloat(PARAM_CENTERX, "CenterX", 0, -1, 1);
  34. RegisterParameterScalarFloat(PARAM_CENTERY, "CenterY", 0, -1, 1);
  35. RegisterParameterScalarFloat(PARAM_CHROM_ABB, "MaxChromAbberation", 0, 0, 1);
  36. RegisterParameterScalarFloat(PARAM_CHROM_ABB_SHIFTR, "ChromAbberationShiftR", 0, -2, 2);
  37. RegisterParameterScalarFloat(PARAM_CHROM_ABB_SHIFTG, "ChromAbberationShiftG", 1, -2, 2);
  38. RegisterParameterScalarFloat(PARAM_CHROM_ABB_SHIFTB, "ChromAbberationShiftB", 2, -2, 2);
  39. RegisterParameterColor(PARAM_CHROM_COLOR_MOD, "ModulateColor", 0, 0, 0, 0);
  40. RegisterParameterScalarFloat(PARAM_DISTORT_WEIGHT, "DistortWeight", 1.0, 0.0, 1.0);
  41. }
  42. }