optimized static entities + initial depth
parent
867d4d7f5d
commit
6833ad5a24
|
@ -239,7 +239,7 @@
|
||||||
"label": "Run: Framework Debug",
|
"label": "Run: Framework Debug",
|
||||||
"command": "KavTest.exe",
|
"command": "KavTest.exe",
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "${workspaceFolder}/KavTest/bin/Debug/net48"
|
"cwd": "${workspaceFolder}/KavTest/bin/x64/Debug/net48"
|
||||||
},
|
},
|
||||||
"type": "process",
|
"type": "process",
|
||||||
"group": {
|
"group": {
|
||||||
|
@ -282,7 +282,7 @@
|
||||||
"label": "Run: Framework Release",
|
"label": "Run: Framework Release",
|
||||||
"command": "KavTest.exe",
|
"command": "KavTest.exe",
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "${workspaceFolder}/KavTest/bin/Release/net48"
|
"cwd": "${workspaceFolder}/KavTest/bin/x64/Release/net48"
|
||||||
},
|
},
|
||||||
"type": "process",
|
"type": "process",
|
||||||
"group": {
|
"group": {
|
||||||
|
|
2
Kav
2
Kav
|
@ -1 +1 @@
|
||||||
Subproject commit bb694d3dbe47dcfcee6bfe3fb315587419ba8c0f
|
Subproject commit fe222e266ffc296ffacbed82dccecedb45204537
|
|
@ -0,0 +1,9 @@
|
||||||
|
using Encompass;
|
||||||
|
|
||||||
|
namespace KavTest.Components
|
||||||
|
{
|
||||||
|
public struct StaticComponent : IComponent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,11 +12,13 @@ namespace KavTest.Engines
|
||||||
typeof(LocalRotationMessage)
|
typeof(LocalRotationMessage)
|
||||||
)]
|
)]
|
||||||
[Writes(typeof(Transform3DComponent))]
|
[Writes(typeof(Transform3DComponent))]
|
||||||
|
[QueryWith(typeof(Transform3DComponent))]
|
||||||
|
[QueryWithout(typeof(StaticComponent))]
|
||||||
public class MotionEngine : Engine
|
public class MotionEngine : Engine
|
||||||
{
|
{
|
||||||
public override void Update(double dt)
|
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);
|
ref readonly var transformComponent = ref GetComponent<Transform3DComponent>(entity);
|
||||||
|
|
||||||
|
|
|
@ -256,6 +256,7 @@ namespace KavTest
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
WorldBuilder.SetComponent(entity, new InstancedCubeComponent());
|
WorldBuilder.SetComponent(entity, new InstancedCubeComponent());
|
||||||
|
WorldBuilder.SetComponent(entity, new StaticComponent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"KavTest.Framework": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"environmentVariables": {
|
||||||
|
"FNA3D_FORCE_DRIVER": "Vulkan"
|
||||||
|
},
|
||||||
|
"nativeDebugging": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -182,7 +182,9 @@ namespace KavTest.Renderers
|
||||||
renderDimensionsY,
|
renderDimensionsY,
|
||||||
false,
|
false,
|
||||||
SurfaceFormat.Vector4,
|
SurfaceFormat.Vector4,
|
||||||
DepthFormat.Depth24
|
DepthFormat.Depth24,
|
||||||
|
0,
|
||||||
|
RenderTargetUsage.PreserveContents
|
||||||
);
|
);
|
||||||
|
|
||||||
GNormal = new RenderTarget2D(
|
GNormal = new RenderTarget2D(
|
||||||
|
@ -242,6 +244,9 @@ namespace KavTest.Renderers
|
||||||
|
|
||||||
GraphicsDevice.SetRenderTargets(GBuffer);
|
GraphicsDevice.SetRenderTargets(GBuffer);
|
||||||
GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1f, 0);
|
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;
|
GraphicsDevice.DepthStencilState = DepthStencilState.Default;
|
||||||
|
|
||||||
// Renderer.GBufferRender(
|
// Renderer.GBufferRender(
|
||||||
|
@ -252,20 +257,17 @@ namespace KavTest.Renderers
|
||||||
|
|
||||||
Renderer.InstancedGBufferRender(
|
Renderer.InstancedGBufferRender(
|
||||||
GBuffer,
|
GBuffer,
|
||||||
|
DeferredTarget,
|
||||||
camera,
|
camera,
|
||||||
InstancedModelContainer.CubeModel,
|
InstancedModelContainer.CubeModel,
|
||||||
CubeTransforms
|
CubeTransforms
|
||||||
);
|
);
|
||||||
|
|
||||||
GraphicsDevice.SetRenderTarget(DeferredTarget);
|
//Renderer.DepthRender(
|
||||||
GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1f, 0);
|
// DeferredTarget,
|
||||||
GraphicsDevice.DepthStencilState = DepthStencilState.Default;
|
// camera,
|
||||||
|
// ModelTransforms
|
||||||
Renderer.DepthRender(
|
//);
|
||||||
DeferredTarget,
|
|
||||||
camera,
|
|
||||||
ModelTransforms
|
|
||||||
);
|
|
||||||
|
|
||||||
Renderer.AmbientLightRender(
|
Renderer.AmbientLightRender(
|
||||||
DeferredTarget,
|
DeferredTarget,
|
||||||
|
@ -313,9 +315,8 @@ namespace KavTest.Renderers
|
||||||
);
|
);
|
||||||
|
|
||||||
Renderer.MeshSpriteRender(
|
Renderer.MeshSpriteRender(
|
||||||
BillboardTarget,
|
DeferredTarget,
|
||||||
camera,
|
camera,
|
||||||
ModelTransforms,
|
|
||||||
MeshSpriteTransforms(),
|
MeshSpriteTransforms(),
|
||||||
AmbientLight,
|
AmbientLight,
|
||||||
PointLights,
|
PointLights,
|
||||||
|
@ -325,7 +326,7 @@ namespace KavTest.Renderers
|
||||||
GraphicsDevice.SetRenderTarget(null);
|
GraphicsDevice.SetRenderTarget(null);
|
||||||
SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null);
|
SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null);
|
||||||
SpriteBatch.Draw(DeferredTarget, Vector2.Zero, Color.White);
|
SpriteBatch.Draw(DeferredTarget, Vector2.Zero, Color.White);
|
||||||
SpriteBatch.Draw(BillboardTarget, Vector2.Zero, Color.White);
|
//SpriteBatch.Draw(BillboardTarget, Vector2.Zero, Color.White);
|
||||||
SpriteBatch.End();
|
SpriteBatch.End();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue