Skip to content

Commit

Permalink
code style cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pfcDorn committed Aug 4, 2023
1 parent 565bbf9 commit f092e7e
Showing 1 changed file with 13 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ namespace UnityGLTF
#endif
public class RoughRefractionFeature : ScriptableRendererFeature
{
#if UNITY_2023_1_OR_NEWER
private Downsampling downsampling = Downsampling.None;
#else
public Downsampling downsampling = Downsampling.None;
private const string CAMERA_OPAQUE_TEXTURENAME = "_CameraOpaqueTexture ";

#if !UNITY_2023_1_OR_NEWER
[SerializeField]
#endif
private Downsampling downsampling = Downsampling.None;

class CustomRenderPass : CopyColorPass
{
public Downsampling m_DownsamplingMethod;
#if UNITY_2023_1_OR_NEWER
public RTHandle m_destination;
public RTHandle m_source;
public RTHandle m_destination;
public RTHandle m_source;

#else
public RenderTargetHandle destination;
#endif

public CustomRenderPass(RenderPassEvent evt) : base(evt,
CoreUtils.CreateEngineMaterial(Shader.Find("Hidden/Universal Render Pipeline/Sampling")),
public CustomRenderPass(RenderPassEvent evt) : base(evt,
CoreUtils.CreateEngineMaterial(Shader.Find("Hidden/Universal Render Pipeline/Sampling")),
CoreUtils.CreateEngineMaterial(Shader.Find("Hidden/Universal Render Pipeline/Blit")))
{ }
{ }

#if UNITY_2023_1_OR_NEWER
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
Expand All @@ -44,21 +44,10 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData

public void Setup(RTHandle source, Downsampling downsampling)
{
#if UNITY_2023_1_OR_NEWER
this.m_source = source;
#else

base.Setup(source, destination, downsampling);
// this.destination = destinationColor;
#endif
this.m_DownsamplingMethod = downsampling;
}

public override void OnCameraCleanup(CommandBuffer cmd)
{
}


public void Dispose()
{
m_destination?.Release();
Expand Down Expand Up @@ -95,8 +84,7 @@ public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderin
descriptor.height /= 4;
}
#if UNITY_2023_1_OR_NEWER
RenderingUtils.ReAllocateIfNeeded(ref m_destination, descriptor, FilterMode.Trilinear,
TextureWrapMode.Clamp, name: "_CameraOpaqueTexture");
RenderingUtils.ReAllocateIfNeeded(ref m_destination, descriptor, FilterMode.Trilinear, TextureWrapMode.Clamp, name: CAMERA_OPAQUE_TEXTURENAME);
base.Setup(m_source, m_destination, this.m_DownsamplingMethod);
cmd.SetGlobalTexture(m_destination.name, m_destination.nameID);
#else
Expand All @@ -107,8 +95,7 @@ public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderin

CustomRenderPass m_ScriptablePass;

#if UNITY_2023_1_OR_NEWER
#else
#if !UNITY_2023_1_OR_NEWER
RenderTargetHandle m_OpaqueColor;
#endif

Expand All @@ -121,7 +108,7 @@ public override void Create()
m_ScriptablePass = new CustomRenderPass(RenderPassEvent.AfterRenderingSkybox);
}
#else
m_OpaqueColor.Init("_CameraOpaqueTexture");
m_OpaqueColor.Init(CAMERA_OPAQUE_TEXTURENAME);
#endif
}

Expand Down

0 comments on commit f092e7e

Please sign in to comment.