升级水插件
This commit is contained in:
@@ -11,6 +11,7 @@ namespace WaveHarmonic.Crest
|
||||
/// <summary>
|
||||
/// Data storage for for the Renderer input mode.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public abstract partial class RendererLodInputData : LodInputData
|
||||
{
|
||||
[Tooltip("The renderer to use for this input.\n\nCan be anything that inherits from <i>Renderer</i> like <i>MeshRenderer</i>, <i>TrailRenderer</i> etc.")]
|
||||
@@ -47,12 +48,6 @@ namespace WaveHarmonic.Crest
|
||||
#pragma warning restore 414
|
||||
|
||||
|
||||
static class ShaderIDs
|
||||
{
|
||||
public static readonly int s_Time = Shader.PropertyToID("_Time");
|
||||
}
|
||||
|
||||
|
||||
// Some renderers require multiple materials like particles with trails.
|
||||
// We pass this to GetSharedMaterials to avoid allocations.
|
||||
internal List<Material> _Materials = new();
|
||||
@@ -169,35 +164,31 @@ namespace WaveHarmonic.Crest
|
||||
}
|
||||
#endif
|
||||
|
||||
var pass = _ShaderPassIndex;
|
||||
// BIRP/URP SG first pass is the right one.
|
||||
// HDRP SG does not support matrix override, but users can just use BIRP instead.
|
||||
var pass = 0;
|
||||
|
||||
if (ShapeWaves.s_RenderPassOverride > -1)
|
||||
{
|
||||
// Needs to use a second pass to disable blending.
|
||||
pass = ShapeWaves.s_RenderPassOverride;
|
||||
}
|
||||
else if (!_OverrideShaderPass)
|
||||
else if (_OverrideShaderPass)
|
||||
{
|
||||
// BIRP/URP SG first pass is the right one.
|
||||
pass = 0;
|
||||
|
||||
// Support HDRP SG. It will always have more than one pass.
|
||||
if (RenderPipelineHelper.IsHighDefinition && material.shader.passCount > 1)
|
||||
{
|
||||
var sgPass = material.FindPass("ForwardOnly");
|
||||
if (sgPass > -1) pass = sgPass;
|
||||
}
|
||||
pass = _ShaderPassIndex;
|
||||
}
|
||||
else if (_ShaderPassIndex > material.shader.passCount - 1)
|
||||
|
||||
if (pass > material.shader.passCount - 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Time is not set for us for some reason… Use Time.timeSinceLevelLoad as per:
|
||||
// https://docs.unity3d.com/Manual/SL-UnityShaderVariables.html
|
||||
if (RenderPipelineHelper.IsLegacy)
|
||||
if (RenderPipelineHelper.IsLegacy || RenderPipelineHelper.IsHighDefinition)
|
||||
{
|
||||
_Renderer.GetPropertyBlock(_MaterialPropertyBlock);
|
||||
_MaterialPropertyBlock.SetVector(ShaderIDs.s_Time, new
|
||||
_MaterialPropertyBlock.SetVector(ShaderIDs.Unity.s_Time, new
|
||||
(
|
||||
Time.timeSinceLevelLoad / 20,
|
||||
Time.timeSinceLevelLoad,
|
||||
|
||||
Reference in New Issue
Block a user