升级水插件

This commit is contained in:
2026-01-31 00:32:49 +08:00
parent a739d2fe3b
commit 4123e83573
293 changed files with 13449 additions and 2853 deletions

View File

@@ -5,6 +5,7 @@ using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.SceneManagement;
using WaveHarmonic.Crest.Internal.Compatibility;
namespace WaveHarmonic.Crest.Examples
{
@@ -21,7 +22,7 @@ namespace WaveHarmonic.Crest.Examples
#pragma warning restore 414
#if UNITY_EDITOR
static int s_Scene;
static ulong s_Scene;
static bool s_SceneChanged;
[InitializeOnLoadMethod]
@@ -29,16 +30,16 @@ namespace WaveHarmonic.Crest.Examples
{
EditorSceneManager.sceneClosed -= OnSceneClosed;
EditorSceneManager.sceneClosed += OnSceneClosed;
s_Scene = SceneManager.GetActiveScene().handle;
s_Scene = SceneManager.GetActiveScene().GetRawSceneHandle();
}
static void OnSceneClosed(Scene a)
{
// TODO: Report to Unity
// Does not work if only game view is open. Handles will never update.
if (s_Scene == a.handle) return;
if (s_Scene == a.GetRawSceneHandle()) return;
s_SceneChanged = true;
s_Scene = a.handle;
s_Scene = a.GetRawSceneHandle();
}
void OnEnable()

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5923ff6194bdd4740a68caa8ecad46d4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
#if d_UnityInputSystem && ENABLE_INPUT_SYSTEM
#define INPUT_SYSTEM_ENABLED
#endif
using UnityEngine;
namespace WaveHarmonic.Crest.Examples
{
#if !CREST_DEBUG
[AddComponentMenu("")]
#endif
sealed class InputModulePatcher : MonoBehaviour
{
#if INPUT_SYSTEM_ENABLED
void OnEnable()
{
GetComponent<UnityEngine.EventSystems.StandaloneInputModule>().enabled = false;
}
#endif
}
}

View File

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

View File

@@ -18,6 +18,9 @@ namespace WaveHarmonic.Crest.Examples
int _Version = 0;
#pragma warning restore 414
[SerializeField]
bool _WorldSpace;
[Header("Translation")]
[SerializeField]
@@ -52,7 +55,7 @@ namespace WaveHarmonic.Crest.Examples
void Start()
{
_Origin = transform.position;
_Origin = _WorldSpace ? transform.position : transform.localPosition;
_OrthogonalAxis = Quaternion.AngleAxis(90f, Vector3.up) * _Axis;
}
@@ -64,10 +67,21 @@ namespace WaveHarmonic.Crest.Examples
// Do circles in perlin noise
var rnd = 2f * (Mathf.PerlinNoise(0.5f + 0.5f * Mathf.Cos(_Frequency * Time.time), 0.5f + 0.5f * Mathf.Sin(_Frequency * Time.time)) - 0.5f);
// Prevent jump at start.
var amplitude = Mathf.Min(_Amplitude, _Amplitude * Time.timeSinceLevelLoad);
var orthoPhaseOff = Mathf.PI / 2f;
var rndOrtho = 2f * (Mathf.PerlinNoise(0.5f + 0.5f * Mathf.Cos(_Frequency * Time.time + orthoPhaseOff), 0.5f + 0.5f * Mathf.Sin(_Frequency * Time.time + orthoPhaseOff)) - 0.5f);
var position = _Origin + (_Axis * rnd + _OrthogonalMotion * rndOrtho * _OrthogonalAxis) * amplitude;
transform.position = _Origin + (_Axis * rnd + _OrthogonalMotion * rndOrtho * _OrthogonalAxis) * _Amplitude;
if (_WorldSpace)
{
transform.position = position;
}
else
{
transform.localPosition = position;
}
}
// Rotation

View File

@@ -34,6 +34,11 @@ namespace WaveHarmonic.Crest.Examples
return;
}
if (Helpers.IsWebGPU)
{
return;
}
_QuickVolumes.Clear();
foreach (var volume in GetComponents<PostProcessVolume>())