升级水插件

This commit is contained in:
2026-01-08 22:30:55 +08:00
parent febff82d24
commit ca68084264
415 changed files with 18138 additions and 7134 deletions

View File

@@ -9,6 +9,12 @@ using UnityEngine.Rendering.HighDefinition;
namespace WaveHarmonic.Crest
{
class CustomPass : UnityEngine.Rendering.HighDefinition.CustomPass
{
internal GameObject _GameObject;
internal CustomPassVolume _Volume;
}
static class CustomPassHelpers
{
internal static List<CustomPassVolume> s_Volumes = new();
@@ -62,7 +68,8 @@ namespace WaveHarmonic.Crest
GameObject gameObject,
ref T pass,
string name,
CustomPassInjectionPoint injectionPoint
CustomPassInjectionPoint injectionPoint,
int priority = 0
)
where T : CustomPass, new()
{
@@ -85,14 +92,15 @@ namespace WaveHarmonic.Crest
volume = gameObject.AddComponent<CustomPassVolume>();
volume.injectionPoint = injectionPoint;
volume.isGlobal = true;
volume.priority = priority;
}
// Create custom pass.
pass ??= new()
{
name = $"Crest {name}",
targetColorBuffer = CustomPass.TargetBuffer.None,
targetDepthBuffer = CustomPass.TargetBuffer.None,
name = name,
targetColorBuffer = UnityEngine.Rendering.HighDefinition.CustomPass.TargetBuffer.None,
targetDepthBuffer = UnityEngine.Rendering.HighDefinition.CustomPass.TargetBuffer.None,
};
// Add custom pass.
@@ -100,6 +108,27 @@ namespace WaveHarmonic.Crest
{
volume.customPasses.Add(pass);
}
pass._GameObject = gameObject;
pass._Volume = volume;
}
public static void Update<T>(GameObject go, T pass, CustomPassInjectionPoint point, int priority = 0) where T : CustomPass
{
CustomPassVolume volume = null;
go.GetComponents(s_Volumes);
foreach (var v in s_Volumes)
{
if (v.customPasses.Contains(pass))
{
volume = v;
break;
}
}
volume.injectionPoint = point;
volume.priority = priority;
}
}
}