升级6.4.升级水,升级天气
This commit is contained in:
@@ -18,11 +18,6 @@ namespace WaveHarmonic.Crest
|
||||
public static readonly int s_ScreenSpaceShadowTexture = Shader.PropertyToID("_Crest_ScreenSpaceShadowTexture");
|
||||
public static readonly int s_TemporaryDepthTexture = Shader.PropertyToID("_Crest_TemporaryDepthTexture");
|
||||
public static readonly int s_PrimaryLightHasCookie = Shader.PropertyToID("g_Crest_PrimaryLightHasCookie");
|
||||
|
||||
public static class Unity
|
||||
{
|
||||
public static readonly int s_CameraOpaqueTexture = Shader.PropertyToID("_CameraOpaqueTexture");
|
||||
}
|
||||
}
|
||||
|
||||
bool _DoneMatrices;
|
||||
@@ -37,7 +32,11 @@ namespace WaveHarmonic.Crest
|
||||
? Rendering.BIRP.FrameBufferFormatOverride.HDR
|
||||
: Rendering.BIRP.FrameBufferFormatOverride.LDR;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[UnityEditor.InitializeOnLoadMethod]
|
||||
#else
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
#endif
|
||||
static void InitializeOnLoad()
|
||||
{
|
||||
// Fixes error on first frame.
|
||||
@@ -99,33 +98,18 @@ namespace WaveHarmonic.Crest
|
||||
}
|
||||
}
|
||||
|
||||
Shader.SetGlobalTexture(ShaderIDs.Unity.s_CameraOpaqueTexture, Texture2D.grayTexture);
|
||||
Shader.SetGlobalTexture(Crest.ShaderIDs.Unity.s_CameraOpaqueTexture, Texture2D.grayTexture);
|
||||
}
|
||||
|
||||
// Needs to be separate, as it needs to run after the water volume pass.
|
||||
[System.Diagnostics.Conditional(Constants.Symbols.k_Refraction)]
|
||||
void OnLegacyCopyPass(Camera camera)
|
||||
{
|
||||
if (!ShouldRender(camera, Surface.Layer))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Surface.Material == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SurfaceRenderer.IsTransparent(Surface.Material))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Our reflections do not need them.
|
||||
if (camera == WaterReflections.CurrentCamera)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_UpdateColorDepthTexturesBuffer ??= new() { name = k_DrawWater };
|
||||
_UpdateColorDepthTexturesBuffer.Clear();
|
||||
|
||||
@@ -176,7 +160,7 @@ namespace WaveHarmonic.Crest
|
||||
partial class WaterRenderer
|
||||
{
|
||||
bool _DoneCameraOpaqueTexture;
|
||||
RenderTexture _CameraOpaqueTexture;
|
||||
RTHandle _CameraOpaqueTexture;
|
||||
CommandBuffer _CameraOpaqueTextureCommands;
|
||||
|
||||
internal void UpdateCameraOpaqueTexture(Camera camera, CommandBuffer commands)
|
||||
@@ -192,6 +176,7 @@ namespace WaveHarmonic.Crest
|
||||
commands.EndSample(k_DrawCopyColor);
|
||||
}
|
||||
|
||||
[System.Diagnostics.Conditional(Constants.Symbols.k_Refraction)]
|
||||
internal void OnBeginCameraOpaqueTexture(Camera camera)
|
||||
{
|
||||
if (_DoneCameraOpaqueTexture)
|
||||
@@ -199,28 +184,20 @@ namespace WaveHarmonic.Crest
|
||||
return;
|
||||
}
|
||||
|
||||
camera.depthTextureMode |= DepthTextureMode.Depth;
|
||||
|
||||
var descriptor = Rendering.BIRP.GetCameraTargetDescriptor(camera, FrameBufferFormatOverride);
|
||||
|
||||
// Required, or depth/stencil format will be chosen.
|
||||
descriptor.depthStencilFormat = UnityEngine.Experimental.Rendering.GraphicsFormat.None;
|
||||
|
||||
// Occurred in a build and caused a black screen.
|
||||
if (descriptor.width <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_CameraOpaqueTexture == null)
|
||||
{
|
||||
_CameraOpaqueTexture = new(descriptor)
|
||||
{
|
||||
name = "_CameraOpaqueTexture",
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
_CameraOpaqueTexture.Release();
|
||||
_CameraOpaqueTexture.descriptor = descriptor;
|
||||
}
|
||||
|
||||
_CameraOpaqueTexture.Create();
|
||||
RenderPipelineCompatibilityHelper.ReAllocateIfNeeded(ref _CameraOpaqueTexture, descriptor);
|
||||
|
||||
_CameraOpaqueTextureCommands ??= new()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user