public Texture EndPreview() { Unsupported.RestoreOverrideRenderSettings(); this.m_SavedState.Restore(); this.FinishFrame(); return(this.m_RenderTexture); }
private void FinishFrame() { Unsupported.RestoreOverrideRenderSettings(); foreach (var light in lights) { light.enabled = false; } }
private void FinishFrame() { Unsupported.RestoreOverrideRenderSettings(); Light[] lights = this.lights; for (int i = 0; i < lights.Length; i++) { Light light = lights[i]; light.enabled = false; } }
public Texture2D EndStaticPreview() { Unsupported.RestoreOverrideRenderSettings(); RenderTexture temporary = RenderTexture.GetTemporary((int)this.m_TargetRect.width, (int)this.m_TargetRect.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); Graphics.Blit(this.m_RenderTexture, temporary, EditorGUIUtility.GUITextureBlit2SRGBMaterial); RenderTexture.active = temporary; Texture2D texture2D = new Texture2D((int)this.m_TargetRect.width, (int)this.m_TargetRect.height, TextureFormat.RGB24, false, false); texture2D.ReadPixels(new Rect(0f, 0f, this.m_TargetRect.width, this.m_TargetRect.height), 0, 0); texture2D.Apply(); RenderTexture.ReleaseTemporary(temporary); this.m_SavedState.Restore(); this.FinishFrame(); return(texture2D); }
public Texture2D EndStaticPreview() { Unsupported.RestoreOverrideRenderSettings(); var tmp = RenderTexture.GetTemporary((int)m_TargetRect.width, (int)m_TargetRect.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); Graphics.Blit(m_RenderTexture, tmp, EditorGUIUtility.GUITextureBlit2SRGBMaterial); RenderTexture.active = tmp; var copy = new Texture2D((int)m_TargetRect.width, (int)m_TargetRect.height, TextureFormat.RGB24, false, false); copy.ReadPixels(new Rect(0, 0, m_TargetRect.width, m_TargetRect.height), 0, 0); copy.Apply(); RenderTexture.ReleaseTemporary(tmp); m_SavedState.Restore(); FinishFrame(); return(copy); }
public void Render(bool allowScriptableRenderPipeline = false, bool updatefov = true) { Light[] lights = this.lights; for (int i = 0; i < lights.Length; i++) { Light light = lights[i]; light.enabled = true; } bool useScriptableRenderPipeline = Unsupported.useScriptableRenderPipeline; Unsupported.useScriptableRenderPipeline = allowScriptableRenderPipeline; float fieldOfView = this.camera.fieldOfView; if (updatefov) { float num = (this.m_RenderTexture.width > 0) ? Mathf.Max(1f, (float)this.m_RenderTexture.height / (float)this.m_RenderTexture.width) : 1f; this.camera.fieldOfView = Mathf.Atan(num * Mathf.Tan(this.camera.fieldOfView * 0.5f * 0.0174532924f)) * 57.29578f * 2f; } this.camera.Render(); this.camera.fieldOfView = fieldOfView; Unsupported.useScriptableRenderPipeline = useScriptableRenderPipeline; Unsupported.RestoreOverrideRenderSettings(); }