升级6.4.升级水,升级天气
This commit is contained in:
@@ -12,6 +12,7 @@ namespace WaveHarmonic.Crest
|
||||
/// <summary>
|
||||
/// Data that gives depth of the water (height of sea level above water floor).
|
||||
/// </summary>
|
||||
[FilterEnum(nameof(_QuerySource), Filtered.Mode.Exclude, (int)LodQuerySource.CPU)]
|
||||
[FilterEnum(nameof(_TextureFormatMode), Filtered.Mode.Exclude, (int)LodTextureFormatMode.Automatic)]
|
||||
public sealed partial class DepthLod : Lod<IDepthProvider>
|
||||
{
|
||||
@@ -33,11 +34,12 @@ namespace WaveHarmonic.Crest
|
||||
// We want the clear color to be the mininimum terrain height (-1000m).
|
||||
// Mathf.Infinity can cause problems for distance.
|
||||
static readonly Color s_NullColor = new(-k_DepthBaseline, k_DepthBaseline, 0, 0);
|
||||
static Color NullColor => Helpers.IsWebGPU ? new(float.MinValue, float.MaxValue, 0, 0) : s_NullColor;
|
||||
|
||||
internal override string ID => "Depth";
|
||||
internal override string Name => "Water Depth";
|
||||
internal override Color GizmoColor => s_GizmoColor;
|
||||
private protected override Color ClearColor => s_NullColor;
|
||||
private protected override Color ClearColor => NullColor;
|
||||
private protected override bool NeedToReadWriteTextureData => true;
|
||||
|
||||
private protected override GraphicsFormat RequestedTextureFormat => _TextureFormatMode switch
|
||||
@@ -56,7 +58,7 @@ namespace WaveHarmonic.Crest
|
||||
{
|
||||
if (_NullTexture == null)
|
||||
{
|
||||
var texture = TextureArrayHelpers.CreateTexture2D(s_NullColor, UnityEngine.TextureFormat.RFloat);
|
||||
var texture = TextureArrayHelpers.CreateTexture2D(NullColor, UnityEngine.TextureFormat.RFloat);
|
||||
texture.name = $"_Crest_{ID}LodTemporaryDefaultTexture";
|
||||
_NullTexture = TextureArrayHelpers.CreateTexture2DArray(texture, k_MaximumSlices);
|
||||
_NullTexture.name = $"_Crest_{ID}LodDefaultTexture";
|
||||
@@ -71,13 +73,16 @@ namespace WaveHarmonic.Crest
|
||||
{
|
||||
_Enabled = true;
|
||||
_TextureFormat = GraphicsFormat.R16G16_SFloat;
|
||||
_MaximumQueryCount = 512;
|
||||
}
|
||||
|
||||
private protected override IDepthProvider CreateProvider(bool enable)
|
||||
private protected override IDepthProvider CreateProvider(bool onEnable)
|
||||
{
|
||||
Queryable?.CleanUp();
|
||||
// Depth is GPU only, and can only be queried using the compute path.
|
||||
return enable && Enabled ? new DepthQuery(_Water) : IDepthProvider.None;
|
||||
return onEnable && Enabled && QuerySource == LodQuerySource.GPU
|
||||
? IDepthProvider.Create(_Water)
|
||||
: IDepthProvider.None;
|
||||
}
|
||||
|
||||
internal static readonly SortedList<int, ILodInput> s_Inputs = new(Helpers.DuplicateComparison);
|
||||
|
||||
Reference in New Issue
Block a user