还原水插件

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

@@ -96,7 +96,6 @@ namespace WaveHarmonic.Crest
private protected override Color ClearColor => Color.black;
private protected override bool NeedToReadWriteTextureData => true;
internal override int BufferCount => 2;
internal override bool SkipEndOfFrame => true;
private protected override GraphicsFormat RequestedTextureFormat => _TextureFormatMode switch
{
@@ -151,9 +150,17 @@ namespace WaveHarmonic.Crest
#if d_UnityURP
var asset = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;
// TODO: Support single casacades as it is possible.
if (asset && asset.shadowCascadeCount < 2)
{
Debug.LogError("Crest shadowing requires shadow cascades to be enabled on the pipeline asset.", asset);
_Valid = false;
return;
}
if (asset.mainLightRenderingMode == LightRenderingMode.Disabled)
{
Debug.LogWarning("Crest: Main Light must be enabled to enable water shadowing.", _Water);
Debug.LogError("Crest: Main Light must be enabled to enable water shadowing.", _Water);
_Valid = false;
return;
}
@@ -164,7 +171,7 @@ namespace WaveHarmonic.Crest
if (isShadowsDisabled)
{
Debug.LogWarning("Crest: Shadows must be enabled in the quality settings to enable water shadowing.", _Water);
Debug.LogError("Crest: Shadows must be enabled in the quality settings to enable water shadowing.", _Water);
_Valid = false;
return;
}
@@ -229,6 +236,8 @@ namespace WaveHarmonic.Crest
{
base.Allocate();
_Targets.RunLambda(buffer => Clear(buffer));
{
_RenderMaterial = new PropertyWrapperMaterial[Slices];
var shader = WaterResources.Instance.Shaders._UpdateShadow;
@@ -254,6 +263,12 @@ namespace WaveHarmonic.Crest
}
}
internal override void ClearLodData()
{
base.ClearLodData();
_Targets.RunLambda(buffer => Clear(buffer));
}
/// <summary>
/// Validates the primary light.
/// </summary>
@@ -294,7 +309,7 @@ namespace WaveHarmonic.Crest
{
if (_Error != Error.IncorrectLightType)
{
Debug.LogWarning("Crest: Primary light must be of type Directional.", _Light);
Debug.LogError("Crest: Primary light must be of type Directional.", _Light);
_Error = Error.IncorrectLightType;
}
return false;
@@ -383,7 +398,7 @@ namespace WaveHarmonic.Crest
CopyShadowMapBuffer ??= new() { name = WaterRenderer.k_DrawLodData };
CopyShadowMapBuffer.Clear();
FlipBuffers(buffer);
FlipBuffers();
// clear the shadow collection. it will be overwritten with shadow values IF the shadows render,
// which only happens if there are (nontransparent) shadow receivers around. this is only reliable
@@ -506,7 +521,6 @@ namespace WaveHarmonic.Crest
{
_Enabled = true;
_TextureFormat = GraphicsFormat.R8G8_UNorm;
_Blur = true;
}
internal static SortedList<int, ILodInput> s_Inputs = new(Helpers.DuplicateComparison);