还原水插件

This commit is contained in:
2026-03-05 00:14:42 +08:00
parent 0de35591e7
commit e82f2ea6b7
270 changed files with 2773 additions and 12445 deletions

View File

@@ -42,9 +42,8 @@ namespace WaveHarmonic.Crest
float _GenerationTime = -1f;
// WebGPU claims it does but does not.
static readonly bool s_SupportsRandomWriteRGFloat =
!Helpers.IsWebGPU && SystemInfo.SupportsRandomWriteOnRenderTextureFormat(RenderTextureFormat.RGFloat);
SystemInfo.SupportsRandomWriteOnRenderTextureFormat(RenderTextureFormat.RGFloat);
public static class ShaderIDs
{
@@ -208,7 +207,7 @@ namespace WaveHarmonic.Crest
rtd.enableRandomWrite = true;
rtd.depthBufferBits = 0;
rtd.volumeDepth = k_CascadeCount;
rtd.graphicsFormat = GraphicsFormat.R32G32B32A32_SFloat;
rtd.colorFormat = RenderTextureFormat.ARGBFloat;
rtd.msaaSamples = 1;
Helpers.SafeCreateRenderTexture(ref _SpectrumInitial, rtd);
@@ -216,7 +215,7 @@ namespace WaveHarmonic.Crest
_SpectrumInitial.Create();
// Raw wave data buffer
WaveBuffers = new(resolution, resolution, 0, Helpers.GetCompatibleTextureFormat(GraphicsFormat.R16G16B16A16_SFloat, randomWrite: true))
WaveBuffers = new(resolution, resolution, 0, GraphicsFormat.R16G16B16A16_SFloat)
{
wrapMode = TextureWrapMode.Repeat,
antiAliasing = 1,
@@ -264,7 +263,7 @@ namespace WaveHarmonic.Crest
offset <<= 1;
}
var texture = new Texture2D(resolution, Mathf.RoundToInt(Mathf.Log(resolution, 2)), TextureFormat.RGFloat, false, true);
var texture = new Texture2D(resolution, Mathf.RoundToInt(Mathf.Log(resolution, 2)), TextureFormat.RGBAFloat, false, true);
texture.SetPixels(colors);
texture.Apply();
s_ButterflyTextures.Add(resolution, texture);
@@ -301,7 +300,7 @@ namespace WaveHarmonic.Crest
if (s_SupportsRandomWriteRGFloat)
{
descriptor.graphicsFormat = GraphicsFormat.R32G32_SFloat;
descriptor.colorFormat = RenderTextureFormat.RGFloat;
}
// No need to clear as overwritten.

View File

@@ -67,8 +67,6 @@ namespace WaveHarmonic.Crest
internal SpectrumModel _Model;
#pragma warning restore 414
internal float[] _PowerLinearScales = new float[k_NumberOfOctaves];
internal enum SpectrumModel
{
None,
@@ -223,7 +221,6 @@ namespace WaveHarmonic.Crest
// we store power on logarithmic scale. this does not include 0, we represent 0 as min value
pow = Mathf.Max(pow, Mathf.Pow(10f, s_MinimumPowerLog));
_PowerLinearScales[octave] = pow;
_PowerLogarithmicScales[octave] = Mathf.Log10(pow);
}
}
@@ -282,7 +279,6 @@ namespace WaveHarmonic.Crest
{
var power = _PowerDisabled[i] ? 0f : Mathf.Pow(10f, _PowerLogarithmicScales[i]);
power *= _Multiplier * _Multiplier;
_PowerLinearScales[i] = power;
_ScratchData[i] = power * Color.white;
}