升级6.4.升级水,升级天气
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Crest Water System
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
// FIXME: Broken for BIRP on MacOS. Either platform specific problem or bug in Unity.
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
@@ -19,8 +19,18 @@ namespace WaveHarmonic.Crest
|
||||
|
||||
void ExecuteWaterLevelDepthTexture(Camera camera, CommandBuffer buffer)
|
||||
{
|
||||
Helpers.CreateRenderTargetTextureReference(ref _WaterLevelDepthTexture, ref _WaterLevelDepthTarget);
|
||||
_WaterLevelDepthTexture.name = k_WaterLevelDepthTextureName;
|
||||
// Currently, only used for painting which means only when mouse is over the view.
|
||||
if (!_Water._CurrentSceneCameraHasMouseHover)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_WaterLevelDepthTexture == null)
|
||||
{
|
||||
_WaterLevelDepthTexture = new(0, 0, 0);
|
||||
}
|
||||
|
||||
WaterLevelDepthTexture.name = k_WaterLevelDepthTextureName;
|
||||
|
||||
if (_WaterLevelDepthMaterial == null)
|
||||
{
|
||||
@@ -41,11 +51,19 @@ namespace WaveHarmonic.Crest
|
||||
|
||||
// Depth texture.
|
||||
// Always release to handle screen size changes.
|
||||
_WaterLevelDepthTexture.Release();
|
||||
WaterLevelDepthTexture.Release();
|
||||
descriptor.graphicsFormat = UnityEngine.Experimental.Rendering.GraphicsFormat.R32_SFloat;
|
||||
descriptor.depthBufferBits = 0;
|
||||
Helpers.SafeCreateRenderTexture(ref _WaterLevelDepthTexture, descriptor);
|
||||
_WaterLevelDepthTexture.Create();
|
||||
WaterLevelDepthTexture.descriptor = descriptor;
|
||||
WaterLevelDepthTexture.Create();
|
||||
|
||||
_WaterLevelDepthTarget = new
|
||||
(
|
||||
WaterLevelDepthTexture,
|
||||
mipLevel: 0,
|
||||
CubemapFace.Unknown,
|
||||
depthSlice: -1 // Bind all XR slices.
|
||||
);
|
||||
|
||||
// Convert.
|
||||
Helpers.Blit(buffer, _WaterLevelDepthTarget, Rendering.BIRP.UtilityMaterial, (int)Rendering.BIRP.UtilityPass.Copy);
|
||||
@@ -82,3 +100,5 @@ namespace WaveHarmonic.Crest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user