more toon testing

pull/1/head
cosmonaut 2020-10-05 15:45:43 -07:00
parent e29d9904ab
commit ed6a6a893a
5 changed files with 32 additions and 3 deletions

2
Kav

@ -1 +1 @@
Subproject commit a914c586b2b01dc2d103551365a9025326e77e3e Subproject commit 1f10698811a57b11d343dee62a47ec1b5610b626

View File

@ -0,0 +1,15 @@
using Encompass;
using Microsoft.Xna.Framework;
namespace KavTest
{
public struct ContinuousRotationComponent : IComponent
{
public Quaternion Quaternion { get; }
public ContinuousRotationComponent(Vector3 axis, float angle)
{
Quaternion = Quaternion.CreateFromAxisAngle(axis, angle);
}
}
}

View File

@ -5,7 +5,7 @@ using Microsoft.Xna.Framework;
namespace KavTest.Engines namespace KavTest.Engines
{ {
[Reads(typeof(AngularVelocityComponent))] [Reads(typeof(AngularVelocityComponent), typeof(ContinuousRotationComponent))]
[Sends(typeof(LocalRotationMessage))] [Sends(typeof(LocalRotationMessage))]
public class AngularVelocityEngine : Engine public class AngularVelocityEngine : Engine
{ {
@ -18,6 +18,12 @@ namespace KavTest.Engines
SendMessage(new LocalRotationMessage(entity, Quaternion.CreateFromYawPitchRoll(angularVelocity.X, angularVelocity.Y, angularVelocity.Z))); SendMessage(new LocalRotationMessage(entity, Quaternion.CreateFromYawPitchRoll(angularVelocity.X, angularVelocity.Y, angularVelocity.Z)));
} }
foreach (var entity in ReadEntities<ContinuousRotationComponent>())
{
ref readonly var rotationComponent = ref GetComponent<ContinuousRotationComponent>(entity);
SendMessage(new LocalRotationMessage(entity, rotationComponent.Quaternion));
}
} }
} }
} }

View File

@ -13,6 +13,8 @@ namespace KavTest.Spawners
AddComponent(entity, new Transform3DComponent(new Transform3D(Vector3.Zero, message.Orientation))); AddComponent(entity, new Transform3DComponent(new Transform3D(Vector3.Zero, message.Orientation)));
AddComponent(entity, new DirectionalLightComponent(message.Color, message.Intensity)); AddComponent(entity, new DirectionalLightComponent(message.Color, message.Intensity));
var forward = Matrix.CreateFromQuaternion(message.Orientation).Forward;
AddComponent(entity, new ContinuousRotationComponent(forward, 0.01f));
} }
} }
} }

View File

@ -57,7 +57,10 @@ namespace KavTest
); );
rustyBallModel.DisableNormalMaps(); rustyBallModel.DisableNormalMaps();
rustyBallModel.DisableAlbedoMaps(); rustyBallModel.DisableAlbedoMaps();
rustyBallModel.DisableMetallicRoughnessMaps();
rustyBallModel.Albedo = Color.DeepSkyBlue; rustyBallModel.Albedo = Color.DeepSkyBlue;
rustyBallModel.Metallic = 0.5f;
rustyBallModel.Roughness = 0.284f;
var lightBulbModel = Kav.ModelLoader.Load( var lightBulbModel = Kav.ModelLoader.Load(
GraphicsDevice, GraphicsDevice,
@ -68,6 +71,8 @@ namespace KavTest
GraphicsDevice, GraphicsDevice,
Smuggler.Importer.ImportGLB(GraphicsDevice, File.OpenRead("Content/floor.glb")) Smuggler.Importer.ImportGLB(GraphicsDevice, File.OpenRead("Content/floor.glb"))
); );
floorModel.Metallic = 0f;
floorModel.Roughness = 0f;
var avocadoModel = Kav.ModelLoader.Load( var avocadoModel = Kav.ModelLoader.Load(
GraphicsDevice, GraphicsDevice,
@ -185,7 +190,8 @@ namespace KavTest
)); ));
WorldBuilder.SendMessage(new DirectionalLightSpawnMessage( WorldBuilder.SendMessage(new DirectionalLightSpawnMessage(
Quaternion.CreateFromAxisAngle(Vector3.Right, Microsoft.Xna.Framework.MathHelper.Pi / 3f), //Quaternion.CreateFromAxisAngle(Vector3.Right, Microsoft.Xna.Framework.MathHelper.Pi / 3f),
Quaternion.CreateFromAxisAngle(Vector3.Right, Microsoft.Xna.Framework.MathHelper.PiOver4),
Color.LightGoldenrodYellow, Color.LightGoldenrodYellow,
0.7f 0.7f
)); ));