源战役客户端
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

61 řádky
1.6 KiB

před 4 týdny
  1. #if UNITY_EDITOR
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. /// <summary>
  7. /// 处理像素计算
  8. /// </summary>
  9. public class EffectEvlaData
  10. {
  11. public int pixDrawTimes = 0; // 总调用的渲染次数
  12. public long pixTotal = 0; // n次后的理论上总渲染数
  13. public long pixActualDrawTotal = 0; // n次后的实际上渲染次数
  14. public string quality;
  15. //获取指定区域内的所有像素
  16. public double GetPixDrawAverage()
  17. {
  18. if (pixDrawTimes == 0)
  19. {
  20. return 0;
  21. }
  22. return pixTotal * 1.0f / pixDrawTimes;
  23. }
  24. //获取指定区域内的实际每个像素的绘制总数
  25. public double GetPixActualDrawAverage()
  26. {
  27. if (pixDrawTimes == 0)
  28. {
  29. return 0;
  30. }
  31. return pixActualDrawTotal * 1.0f / pixDrawTimes;
  32. }
  33. //平均像素绘制次数
  34. public double GetPixRate()
  35. {
  36. double pixDrawAverage = GetPixDrawAverage();
  37. if (pixDrawAverage == 0)
  38. {
  39. return 0;
  40. }
  41. //实际总绘制次数 / 总像素点
  42. return GetPixActualDrawAverage() / GetPixDrawAverage();
  43. }
  44. public string GetPixDrawAverageStr()
  45. {
  46. return "特效原填充像素点:" + Math.Round(this.GetPixDrawAverage(), 2);
  47. }
  48. public string GetPixActualDrawAverageStr()
  49. {
  50. return "特效实际填充像素点:" + Math.Round(this.GetPixActualDrawAverage(), 2);
  51. }
  52. public string GetPixRateStr()
  53. {
  54. return "平均每像素overdraw率:" + Math.Round(this.GetPixRate(), 2);
  55. }
  56. }
  57. #endif