update MoonWorks

main
cosmonaut 2021-11-14 21:50:26 -08:00
parent 96786ef188
commit ff612f5f15
4 changed files with 17 additions and 9 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
<RootNamespace>MoonWorksTest</RootNamespace>
<Platforms>x64</Platforms>

@ -1 +1 @@
Subproject commit 9e4007f9f0723951b5533ee069b71cf82b0e8c7d
Subproject commit 9df9aaeb3a7f99ef4f269437f2e32ef6e0daab47

Binary file not shown.

View File

@ -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();