shadow goodies

main
cosmonaut 2020-12-08 03:35:34 -08:00
parent ba994797b1
commit 2a2b481eca
3 changed files with 35 additions and 29 deletions

2
Kav

@ -1 +1 @@
Subproject commit 96f6d228966e900a511164a176d1f2ae1f1caaa4 Subproject commit 14e07c74768bb5a1432b27d089de28f1ec5c2710

View File

@ -214,10 +214,14 @@ namespace KavTest
// rustyBallModel // rustyBallModel
// )); // ));
// WorldBuilder.SendMessage(new StaticModelSpawnMessage( WorldBuilder.SendMessage(new StaticModelSpawnMessage(
// new Transform3D(new Vector3(0, -3, 0), Quaternion.Identity, new Vector3(10f, 1f, 10f)), new Transform3D(
// floorModel new Vector3(0, -15, 0),
// )); Quaternion.Identity,
new Vector3(100f, 1f, 100f)
),
floorModel
));
WorldBuilder.SendMessage(new StaticModelSpawnMessage( WorldBuilder.SendMessage(new StaticModelSpawnMessage(
new Transform3D( new Transform3D(
@ -250,7 +254,7 @@ namespace KavTest
var entity = WorldBuilder.CreateEntity(); var entity = WorldBuilder.CreateEntity();
WorldBuilder.SetComponent(entity, new Transform3DComponent( WorldBuilder.SetComponent(entity, new Transform3DComponent(
new Transform3D( new Transform3D(
new Vector3(i * 3, -1, j * 3) new Vector3(i * 5, -1, j * 5)
) )
)); ));
WorldBuilder.SetComponent(entity, new InstancedCubeComponent()); WorldBuilder.SetComponent(entity, new InstancedCubeComponent());
@ -288,17 +292,17 @@ namespace KavTest
// new ModelComponent(cubeModel) // new ModelComponent(cubeModel)
// ); // );
for (var i = 0; i < 1; i++) //for (var i = 0; i < 1; i++)
{ //{
var start = new Vector3(-2, 5, 0); // var start = new Vector3(-2, 5, 0);
WorldBuilder.SendMessage(new LightBulbSpawnMessage( // WorldBuilder.SendMessage(new LightBulbSpawnMessage(
new Transform3D(start, Quaternion.Identity, new Vector3(0.1f, 0.1f, 0.1f)), // new Transform3D(start, Quaternion.Identity, new Vector3(0.1f, 0.1f, 0.1f)),
RandomHelper.RandomColor(), // RandomHelper.RandomColor(),
50f, // 50f,
RandomHelper.RandomLoop(new System.Numerics.Vector3(-2, 5, 0), 2, 5, 3, 10) // RandomHelper.RandomLoop(new System.Numerics.Vector3(-2, 5, 0), 2, 5, 3, 10)
)); // ));
} //}
var ambientLightEntity = WorldBuilder.CreateEntity(); var ambientLightEntity = WorldBuilder.CreateEntity();

View File

@ -260,12 +260,6 @@ namespace KavTest.Renderers
GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1f, 0); GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1f, 0);
GraphicsDevice.DepthStencilState = DepthStencilState.Default; GraphicsDevice.DepthStencilState = DepthStencilState.Default;
// Renderer.GBufferRender(
// GBuffer,
// camera,
// ModelTransforms
// );
Renderer.RenderGBufferInstanced( Renderer.RenderGBufferInstanced(
GBuffer, GBuffer,
DeferredTarget, DeferredTarget,
@ -301,7 +295,7 @@ namespace KavTest.Renderers
GraphicsDevice.Clear(Color.White); GraphicsDevice.Clear(Color.White);
} }
Renderer.RenderPointShadowsIndexed( Renderer.RenderPointShadowMapIndexed(
ShadowCubeMap, ShadowCubeMap,
camera, camera,
MeshPartTransforms, MeshPartTransforms,
@ -326,14 +320,24 @@ namespace KavTest.Renderers
{ {
DirectionalShadowMapData.Clear(GraphicsDevice); DirectionalShadowMapData.Clear(GraphicsDevice);
Renderer.RenderDirectionalShadowsIndexed( Renderer.PrepareDirectionalShadowData(
DirectionalShadowMapData, DirectionalShadowMapData,
camera, camera,
MeshPartTransforms,
directionalLight.Value directionalLight.Value
); );
Renderer.RenderDirectionalLightToon( Renderer.RenderDirectionalShadowsIndexed(
DirectionalShadowMapData,
MeshPartTransforms
);
Renderer.RenderDirectionalShadowsInstanced(
DirectionalShadowMapData,
InstancedModelContainer.CubeModel,
CubeTransforms
);
Renderer.RenderDirectionalLight(
DeferredTarget, DeferredTarget,
GPosition, GPosition,
GAlbedo, GAlbedo,
@ -341,9 +345,7 @@ namespace KavTest.Renderers
GMetallicRoughness, GMetallicRoughness,
DirectionalShadowMapData, DirectionalShadowMapData,
camera, camera,
MeshPartTransforms, directionalLight.Value
directionalLight.Value,
false
); );
} }