namespace UnityEngine.Rendering.HighDefinition { /// /// Utility class for debug overlay coordinates. /// public class DebugOverlay { /// Current x coordinate. public int x { get; private set; } /// Current y coordinate. public int y { get; private set; } /// Current overlay size. public int overlaySize { get; private set; } int m_InitialPositionX; int m_ScreenWidth; /// /// Start rendering overlay. /// /// Initial x position. /// Initial y position. /// Size of overlays between 0 and 1. /// Width of the screen. public void StartOverlay(int initialX, int initialY, int overlaySize, int screenWidth) { x = initialX; y = initialY; this.overlaySize = overlaySize; m_InitialPositionX = initialX; m_ScreenWidth = screenWidth; } /// /// Increment coordinates to the next overlay. /// public void Next() { x += overlaySize; // Go to next line if it goes outside the screen. if ((x + overlaySize) > m_ScreenWidth) { x = m_InitialPositionX; y -= overlaySize; } } /// /// Setup the viewport for the current overlay. /// /// Command buffer used to setup viewport. public void SetViewport(CommandBuffer cmd) { cmd.SetViewport(new Rect(x, y, overlaySize, overlaySize)); } } }