升级6.4.升级水,升级天气

This commit is contained in:
2026-04-05 00:26:54 +08:00
parent 63bc9b5536
commit 5f7cbfb713
635 changed files with 34718 additions and 22567 deletions

View File

@@ -29,13 +29,13 @@ namespace WaveHarmonic.Crest
bool _DynamicSoftShadows = true;
[Tooltip("Factor control for dynamic soft jitter.")]
[@Predicated(nameof(_DynamicSoftShadows), hide: true)]
[@Show(nameof(_DynamicSoftShadows))]
[@Range(0f, 1f, Range.Clamp.Minimum)]
[SerializeField]
float _SoftJitterExtinctionFactor = 0.75f;
[Tooltip("Jitter diameter for soft shadows, controls softness of this shadowing component.")]
[@Predicated(nameof(_DynamicSoftShadows), hide: true, inverted: true)]
[@Hide(nameof(_DynamicSoftShadows))]
[@Range(0f, k_MaximumJitter)]
[@GenerateAPI]
[SerializeField]
@@ -96,6 +96,7 @@ 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
{
@@ -150,17 +151,9 @@ 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.LogError("Crest: Main Light must be enabled to enable water shadowing.", _Water);
Debug.LogWarning("Crest: Main Light must be enabled to enable water shadowing.", _Water);
_Valid = false;
return;
}
@@ -171,7 +164,7 @@ namespace WaveHarmonic.Crest
if (isShadowsDisabled)
{
Debug.LogError("Crest: Shadows must be enabled in the quality settings to enable water shadowing.", _Water);
Debug.LogWarning("Crest: Shadows must be enabled in the quality settings to enable water shadowing.", _Water);
_Valid = false;
return;
}
@@ -236,8 +229,6 @@ namespace WaveHarmonic.Crest
{
base.Allocate();
_Targets.RunLambda(buffer => Clear(buffer));
{
_RenderMaterial = new PropertyWrapperMaterial[Slices];
var shader = WaterResources.Instance.Shaders._UpdateShadow;
@@ -263,12 +254,6 @@ namespace WaveHarmonic.Crest
}
}
internal override void ClearLodData()
{
base.ClearLodData();
_Targets.RunLambda(buffer => Clear(buffer));
}
/// <summary>
/// Validates the primary light.
/// </summary>
@@ -309,7 +294,7 @@ namespace WaveHarmonic.Crest
{
if (_Error != Error.IncorrectLightType)
{
Debug.LogError("Crest: Primary light must be of type Directional.", _Light);
Debug.LogWarning("Crest: Primary light must be of type Directional.", _Light);
_Error = Error.IncorrectLightType;
}
return false;
@@ -352,7 +337,8 @@ namespace WaveHarmonic.Crest
{
if (_Light != _Water.PrimaryLight)
{
_Targets.RunLambda(buffer => Clear(buffer));
Clear(DataTexture);
Clear(_PersistentDataTexture);
CleanUpShadowCommandBuffers();
_Light = null;
}
@@ -388,7 +374,8 @@ namespace WaveHarmonic.Crest
if (CopyShadowMapBuffer != null)
{
// If we have a command buffer, then there is likely shadow data so we need to clear it.
_Targets.RunLambda(buffer => Clear(buffer));
Clear(DataTexture);
Clear(_PersistentDataTexture);
CleanUpShadowCommandBuffers();
}
@@ -398,8 +385,6 @@ namespace WaveHarmonic.Crest
CopyShadowMapBuffer ??= new() { name = WaterRenderer.k_DrawLodData };
CopyShadowMapBuffer.Clear();
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
// in play mode, so don't do it in edit mode.
@@ -457,12 +442,6 @@ namespace WaveHarmonic.Crest
}
}
private protected override void GetSubstepData(float timeToSimulate, out int substeps, out float delta)
{
substeps = Mathf.FloorToInt(timeToSimulate * _SimulationFrequency);
delta = substeps > 0 ? (1f / _SimulationFrequency) : 0f;
}
private protected override void SetAdditionalSimulationParameters(PropertyWrapperCompute properties)
{
base.SetAdditionalSimulationParameters(properties);
@@ -521,6 +500,7 @@ namespace WaveHarmonic.Crest
{
_Enabled = true;
_TextureFormat = GraphicsFormat.R8G8_UNorm;
_Blur = true;
}
internal static SortedList<int, ILodInput> s_Inputs = new(Helpers.DuplicateComparison);