diff --git a/Kav b/Kav index a914c58..1f10698 160000 --- a/Kav +++ b/Kav @@ -1 +1 @@ -Subproject commit a914c586b2b01dc2d103551365a9025326e77e3e +Subproject commit 1f10698811a57b11d343dee62a47ec1b5610b626 diff --git a/KavTest/Components/ContinuousRotationComponent.cs b/KavTest/Components/ContinuousRotationComponent.cs new file mode 100644 index 0000000..647dafc --- /dev/null +++ b/KavTest/Components/ContinuousRotationComponent.cs @@ -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); + } + } +} diff --git a/KavTest/Engines/AngularVelocityEngine.cs b/KavTest/Engines/AngularVelocityEngine.cs index a8ce9fe..66efa09 100644 --- a/KavTest/Engines/AngularVelocityEngine.cs +++ b/KavTest/Engines/AngularVelocityEngine.cs @@ -5,7 +5,7 @@ using Microsoft.Xna.Framework; namespace KavTest.Engines { - [Reads(typeof(AngularVelocityComponent))] + [Reads(typeof(AngularVelocityComponent), typeof(ContinuousRotationComponent))] [Sends(typeof(LocalRotationMessage))] public class AngularVelocityEngine : Engine { @@ -18,6 +18,12 @@ namespace KavTest.Engines SendMessage(new LocalRotationMessage(entity, Quaternion.CreateFromYawPitchRoll(angularVelocity.X, angularVelocity.Y, angularVelocity.Z))); } + + foreach (var entity in ReadEntities()) + { + ref readonly var rotationComponent = ref GetComponent(entity); + SendMessage(new LocalRotationMessage(entity, rotationComponent.Quaternion)); + } } } } diff --git a/KavTest/Engines/Spawners/DirectionalLightSpawner.cs b/KavTest/Engines/Spawners/DirectionalLightSpawner.cs index 04186e8..9a05f2e 100644 --- a/KavTest/Engines/Spawners/DirectionalLightSpawner.cs +++ b/KavTest/Engines/Spawners/DirectionalLightSpawner.cs @@ -13,6 +13,8 @@ namespace KavTest.Spawners AddComponent(entity, new Transform3DComponent(new Transform3D(Vector3.Zero, message.Orientation))); AddComponent(entity, new DirectionalLightComponent(message.Color, message.Intensity)); + var forward = Matrix.CreateFromQuaternion(message.Orientation).Forward; + AddComponent(entity, new ContinuousRotationComponent(forward, 0.01f)); } } } diff --git a/KavTest/KavTestGame.cs b/KavTest/KavTestGame.cs index 1179978..ca6689e 100644 --- a/KavTest/KavTestGame.cs +++ b/KavTest/KavTestGame.cs @@ -57,7 +57,10 @@ namespace KavTest ); rustyBallModel.DisableNormalMaps(); rustyBallModel.DisableAlbedoMaps(); + rustyBallModel.DisableMetallicRoughnessMaps(); rustyBallModel.Albedo = Color.DeepSkyBlue; + rustyBallModel.Metallic = 0.5f; + rustyBallModel.Roughness = 0.284f; var lightBulbModel = Kav.ModelLoader.Load( GraphicsDevice, @@ -68,6 +71,8 @@ namespace KavTest GraphicsDevice, Smuggler.Importer.ImportGLB(GraphicsDevice, File.OpenRead("Content/floor.glb")) ); + floorModel.Metallic = 0f; + floorModel.Roughness = 0f; var avocadoModel = Kav.ModelLoader.Load( GraphicsDevice, @@ -185,7 +190,8 @@ namespace KavTest )); 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, 0.7f ));