Esempio n. 1
0
        /// <summary>
        /// Creates a new 2D texture that scales with backbuffer size.
        /// </summary>
        /// <param name="ratio">The amount to scale when the backbuffer resizes.</param>
        /// <param name="hasMips">Indicates that texture contains full mip-map chain.</param>
        /// <param name="arrayLayers">Number of layers in texture array. Must be 1 if Texture2DArray caps flag not set.</param>
        /// <param name="format">The format of the texture data.</param>
        /// <param name="flags">Flags that control texture behavior.</param>
        /// <returns>
        /// The newly created texture handle.
        /// </returns>
        public static Texture Create2D(BackbufferRatio ratio, bool hasMips, int arrayLayers, TextureFormat format, TextureFlags flags = TextureFlags.None)
        {
            var info = new TextureInfo {
                Format = format,
                Layers = (ushort)arrayLayers
            };

            var handle = NativeMethods.bgfx_create_texture_2d_scaled(ratio, hasMips, (ushort)arrayLayers, format, flags);

            return(new Texture(handle, ref info));
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new 2D texture that scales with backbuffer size.
        /// </summary>
        /// <param name="ratio">The amount to scale when the backbuffer resizes.</param>
        /// <param name="mipCount">The number of mip levels.</param>
        /// <param name="format">The format of the texture data.</param>
        /// <param name="flags">Flags that control texture behavior.</param>
        /// <returns>
        /// The newly created texture handle.
        /// </returns>
        public static Texture Create2D(BackbufferRatio ratio, int mipCount, TextureFormat format, TextureFlags flags = TextureFlags.None)
        {
            var info = new TextureInfo {
                Format   = format,
                MipCount = (byte)mipCount
            };

            var handle = NativeMethods.bgfx_create_texture_2d_scaled(ratio, info.MipCount, format, flags);

            return(new Texture(handle, ref info));
        }
Esempio n. 3
0
 public static extern ushort bgfx_create_frame_buffer_scaled(BackbufferRatio ratio, TextureFormat format, TextureFlags flags);
Esempio n. 4
0
 public static extern void bgfx_set_view_rect_auto(ushort id, ushort x, ushort y, BackbufferRatio ratio);
Esempio n. 5
0
 public static extern ushort bgfx_create_texture_2d_scaled(BackbufferRatio ratio, [MarshalAs(UnmanagedType.U1)] bool hasMips, ushort numLayers, TextureFormat format, TextureFlags flags);
Esempio n. 6
0
 public static extern ushort bgfx_create_frame_buffer_scaled(BackbufferRatio ratio, TextureFormat format, TextureFlags flags);
Esempio n. 7
0
 public static extern void bgfx_set_view_rect_auto(byte id, ushort x, ushort y, BackbufferRatio ratio);
Esempio n. 8
0
 public static extern ushort bgfx_create_texture_2d_scaled(BackbufferRatio ratio, byte numMips, TextureFormat format, TextureFlags flags);
Esempio n. 9
0
 /// <summary>
 /// Sets the viewport for the given rendering view.
 /// </summary>
 /// <param name="id">The index of the view.</param>
 /// <param name="x">The X coordinate of the viewport.</param>
 /// <param name="y">The Y coordinate of the viewport.</param>
 /// <param name="ratio">The ratio with which to automatically size the viewport.</param>
 public static void SetViewRect(byte id, int x, int y, BackbufferRatio ratio)
 {
     NativeMethods.bgfx_set_view_rect_auto(id, (ushort)x, (ushort)y, ratio);
 }
Esempio n. 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FrameBuffer"/> struct.
 /// </summary>
 /// <param name="ratio">The amount to scale when the backbuffer resizes.</param>
 /// <param name="format">The format of the new surface.</param>
 /// <param name="flags">Texture sampling flags.</param>
 public FrameBuffer(BackbufferRatio ratio, TextureFormat format, TextureFlags flags = TextureFlags.ClampU | TextureFlags.ClampV)
 {
     handle = NativeMethods.bgfx_create_frame_buffer_scaled(ratio, format, flags);
 }
Esempio n. 11
0
 /// <summary>
 /// Sets the viewport for the given rendering view.
 /// </summary>
 /// <param name="id">The index of the view.</param>
 /// <param name="x">The X coordinate of the viewport.</param>
 /// <param name="y">The Y coordinate of the viewport.</param>
 /// <param name="ratio">The ratio with which to automatically size the viewport.</param>
 public static void SetViewRect(byte id, int x, int y, BackbufferRatio ratio)
 {
     NativeMethods.bgfx_set_view_rect_auto(id, (ushort)x, (ushort)y, ratio);
 }
Esempio n. 12
0
 public static extern ushort bgfx_create_texture_2d_scaled(BackbufferRatio ratio, byte numMips, TextureFormat format, TextureFlags flags);