コード例 #1
0
ファイル: FrameBuffer.cs プロジェクト: xxami/Pulsus
 public FrameBuffer(Texture2D texture, TextureFlags flags = TextureFlags.None, TextureFormat format = TextureFormat.BGRA8)
 {
     Attachment[] attachments = { new Attachment()
                                  {
                                      Texture = texture.handle, Mip = 0, Layer = 0
                                  } };
     handle = new SharpBgfx.FrameBuffer(attachments);
 }
コード例 #2
0
ファイル: FrameBuffer.cs プロジェクト: xxami/Pulsus
        static FrameBuffer()
        {
            // BUG: SharpBgfx does not define invalid handle correctly (should be ushort.MaxValue, not 0)

            object invalid = Invalid;

            invalid.GetType().GetField("handle",
                                       BindingFlags.NonPublic | BindingFlags.Instance).SetValue(invalid, ushort.MaxValue);

            Invalid = (SharpBgfx.FrameBuffer)invalid;
        }
コード例 #3
0
ファイル: FrameBuffer.cs プロジェクト: xxami/Pulsus
        public FrameBuffer(Texture2D[] textures, TextureFlags flags = TextureFlags.None, TextureFormat format = TextureFormat.BGRA8)
        {
            List <Attachment> attachments = new List <Attachment>(textures.Length);

            foreach (Texture2D texture in textures)
            {
                attachments.Add(new Attachment()
                {
                    Texture = texture.handle, Mip = 0, Layer = 0
                });
            }

            handle = new SharpBgfx.FrameBuffer(attachments.ToArray());
        }
コード例 #4
0
ファイル: Bgfx.cs プロジェクト: PowerStateFailure/SharpBgfx
 /// <summary>
 /// Requests that a screenshot be saved. The ScreenshotTaken event will be fired to save the result.
 /// </summary>
 /// <param name="frameBuffer">The frame buffer to save.</param>
 /// <param name="filePath">The file path that will be passed to the callback event.</param>
 public static void RequestScreenShot(FrameBuffer frameBuffer, string filePath)
 {
     NativeMethods.bgfx_request_screen_shot(frameBuffer.handle, filePath);
 }
コード例 #5
0
ファイル: Bgfx.cs プロジェクト: PowerStateFailure/SharpBgfx
 /// <summary>
 /// Sets the frame buffer used by a particular view.
 /// </summary>
 /// <param name="id">The index of the view.</param>
 /// <param name="frameBuffer">The frame buffer to set.</param>
 public static void SetViewFrameBuffer(byte id, FrameBuffer frameBuffer)
 {
     NativeMethods.bgfx_set_view_frame_buffer(id, frameBuffer.handle);
 }
コード例 #6
0
ファイル: Bgfx.cs プロジェクト: zachlungu/SharpBgfx
 /// <summary>
 /// Sets a frame buffer attachment as a compute image.
 /// </summary>
 /// <param name="stage">The buffer stage to set.</param>
 /// <param name="sampler">The sampler uniform.</param>
 /// <param name="frameBuffer">The frame buffer.</param>
 /// <param name="attachment">The attachment index.</param>
 /// <param name="format">The format of the buffer data.</param>
 /// <param name="access">Access control flags.</param>
 public static void SetComputeImage(byte stage, Uniform sampler, FrameBuffer frameBuffer, byte attachment, ComputeBufferAccess access, TextureFormat format = TextureFormat.Unknown)
 {
     NativeMethods.bgfx_set_image_from_frame_buffer(stage, sampler.handle, frameBuffer.handle, attachment, format, access);
 }
コード例 #7
0
ファイル: Bgfx.cs プロジェクト: zachlungu/SharpBgfx
 /// <summary>
 /// Sets a texture to use for drawing primitives.
 /// </summary>
 /// <param name="textureUnit">The texture unit to set.</param>
 /// <param name="sampler">The sampler uniform.</param>
 /// <param name="frameBuffer">The frame buffer.</param>
 /// <param name="attachment">The index of the attachment to set.</param>
 /// <param name="flags">Sampling flags that override the default flags in the texture itself.</param>
 public static void SetTexture(byte textureUnit, Uniform sampler, FrameBuffer frameBuffer, byte attachment, TextureFlags flags)
 {
     NativeMethods.bgfx_set_texture_from_frame_buffer(textureUnit, sampler.handle, frameBuffer.handle, attachment, (uint)flags);
 }
コード例 #8
0
ファイル: Bgfx.cs プロジェクト: zachlungu/SharpBgfx
 /// <summary>
 /// Sets a texture to use for drawing primitives.
 /// </summary>
 /// <param name="textureUnit">The texture unit to set.</param>
 /// <param name="sampler">The sampler uniform.</param>
 /// <param name="frameBuffer">The frame buffer.</param>
 /// <param name="attachment">The index of the frame buffer attachment to set as a texture.</param>
 public static void SetTexture(byte textureUnit, Uniform sampler, FrameBuffer frameBuffer, byte attachment = 0)
 {
     NativeMethods.bgfx_set_texture_from_frame_buffer(textureUnit, sampler.handle, frameBuffer.handle, attachment, uint.MaxValue);
 }
コード例 #9
0
ファイル: FrameBuffer.cs プロジェクト: xxami/Pulsus
 public FrameBuffer(int width, int height, TextureFlags flags = TextureFlags.None, TextureFormat format = TextureFormat.BGRA8)
 {
     handle = new SharpBgfx.FrameBuffer(width, height, format, flags);
 }