diff --git a/src/Bliss.Test/Game.cs b/src/Bliss.Test/Game.cs index 3b6cd77..6c4d940 100644 --- a/src/Bliss.Test/Game.cs +++ b/src/Bliss.Test/Game.cs @@ -109,7 +109,7 @@ protected virtual void FixedUpdate() { } protected virtual void Draw(GraphicsDevice graphicsDevice, CommandList commandList) { this.CommandList.Begin(); - this.CommandList.SetFramebuffer(this.GraphicsDevice.SwapchainFramebuffer); + this.CommandList.SetFramebuffer(graphicsDevice.SwapchainFramebuffer); this.CommandList.ClearColorTarget(0, Color.DarkGray.ToRgbaFloat()); this._spriteBatch.Begin(commandList); @@ -119,13 +119,13 @@ protected virtual void Draw(GraphicsDevice graphicsDevice, CommandList commandLi int textSize = 36; string text = "This is my first FONT!!!"; Vector2 measureTextSize = this._font.MeasureText(text, textSize); - this._spriteBatch.DrawText(this._font, text, new Vector2(this.Window.Width / 2.0F - (measureTextSize.X / 2.0F), this.Window.Height / 1.25F - (measureTextSize.Y / 2.0F)), textSize, rotation: 0); + this._spriteBatch.DrawText(this._font, text, new Vector2(this.Window.Width / 2.0F - (measureTextSize.X / 2.0F), this.Window.Height / 2.25F - (measureTextSize.Y / 2.0F)), textSize); this._spriteBatch.End(); this.CommandList.End(); - this.GraphicsDevice.SubmitCommands(this.CommandList); - this.GraphicsDevice.SwapBuffers(); + graphicsDevice.SubmitCommands(this.CommandList); + graphicsDevice.SwapBuffers(); } protected virtual void OnClose() { } diff --git a/src/Bliss/CSharp/Geometry/Vertex3D.cs b/src/Bliss/CSharp/Geometry/Vertex3D.cs index c1cdd70..6d81afb 100644 --- a/src/Bliss/CSharp/Geometry/Vertex3D.cs +++ b/src/Bliss/CSharp/Geometry/Vertex3D.cs @@ -1,9 +1,10 @@ using System.Numerics; +using System.Runtime.InteropServices; using Bliss.CSharp.Colors; -using Veldrid; namespace Bliss.CSharp.Geometry; +[StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Vertex3D { // TODO: Add VertexLayout like Vertex2D. diff --git a/src/Bliss/CSharp/Graphics/Rendering/Sprites/SpriteBatch.cs b/src/Bliss/CSharp/Graphics/Rendering/Sprites/SpriteBatch.cs index a95a034..823011b 100644 --- a/src/Bliss/CSharp/Graphics/Rendering/Sprites/SpriteBatch.cs +++ b/src/Bliss/CSharp/Graphics/Rendering/Sprites/SpriteBatch.cs @@ -155,6 +155,7 @@ public void End() { } this._begun = false; + this.Flush(); } // TODO: Add Methods like: BeginShaderMode (Replace the Pipeline system), BeginBlendMode(), BeginScissorMode. @@ -206,7 +207,7 @@ public void DrawTexture(Texture2D texture, SamplerType samplerType, Vector2 posi Sampler sampler = GraphicsHelper.GetSampler(this.GraphicsDevice, samplerType); - if (this._currentTexture != texture || this._currentSampler != sampler) { // TODO: FIX SORTING (Without the if check it would work but check it pls!) + if (this._currentTexture != texture || this._currentSampler != sampler) { this.Flush(); } diff --git a/src/Bliss/CSharp/Textures/Texture2D.cs b/src/Bliss/CSharp/Textures/Texture2D.cs index 2ddf7f7..e3213b7 100644 --- a/src/Bliss/CSharp/Textures/Texture2D.cs +++ b/src/Bliss/CSharp/Textures/Texture2D.cs @@ -1,5 +1,4 @@ using System.Runtime.InteropServices; -using Bliss.CSharp.Logging; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; using Veldrid; @@ -120,6 +119,8 @@ public unsafe void UpdateData(ReadOnlySpan data, Rectangle? rectangle = nu /// The graphics device on which to create the texture. private unsafe Texture CreateDeviceTexture(GraphicsDevice graphicsDevice) { // TODO: DO MSSA: this.GraphicsDevice.GetSampleCountLimit(this.Format, false); + //Texture multiSampledTexture = graphicsDevice.ResourceFactory.CreateTexture(TextureDescription.Texture2D(this.Width, Height, 1, 1, this.Format, TextureUsage.RenderTarget, TextureSampleCount.Count8)); + //Framebuffer framebuffer = graphicsDevice.ResourceFactory.CreateFramebuffer(new FramebufferDescription(null, multiSampledTexture)); Texture texture = graphicsDevice.ResourceFactory.CreateTexture(TextureDescription.Texture2D(this.Width, this.Height, this.MipLevels, 1, this.Format, TextureUsage.Sampled));