diff --git a/MoonWorksTest.csproj b/MoonWorksTest.csproj index 90fcbee..44bbf1b 100644 --- a/MoonWorksTest.csproj +++ b/MoonWorksTest.csproj @@ -1,7 +1,7 @@ - net461 + net5.0 Exe MoonWorksTest x64 diff --git a/lib/MoonWorks b/lib/MoonWorks index 9e4007f..9df9aae 160000 --- a/lib/MoonWorks +++ b/lib/MoonWorks @@ -1 +1 @@ -Subproject commit 9e4007f9f0723951b5533ee069b71cf82b0e8c7d +Subproject commit 9df9aaeb3a7f99ef4f269437f2e32ef6e0daab47 diff --git a/moonlibs/windows/Refresh.dll b/moonlibs/windows/Refresh.dll index a7a3c38..34a0bf7 100644 Binary files a/moonlibs/windows/Refresh.dll and b/moonlibs/windows/Refresh.dll differ diff --git a/src/TestGame.cs b/src/TestGame.cs index 3ca950c..999949c 100644 --- a/src/TestGame.cs +++ b/src/TestGame.cs @@ -23,6 +23,7 @@ namespace MoonWorksTest Rect renderArea; Rect flip; Color clearColor; + DepthStencilValue depthStencilClear; Texture mainColorTargetTexture; TextureSlice mainColorTargetTextureSlice; @@ -54,8 +55,12 @@ namespace MoonWorksTest raymarchUniforms.resolutionX = windowWidth; raymarchUniforms.resolutionY = windowHeight; - woodTexture = Texture.LoadPNG(GraphicsDevice, "Content/woodgrain.png"); - noiseTexture = Texture.LoadPNG(GraphicsDevice, "Content/noise.png"); + var textureCommandBuffer = GraphicsDevice.AcquireCommandBuffer(); + + woodTexture = Texture.LoadPNG(GraphicsDevice, textureCommandBuffer, "Content/woodgrain.png"); + noiseTexture = Texture.LoadPNG(GraphicsDevice, textureCommandBuffer, "Content/noise.png"); + + GraphicsDevice.Submit(textureCommandBuffer); sampler = new Sampler(GraphicsDevice, SamplerCreateInfo.LinearWrap); @@ -268,12 +273,12 @@ namespace MoonWorksTest musicStream.Play(); } - protected override void Update(double dt) + protected override void Update(System.TimeSpan dt) { - raymarchUniforms.time += (float) dt; + raymarchUniforms.time += (float)dt.TotalSeconds; } - protected override void Draw(double dt, double alpha) + protected override void Draw(System.TimeSpan dt, double alpha) { var screenshotPressed = Inputs.Keyboard.IsPressed(Keycode.S); @@ -283,16 +288,19 @@ namespace MoonWorksTest mainRenderPass, mainFramebuffer, renderArea, - clearColor + depthStencilClear, + clearColor.ToVector4() ); commandBuffer.BindGraphicsPipeline(mainGraphicsPipeline); - var fragmentParamOffset = commandBuffer.PushFragmentShaderParams(raymarchUniforms); + commandBuffer.BindVertexBuffers(0, new BufferBinding(vertexBuffer, 0)); commandBuffer.BindFragmentSamplers( new TextureSamplerBinding(woodTexture, sampler), new TextureSamplerBinding(noiseTexture, sampler) ); + + var fragmentParamOffset = mainGraphicsPipeline.PushFragmentShaderUniforms(raymarchUniforms); commandBuffer.DrawPrimitives(0, 1, 0, fragmentParamOffset); commandBuffer.EndRenderPass();