Profiler and LocalToWorldThreadedSystem

Added a simple profiler
Testing LocalToWorldSystem with Parallel execution for root nodes
This commit is contained in:
max
2024-10-19 23:41:05 +02:00
parent 6be63195f0
commit 82fe47f627
8 changed files with 434 additions and 17 deletions
+3 -6
View File
@@ -24,11 +24,9 @@ namespace Nerfed.Runtime.Systems
public override void Update(TimeSpan delta)
{
Matrix4x4 rootMatrix = Matrix4x4.Identity;
foreach (Entity entity in rootEntitiesFilter.Entities)
{
UpdateWorldTransform(entity, rootMatrix);
UpdateWorldTransform(entity, Matrix4x4.Identity);
}
}
@@ -37,18 +35,17 @@ namespace Nerfed.Runtime.Systems
// TODO: Only update dirty transforms.
// If a parent is dirty all the children need to update their localToWorld matrix.
// How do we check if something is dirty? How do we know if a LocalTransform has been changed?
if (Has<LocalTransform>(entity))
{
LocalTransform localTransform = Get<LocalTransform>(entity);
localToWorldMatrix = Matrix4x4.Multiply(localToWorldMatrix, localTransform.TRS());
LocalToWorld localToWorld = new(localToWorldMatrix);
Set(entity, localToWorld);
//Task.Delay(10).Wait();
//Log.Info($"Entity {entity} | local position {localTransform.position} | world position {localToWorldMatrix.Translation}");
}
ReverseSpanEnumerator<Entity> childEntities = World.OutRelations<ChildParentRelation>(entity);
ReverseSpanEnumerator<Entity> childEntities = World.InRelations<ChildParentRelation>(entity);
foreach (Entity childEntity in childEntities)
{
UpdateWorldTransform(childEntity, localToWorldMatrix);