summaryrefslogtreecommitdiff
path: root/Thronefall_1_57/Decompile/FlatKit/BlitTexturePass.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Thronefall_1_57/Decompile/FlatKit/BlitTexturePass.cs')
-rw-r--r--Thronefall_1_57/Decompile/FlatKit/BlitTexturePass.cs80
1 files changed, 0 insertions, 80 deletions
diff --git a/Thronefall_1_57/Decompile/FlatKit/BlitTexturePass.cs b/Thronefall_1_57/Decompile/FlatKit/BlitTexturePass.cs
deleted file mode 100644
index 5b9e754..0000000
--- a/Thronefall_1_57/Decompile/FlatKit/BlitTexturePass.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-using UnityEngine;
-using UnityEngine.Rendering;
-using UnityEngine.Rendering.Universal;
-
-namespace FlatKit;
-
-internal class BlitTexturePass : ScriptableRenderPass
-{
- public static readonly string CopyEffectShaderName = "Hidden/FlatKit/CopyTexture";
-
- private ProfilingSampler _profilingSampler;
-
- private Material _effectMaterial;
-
- private Material _copyMaterial;
-
- private RenderTargetHandle _temporaryColorTexture;
-
- public void Setup(Material effectMaterial, bool useDepth, bool useNormals, bool useColor)
- {
- _effectMaterial = effectMaterial;
- string text = effectMaterial.name.Substring(effectMaterial.name.LastIndexOf('/') + 1);
- _profilingSampler = new ProfilingSampler("Blit " + text);
- _copyMaterial = CoreUtils.CreateEngineMaterial(CopyEffectShaderName);
- ConfigureInput((useColor ? ScriptableRenderPassInput.Color : ScriptableRenderPassInput.None) | (useDepth ? ScriptableRenderPassInput.Depth : ScriptableRenderPassInput.None) | (useNormals ? ScriptableRenderPassInput.Normal : ScriptableRenderPassInput.None));
- }
-
- public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
- {
- ConfigureTarget(new RenderTargetIdentifier(renderingData.cameraData.renderer.cameraColorTarget, 0, CubemapFace.Unknown, -1));
- }
-
- public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
- {
- if (_effectMaterial == null || renderingData.cameraData.camera.cameraType != CameraType.Game)
- {
- return;
- }
- _temporaryColorTexture = default(RenderTargetHandle);
- CommandBuffer commandBuffer = CommandBufferPool.Get();
- using (new ProfilingScope(commandBuffer, _profilingSampler))
- {
- RenderTextureDescriptor cameraTargetDescriptor = renderingData.cameraData.cameraTargetDescriptor;
- cameraTargetDescriptor.depthBufferBits = 0;
- SetSourceSize(commandBuffer, cameraTargetDescriptor);
- RTHandle cameraColorTargetHandle = renderingData.cameraData.renderer.cameraColorTargetHandle;
- commandBuffer.GetTemporaryRT(_temporaryColorTexture.id, cameraTargetDescriptor);
- if (renderingData.cameraData.xrRendering)
- {
- _effectMaterial.EnableKeyword("_USE_DRAW_PROCEDURAL");
- commandBuffer.SetRenderTarget(_temporaryColorTexture.Identifier());
- commandBuffer.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, _effectMaterial, 0, 0);
- commandBuffer.SetGlobalTexture("_EffectTexture", _temporaryColorTexture.Identifier());
- commandBuffer.SetRenderTarget(new RenderTargetIdentifier(cameraColorTargetHandle, 0, CubemapFace.Unknown, -1));
- commandBuffer.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, _copyMaterial, 0, 0);
- }
- else
- {
- _effectMaterial.DisableKeyword("_USE_DRAW_PROCEDURAL");
- commandBuffer.Blit(cameraColorTargetHandle, _temporaryColorTexture.Identifier(), _effectMaterial, 0);
- commandBuffer.Blit(_temporaryColorTexture.Identifier(), cameraColorTargetHandle);
- }
- }
- context.ExecuteCommandBuffer(commandBuffer);
- commandBuffer.Clear();
- CommandBufferPool.Release(commandBuffer);
- }
-
- private static void SetSourceSize(CommandBuffer cmd, RenderTextureDescriptor desc)
- {
- float num = desc.width;
- float num2 = desc.height;
- if (desc.useDynamicScale)
- {
- num *= ScalableBufferManager.widthScaleFactor;
- num2 *= ScalableBufferManager.heightScaleFactor;
- }
- cmd.SetGlobalVector("_SourceSize", new Vector4(num, num2, 1f / num, 1f / num2));
- }
-}