optimized static entities + initial depth

main
cosmonaut 2020-12-07 18:47:44 -08:00
parent 867d4d7f5d
commit 6833ad5a24
7 changed files with 41 additions and 17 deletions

4
.vscode/tasks.json vendored
View File

@ -239,7 +239,7 @@
"label": "Run: Framework Debug",
"command": "KavTest.exe",
"options": {
"cwd": "${workspaceFolder}/KavTest/bin/Debug/net48"
"cwd": "${workspaceFolder}/KavTest/bin/x64/Debug/net48"
},
"type": "process",
"group": {
@ -282,7 +282,7 @@
"label": "Run: Framework Release",
"command": "KavTest.exe",
"options": {
"cwd": "${workspaceFolder}/KavTest/bin/Release/net48"
"cwd": "${workspaceFolder}/KavTest/bin/x64/Release/net48"
},
"type": "process",
"group": {

2
Kav

@ -1 +1 @@
Subproject commit bb694d3dbe47dcfcee6bfe3fb315587419ba8c0f
Subproject commit fe222e266ffc296ffacbed82dccecedb45204537

View File

@ -0,0 +1,9 @@
using Encompass;
namespace KavTest.Components
{
public struct StaticComponent : IComponent
{
}
}

View File

@ -12,11 +12,13 @@ namespace KavTest.Engines
typeof(LocalRotationMessage)
)]
[Writes(typeof(Transform3DComponent))]
[QueryWith(typeof(Transform3DComponent))]
[QueryWithout(typeof(StaticComponent))]
public class MotionEngine : Engine
{
public override void Update(double dt)
{
foreach (var entity in ReadEntities<Transform3DComponent>())
foreach (var entity in TrackedEntities)
{
ref readonly var transformComponent = ref GetComponent<Transform3DComponent>(entity);

View File

@ -256,6 +256,7 @@ namespace KavTest
)
));
WorldBuilder.SetComponent(entity, new InstancedCubeComponent());
WorldBuilder.SetComponent(entity, new StaticComponent());
}
}
}

View File

@ -0,0 +1,11 @@
{
"profiles": {
"KavTest.Framework": {
"commandName": "Project",
"environmentVariables": {
"FNA3D_FORCE_DRIVER": "Vulkan"
},
"nativeDebugging": true
}
}
}

View File

@ -182,7 +182,9 @@ namespace KavTest.Renderers
renderDimensionsY,
false,
SurfaceFormat.Vector4,
DepthFormat.Depth24
DepthFormat.Depth24,
0,
RenderTargetUsage.PreserveContents
);
GNormal = new RenderTarget2D(
@ -242,6 +244,9 @@ namespace KavTest.Renderers
GraphicsDevice.SetRenderTargets(GBuffer);
GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1f, 0);
GraphicsDevice.SetRenderTarget(DeferredTarget);
GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1f, 0);
GraphicsDevice.DepthStencilState = DepthStencilState.Default;
// Renderer.GBufferRender(
@ -252,20 +257,17 @@ namespace KavTest.Renderers
Renderer.InstancedGBufferRender(
GBuffer,
DeferredTarget,
camera,
InstancedModelContainer.CubeModel,
CubeTransforms
);
GraphicsDevice.SetRenderTarget(DeferredTarget);
GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1f, 0);
GraphicsDevice.DepthStencilState = DepthStencilState.Default;
Renderer.DepthRender(
DeferredTarget,
camera,
ModelTransforms
);
//Renderer.DepthRender(
// DeferredTarget,
// camera,
// ModelTransforms
//);
Renderer.AmbientLightRender(
DeferredTarget,
@ -313,9 +315,8 @@ namespace KavTest.Renderers
);
Renderer.MeshSpriteRender(
BillboardTarget,
DeferredTarget,
camera,
ModelTransforms,
MeshSpriteTransforms(),
AmbientLight,
PointLights,
@ -325,7 +326,7 @@ namespace KavTest.Renderers
GraphicsDevice.SetRenderTarget(null);
SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null);
SpriteBatch.Draw(DeferredTarget, Vector2.Zero, Color.White);
SpriteBatch.Draw(BillboardTarget, Vector2.Zero, Color.White);
//SpriteBatch.Draw(BillboardTarget, Vector2.Zero, Color.White);
SpriteBatch.End();
}
}