using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace BansheeEngine { /** @addtogroup Rendering * @{ */ /// /// Render target specialization that allows you to render into one or multiple textures. Such textures can then be used /// in other operations as GPU program input. /// public partial class RenderTexture : RenderTarget { private RenderTexture(bool __dummy0) { } protected RenderTexture() { } /// Creates a new 2D render texture. /// Pixel format of the texture. Format must be a valid uncompressed color format. /// Width of the texture in pixels. /// Height of the texture in pixels. /// Number of samples contained per pixel. /// Determines should the pixels written on the texture be gamma corrected. /// Should the render texture also contain a depth/stencil buffer. /// /// Format of the depth/stencil buffer, if is enabled. Format must be a valid /// depth/stencil format. /// public RenderTexture(PixelFormat format, int width, int height, int numSamples = 1, bool gammaCorrection = false, bool createDepth = false, PixelFormat depthStencilFormat = PixelFormat.D32) { Internal_create(this, format, width, height, numSamples, gammaCorrection, createDepth, depthStencilFormat); } /// Creates a new 2D render texture using an existing color texture, and no depth-stencil texture. /// Color texture to render color data to. public RenderTexture(Texture colorSurface) { Internal_create0(this, colorSurface); } /// Creates a new 2D render texture using existing textures as render destinations. /// Color texture to render color data to. /// Optional depth/stencil texture to render depth/stencil data to. public RenderTexture(Texture colorSurface, Texture depthStencilSurface) { Internal_create1(this, colorSurface, depthStencilSurface); } /// Creates a new 2D render texture using one or multiple color textures and no depth-stencil texture. /// Color texture(s) to render color data to. public RenderTexture(Texture[] colorSurface) { Internal_create2(this, colorSurface); } /// Creates a new 2D render texture using one or multiple color textures and a depth/stencil texture. /// Color texture(s) to render color data to. /// Optional depth/stencil texture to render depth/stencil data to. public RenderTexture(Texture[] colorSurface, Texture depthStencilSurface) { Internal_create3(this, colorSurface, depthStencilSurface); } /// Returns the primary color surface that contains rendered color data. public Texture ColorSurface { get { return Internal_getColorSurface(mCachedPtr); } } /// Returns all the color surfaces. public Texture[] ColorSurfaces { get { return Internal_getColorSurfaces(mCachedPtr); } } /// Returns the depth/stencil surface that contains rendered depth and stencil data. public Texture DepthStencilSurface { get { return Internal_getDepthStencilSurface(mCachedPtr); } } [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_create(RenderTexture managedInstance, PixelFormat format, int width, int height, int numSamples, bool gammaCorrection, bool createDepth, PixelFormat depthStencilFormat); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_create0(RenderTexture managedInstance, Texture colorSurface); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_create1(RenderTexture managedInstance, Texture colorSurface, Texture depthStencilSurface); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_create2(RenderTexture managedInstance, Texture[] colorSurface); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_create3(RenderTexture managedInstance, Texture[] colorSurface, Texture depthStencilSurface); [MethodImpl(MethodImplOptions.InternalCall)] private static extern Texture Internal_getColorSurface(IntPtr thisPtr); [MethodImpl(MethodImplOptions.InternalCall)] private static extern Texture[] Internal_getColorSurfaces(IntPtr thisPtr); [MethodImpl(MethodImplOptions.InternalCall)] private static extern Texture Internal_getDepthStencilSurface(IntPtr thisPtr); } /** @} */ }