private void OnPostRender() { if (setting.textureScreen == null || setting.textureScreen.width != targetCamera.pixelWidth || setting.textureScreen.height != targetCamera.pixelHeight) { UtilityCommon.Destroy(setting.textureScreen); setting.textureScreen = new Texture2D(targetCamera.pixelWidth, targetCamera.pixelHeight, TextureFormat.RGBA32, false, true); RecalculateGrids(); } if (setting.resetStatistics) { setting.resetStatistics = false; RecalculateGrids(); RefreshStatistics(); } else if (setting.refreshStatistics) { RefreshStatistics(); } else if (setting.realtimeStatistics) { realtimeStatisticsFrequencyIndex = (realtimeStatisticsFrequencyIndex + 1) % setting.realtimeStatisticsFrequency; if (realtimeStatisticsFrequencyIndex == 0) { RefreshStatistics(); } } }
public void Exit() { foreach (ShadingRenderer renderer in shadingRenderers) { renderer.Reset(); } shadingRenderers.Clear(); UtilityCommon.Destroy(this); }
public void Exit() { foreach (ShadingRenderer renderer in shadingRenderers) { renderer.Reset(); } shadingRenderers.Clear(); if (overdrawBuffer != null) { UtilityCommon.Destroy(overdrawBuffer); } UtilityCommon.Destroy(materialClear); UtilityCommon.Destroy(materialApply); UtilityCommon.Destroy(this); }
private void CreateOverdrawBuffer(Camera camera) { if (overdrawBuffer == null || overdrawBuffer.width != camera.pixelWidth || overdrawBuffer.height != camera.pixelHeight) { if (overdrawBuffer) { UtilityCommon.Destroy(overdrawBuffer); } #if UNITY_EDITOR overdrawBuffer = new RenderTexture(camera.pixelWidth, camera.pixelHeight, 0, RenderTextureFormat.RInt); #else // Must be ARGB32 but will get automatically converted to float or float4 or int or half, from your shader code declaration. overdrawBuffer = new RenderTexture(camera.pixelWidth, camera.pixelHeight, 0, RenderTextureFormat.ARGB32); #endif overdrawBuffer.name = $"Overdraw Buffer {camera.name}"; overdrawBuffer.enableRandomWrite = true; overdrawBuffer.Create(); } }
public void Exit() { UtilityCommon.Destroy(materialClearOpaque); UtilityCommon.Destroy(materialApply); UtilityCommon.Destroy(materialDisplayShowAlpha); if (commandBufferBeforeForwardAlpha != null) { targetCamera.RemoveCommandBuffer(CameraEvent.BeforeForwardAlpha, commandBufferBeforeForwardAlpha); } if (commandBufferBeforeImageEffects != null) { targetCamera.RemoveCommandBuffer(CameraEvent.BeforeImageEffects, commandBufferBeforeImageEffects); } foreach (ShadingRenderer renderer in shadingRenderers) { renderer.Reset(); } shadingRenderers.Clear(); UtilityCommon.Destroy(this); }