started work on toon shader

pull/1/head
cosmonaut 2020-10-01 14:53:15 -07:00
parent b02d9efcd2
commit 754706f365
4 changed files with 46 additions and 3 deletions

2
Kav

@ -1 +1 @@
Subproject commit 66d4e5bf6e78949f6e5b2fc9eb1983d438047f0b Subproject commit 565be374bbb539ee652d0fa3b240bafb066bab18

View File

@ -0,0 +1,15 @@
using Encompass;
using Microsoft.Xna.Framework;
namespace KavTest.Components
{
public struct AmbientLightComponent : IComponent
{
public Color Color { get; }
public AmbientLightComponent(Color color)
{
Color = color;
}
}
}

View File

@ -122,6 +122,12 @@ namespace KavTest
)); ));
} }
var ambientLightEntity = WorldBuilder.CreateEntity();
WorldBuilder.SetComponent(ambientLightEntity, new AmbientLightComponent(
new Color(0.3f, 0.3f, 0.3f)
));
WorldBuilder.SendMessage(new DirectionalLightSpawnMessage( WorldBuilder.SendMessage(new DirectionalLightSpawnMessage(
Quaternion.CreateFromAxisAngle(Vector3.Right, Microsoft.Xna.Framework.MathHelper.PiOver4), Quaternion.CreateFromAxisAngle(Vector3.Right, Microsoft.Xna.Framework.MathHelper.PiOver4),
Color.LightGoldenrodYellow, Color.LightGoldenrodYellow,

View File

@ -42,6 +42,21 @@ namespace KavTest.Renderers
} }
} }
private AmbientLight AmbientLight
{
get
{
if (SomeComponent<AmbientLightComponent>())
{
return new AmbientLight(ReadComponent<AmbientLightComponent>().Color);
}
else
{
return new AmbientLight(Color.Black);
}
}
}
private IEnumerable<PointLight> PointLights private IEnumerable<PointLight> PointLights
{ {
get get
@ -118,10 +133,17 @@ namespace KavTest.Renderers
// ); // );
// } // }
Renderer.DeferredRender( // Renderer.DeferredRender(
// camera,
// ModelTransforms,
// PointLights,
// DirectionalLight()
// );
Renderer.DeferredToonRender(
camera, camera,
ModelTransforms, ModelTransforms,
PointLights, AmbientLight,
DirectionalLight() DirectionalLight()
); );