This commit is contained in:
zhangjiajia
2026-05-06 16:56:59 +08:00
parent 575626d3e1
commit 81ffaaeca6
1373 changed files with 145920 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
// RTHandles for Built-In Render Pipeline.
// We cannot call dispose ourselves, but it does not seem to be a problem.
using UnityEngine;
namespace WaveHarmonic.Crest.Utility
{
static class RTHandles
{
public static void Initialize()
{
if (!RenderPipelineHelper.IsLegacy)
{
return;
}
// Check whether already initialized.
if (UnityEngine.Rendering.RTHandles.maxWidth > 1)
{
return;
}
UnityEngine.Rendering.RTHandles.Initialize(Screen.width, Screen.height);
UnityEngine.Rendering.RTHandles.SetHardwareDynamicResolutionState(false);
}
public static void OnBeginCameraRendering(Camera camera)
{
// Forget Dynamic Scaling, as is broken for Shader Graph and Post-Processing anyway.
// The only foreseeable problem is if a third party calls this with a different size.
UnityEngine.Rendering.RTHandles.SetReferenceSize(camera.pixelWidth, camera.pixelHeight);
}
}
}