升级6.4.升级水,升级天气
This commit is contained in:
@@ -100,7 +100,10 @@ namespace WaveHarmonic.Crest
|
||||
});
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if URP_COMPATIBILITY_MODE
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
[System.Obsolete]
|
||||
#endif
|
||||
public override void Execute(ScriptableRenderContext context, ref RenderingData data)
|
||||
@@ -110,6 +113,7 @@ namespace WaveHarmonic.Crest
|
||||
context.ExecuteCommandBuffer(buffer);
|
||||
CommandBufferPool.Release(buffer);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
using UnityEngine;
|
||||
using WaveHarmonic.Crest.Internal;
|
||||
|
||||
namespace WaveHarmonic.Crest
|
||||
{
|
||||
@@ -9,7 +10,7 @@ namespace WaveHarmonic.Crest
|
||||
/// Renders the meniscus (waterline).
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public sealed partial class Meniscus
|
||||
public sealed partial class Meniscus : Versioned
|
||||
{
|
||||
[@Space(10)]
|
||||
|
||||
@@ -33,6 +34,14 @@ namespace WaveHarmonic.Crest
|
||||
internal Material _Material;
|
||||
|
||||
|
||||
[@Heading("Advanced")]
|
||||
|
||||
[Tooltip("Rules to exclude cameras from rendering the meniscus.\n\nThese are exclusion rules, so for all cameras, select Nothing. These rules are applied on top of the Layer rules.")]
|
||||
[@DecoratedField]
|
||||
[@GenerateAPI]
|
||||
[SerializeField]
|
||||
WaterCameraExclusion _CameraExclusions = WaterCameraExclusion.Hidden | WaterCameraExclusion.Reflection;
|
||||
|
||||
WaterRenderer _Water;
|
||||
|
||||
internal MeniscusRenderer Renderer { get; private set; }
|
||||
@@ -76,6 +85,7 @@ namespace WaveHarmonic.Crest
|
||||
return;
|
||||
}
|
||||
|
||||
#pragma warning disable format
|
||||
#if d_UnityHDRP
|
||||
if (RenderPipelineHelper.IsHighDefinition)
|
||||
{
|
||||
@@ -96,6 +106,17 @@ namespace WaveHarmonic.Crest
|
||||
{
|
||||
Renderer ??= new MeniscusRendererBIRP(water, this);
|
||||
}
|
||||
#pragma warning restore format
|
||||
}
|
||||
|
||||
internal bool ShouldRender(Camera camera)
|
||||
{
|
||||
if (!Enabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Renderer.ShouldExecute(camera);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,11 +152,6 @@ namespace WaveHarmonic.Crest
|
||||
private protected readonly WaterRenderer _Water;
|
||||
internal readonly Meniscus _Meniscus;
|
||||
|
||||
static partial class ShaderIDs
|
||||
{
|
||||
public static readonly int s_HorizonNormal = Shader.PropertyToID("_Crest_HorizonNormal");
|
||||
}
|
||||
|
||||
public abstract void OnBeginCameraRendering(Camera camera);
|
||||
public abstract void OnEndCameraRendering(Camera camera);
|
||||
|
||||
@@ -174,24 +190,19 @@ namespace WaveHarmonic.Crest
|
||||
return false;
|
||||
}
|
||||
|
||||
// Meniscus is a product of the water surface.
|
||||
if (!_Water.Surface.Enabled)
|
||||
if (!WaterRenderer.ShouldRender(camera, _Meniscus.Layer, _Meniscus._CameraExclusions))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (camera.cameraType is not CameraType.Game and not CameraType.SceneView)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!WaterRenderer.ShouldRender(camera, _Meniscus.Layer))
|
||||
// Meniscus depends on both the surface and volume.
|
||||
if (!_Water._ActiveModules.HasFlag(WaterRenderer.ActiveModules.SurfaceAndVolume))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#if d_CrestPortals
|
||||
if (_Water.Portals.Active)
|
||||
if (_Water._ActiveModules.HasFlag(WaterRenderer.ActiveModules.Portal))
|
||||
{
|
||||
// Near surface check not compatible with portals.
|
||||
return true;
|
||||
@@ -211,13 +222,6 @@ namespace WaveHarmonic.Crest
|
||||
|
||||
internal void Execute<T>(Camera camera, T commands) where T : ICommandWrapper
|
||||
{
|
||||
// Project water normal onto camera plane.
|
||||
_Meniscus.Material.SetVector(ShaderIDs.s_HorizonNormal, new Vector2
|
||||
(
|
||||
Vector3.Dot(Vector3.up, camera.transform.right),
|
||||
Vector3.Dot(Vector3.up, camera.transform.up)
|
||||
));
|
||||
|
||||
var isFullScreenRequired = true;
|
||||
var isMasked = false;
|
||||
var passOffset = 1;
|
||||
@@ -225,7 +229,7 @@ namespace WaveHarmonic.Crest
|
||||
#if d_CrestPortals
|
||||
passOffset = (int)Portals.PortalRenderer.MeniscusPass.Length;
|
||||
|
||||
if (_Water.Portals.Active)
|
||||
if (_Water._ActiveModules.HasFlag(WaterRenderer.ActiveModules.Portal))
|
||||
{
|
||||
isMasked = isFullScreenRequired = _Water._Portals.RenderMeniscus(commands, _Meniscus.Material);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user