Files
UltimateFishing/Assets/Scripts/Assembly-CSharp/UltimateWater/Internal/GraphicsUtilities.cs
2026-02-21 16:45:37 +08:00

31 lines
921 B
C#

using UnityEngine;
using UnityEngine.Rendering;
namespace UltimateWater.Internal
{
public static class GraphicsUtilities
{
private static CommandBuffer _CommandBuffer;
public static void Blit(Texture source, RenderTexture target, Material material, int shaderPass, MaterialPropertyBlock properties)
{
if (_CommandBuffer == null)
{
CommandBuffer commandBuffer = new CommandBuffer();
commandBuffer.name = "UltimateWater Custom Blit";
_CommandBuffer = commandBuffer;
}
GL.PushMatrix();
GL.modelview = Matrix4x4.identity;
GL.LoadProjectionMatrix(Matrix4x4.identity);
material.mainTexture = source;
_CommandBuffer.SetRenderTarget(target);
_CommandBuffer.DrawMesh(Quads.BipolarXY, Matrix4x4.identity, material, 0, shaderPass, properties);
Graphics.ExecuteCommandBuffer(_CommandBuffer);
RenderTexture.active = target;
GL.PopMatrix();
_CommandBuffer.Clear();
}
}
}