private void RenderOverlayThumbnailIfNeeded() { if (this.m_RenderOverlayThumbnailOnce && Event.current.type == EventType.Repaint && this.m_SelectedCubemapInfo != null) { this.m_SelectedCubemap = this.m_SelectedCubemapInfo.cubemap; RenderTexture active = RenderTexture.active; RenderTexture.active = LookDevResources.m_SelectionTexture; LookDevResources.m_LookDevCubeToLatlong.SetTexture("_MainTex", this.m_SelectedCubemap); LookDevResources.m_LookDevCubeToLatlong.SetVector("_WindowParams", new Vector4(this.m_displayRect.height, -1000f, 2f, 1f)); LookDevResources.m_LookDevCubeToLatlong.SetVector("_CubeToLatLongParams", new Vector4(0.0174532924f * this.m_SelectedCubemapInfo.angleOffset, 0.5f, 1f, 0f)); LookDevResources.m_LookDevCubeToLatlong.SetPass(0); LookDevView.DrawFullScreenQuad(new Rect(0f, 0f, 250f, 125f)); RenderTexture.active = active; this.m_RenderOverlayThumbnailOnce = false; } }
private void RenderOverlayThumbnailIfNeeded() { // An environment was selected, stores the corresponding latlong texture for later overlay rendering if (m_RenderOverlayThumbnailOnce && Event.current.type == EventType.Repaint && m_SelectedCubemapInfo != null) { m_SelectedCubemap = m_SelectedCubemapInfo.cubemap; RenderTexture oldActive = RenderTexture.active; RenderTexture.active = LookDevResources.m_SelectionTexture; LookDevResources.m_LookDevCubeToLatlong.SetTexture("_MainTex", m_SelectedCubemap); LookDevResources.m_LookDevCubeToLatlong.SetVector("_WindowParams", new Vector4(m_displayRect.height, -1000.0f, 2, 1.0f)); // Doesn't matter but let's match DrawLatLongThumbnail settings,-1000.0f to be sure to not have clipping issue (we should not clip normally but don't want to create a new shader) LookDevResources.m_LookDevCubeToLatlong.SetVector("_CubeToLatLongParams", new Vector4(Mathf.Deg2Rad * m_SelectedCubemapInfo.angleOffset, 0.5f, 1.0f, 0.0f)); LookDevResources.m_LookDevCubeToLatlong.SetPass(0); LookDevView.DrawFullScreenQuad(new Rect(0, 0, m_HDRIWidth, m_latLongHeight)); RenderTexture.active = oldActive; m_RenderOverlayThumbnailOnce = false; } }