浏览代码

Updated to use string builder

/3.1
David Mohrhardt 5 年前
当前提交
ecc165eb
共有 1 个文件被更改,包括 14 次插入15 次删除
  1. 29
      Assets/Scripts/LightEstimationUI.cs

29
Assets/Scripts/LightEstimationUI.cs


using UnityEngine;
using UnityEngine.UI;
using System.Text;
using SphericalHarmonicsL2 = UnityEngine.Rendering.SphericalHarmonicsL2;

get => m_SphericalHarmonicsText;
set => m_SphericalHarmonicsText = value;
}
StringBuilder m_SphericalHarmonicsStringBuilder = new StringBuilder("");
/// <summary>
/// The UI Text element used to display the estimated color correction value for the scene.

{
if (maybeAmbientSphericalHarmonics.HasValue)
{
string sphericalHarmonicsCoefficientsStr = "";
if (m_LightEstimation.sphericalHarmonics.HasValue)
m_SphericalHarmonicsStringBuilder.Clear();
for (int i = 0; i < 3; ++i)
for (int i = 0; i < 3; ++i)
if (i == 0)
m_SphericalHarmonicsStringBuilder.Append("R:[");
else if (i == 1)
m_SphericalHarmonicsStringBuilder.Append("G:[");
else
m_SphericalHarmonicsStringBuilder.Append("B:[");
for (int j = 0; j < 9; ++j)
if (i == 0)
sphericalHarmonicsCoefficientsStr += $"R: [";
else if (i == 1)
sphericalHarmonicsCoefficientsStr += $"G: [";
else
sphericalHarmonicsCoefficientsStr += $"B: [";
for (int j = 0; j < 9; ++j)
{
sphericalHarmonicsCoefficientsStr += $"{m_LightEstimation.sphericalHarmonics.Value[i,j].ToString("0.000")}{(j != 8 ? ", " : "]\n")}";
}
m_SphericalHarmonicsStringBuilder.Append(j != 8 ? $"{maybeAmbientSphericalHarmonics.Value[i, j]}, " : $"{maybeAmbientSphericalHarmonics.Value[i, j]}]\n");
text.text = sphericalHarmonicsCoefficientsStr;
text.text = m_SphericalHarmonicsStringBuilder.ToString();
}
else
{

正在加载...
取消
保存