/// <summary> /// helper for creating a RenderTarget2D /// </summary> /// <param name="width">Width.</param> /// <param name="height">Height.</param> public RenderTexture(int width, int height) { renderTarget = RenderTarget.create( width, height, Screen.backBufferFormat, Screen.preferredDepthStencilFormat); }
/// <summary> /// helper for creating a full screen RenderTarget2D with a specific DepthFormat /// </summary> /// <param name="preferredDepthFormat">Preferred depth format.</param> public RenderTexture(DepthFormat preferredDepthFormat) { renderTarget = RenderTarget.create( Screen.width, Screen.height, Screen.backBufferFormat, preferredDepthFormat); }
/// <summary> /// resizes the RenderTarget2D to the specified size /// </summary> /// <param name="width">Width.</param> /// <param name="height">Height.</param> public void resize(int width, int height) { // no need to resize if we are already the right size if (renderTarget.Width == width && renderTarget.Height == height && !renderTarget.IsDisposed) { return; } // retain the same DepthFormat when we recreate the RenderTarget2D var depthFormat = renderTarget.DepthStencilFormat; // unload if necessary Dispose(); renderTarget = RenderTarget.create(width, height, depthFormat); }
/// <summary> /// helper for creating a full screen RenderTarget2D /// </summary> public RenderTexture() { renderTarget = RenderTarget.create(Screen.backBufferWidth, Screen.backBufferHeight, Screen.backBufferFormat, Screen.preferredDepthStencilFormat); }