refactor: update text wrapping mode in RobotBootSequence and clean up CRTRendererFeature
This commit is contained in:
@@ -257,7 +257,7 @@ public class RobotBootSequence : MonoBehaviour
|
|||||||
text.fontSize = 40f;
|
text.fontSize = 40f;
|
||||||
text.alignment = TextAlignmentOptions.Left;
|
text.alignment = TextAlignmentOptions.Left;
|
||||||
text.color = BootTextColor;
|
text.color = BootTextColor;
|
||||||
text.enableWordWrapping = true;
|
text.textWrappingMode = TextWrappingModes.Normal;
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,11 +25,8 @@ public class CRTRendererFeature : ScriptableRendererFeature
|
|||||||
|
|
||||||
class CRTPass : ScriptableRenderPass
|
class CRTPass : ScriptableRenderPass
|
||||||
{
|
{
|
||||||
private readonly ProfilingSampler m_ProfilingSampler = new("CRT Effect");
|
|
||||||
|
|
||||||
private Material m_Material;
|
private Material m_Material;
|
||||||
private CRTSettings m_Settings;
|
private CRTSettings m_Settings;
|
||||||
private RTHandle m_TempColorTexture;
|
|
||||||
|
|
||||||
public void Setup(Material material, CRTSettings settings)
|
public void Setup(Material material, CRTSettings settings)
|
||||||
{
|
{
|
||||||
@@ -73,56 +70,9 @@ public class CRTRendererFeature : ScriptableRendererFeature
|
|||||||
resourceData.cameraColor = destination;
|
resourceData.cameraColor = destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
|
|
||||||
{
|
|
||||||
cameraTextureDescriptor.depthBufferBits = 0;
|
|
||||||
RenderingUtils.ReAllocateHandleIfNeeded(
|
|
||||||
ref m_TempColorTexture,
|
|
||||||
cameraTextureDescriptor,
|
|
||||||
FilterMode.Bilinear,
|
|
||||||
TextureWrapMode.Clamp,
|
|
||||||
name: "_CRTTempColorTexture"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
|
|
||||||
{
|
|
||||||
if (m_Material == null || m_Settings == null || !m_Settings.EffectEnabled)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (renderingData.cameraData.isSceneViewCamera)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CommandBuffer cmd = CommandBufferPool.Get();
|
|
||||||
|
|
||||||
using (new ProfilingScope(cmd, m_ProfilingSampler))
|
|
||||||
{
|
|
||||||
m_Material.SetFloat("_Intensity", m_Settings.Intensity);
|
|
||||||
m_Material.SetFloat("_ScanlineDensity", m_Settings.ScanlineDensity);
|
|
||||||
m_Material.SetFloat("_ScanlineStrength", m_Settings.ScanlineStrength);
|
|
||||||
m_Material.SetFloat("_Curvature", m_Settings.Curvature);
|
|
||||||
m_Material.SetFloat("_VignetteStrength", m_Settings.VignetteStrength);
|
|
||||||
m_Material.SetFloat("_ChromaticAberration", m_Settings.ChromaticAberration);
|
|
||||||
m_Material.SetFloat("_NoiseStrength", m_Settings.NoiseStrength);
|
|
||||||
m_Material.SetFloat("_FlickerStrength", m_Settings.FlickerStrength);
|
|
||||||
|
|
||||||
RTHandle source = renderingData.cameraData.renderer.cameraColorTargetHandle;
|
|
||||||
Blitter.BlitCameraTexture(cmd, source, m_TempColorTexture, m_Material, 0);
|
|
||||||
Blitter.BlitCameraTexture(cmd, m_TempColorTexture, source);
|
|
||||||
}
|
|
||||||
|
|
||||||
context.ExecuteCommandBuffer(cmd);
|
|
||||||
CommandBufferPool.Release(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
m_TempColorTexture?.Release();
|
// RenderGraph path does not allocate persistent RTHandles in this pass.
|
||||||
m_TempColorTexture = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user