修改水

This commit is contained in:
2026-01-01 22:00:33 +08:00
parent 040a222bd6
commit 9ceffccd39
1800 changed files with 103929 additions and 139495 deletions

View File

@@ -0,0 +1,34 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
using UnityEngine;
// Linter does not support mixing inheritdoc plus defining own parameters.
#pragma warning disable CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do)
namespace WaveHarmonic.Crest
{
/// <summary>
/// Interface for an object that returns water depth and distance to water edge.
/// </summary>
public interface IDepthProvider : IQueryProvider
{
internal static NoneProvider None { get; } = new();
internal sealed class NoneProvider : IDepthProvider
{
public int Query(int _0, float _1, Vector3[] _2, Vector3[] result)
{
if (result != null) System.Array.Clear(result, 0, result.Length);
return 0;
}
}
/// <summary>
/// Query water depth data at a set of points.
/// </summary>
/// <param name="results">Water depth and distance to shoreline (XY respectively). Both are signed.</param>
/// <inheritdoc cref="IQueryProvider.Query(int, float, Vector3[], int)" />
int Query(int hash, float minimumLength, Vector3[] points, Vector3[] results);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8c8c76a0ab417499bb25ecea61560108
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
using UnityEngine;
namespace WaveHarmonic.Crest
{
sealed class DepthQuery : QueryBase, IDepthProvider
{
public DepthQuery(WaterRenderer water) : base(water) { }
protected override int Kernel => 2;
public override int Query(int hash, float minimumSpatialLength, Vector3[] queries, Vector3[] results)
{
var id = base.Query(hash, minimumSpatialLength, queries, results);
// Infinity will become NaN. Convert back to infinity.
// Negative infinity should not happen.
for (var i = 0; i < results.Length; i++)
{
var value = results[i];
if (float.IsNaN(value.x)) value.x = float.PositiveInfinity;
if (float.IsNaN(value.y)) value.y = float.PositiveInfinity;
results[i] = value;
}
return id;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 92350636082384718babd120eff1cbf0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: