Profiler and LocalToWorldThreadedSystem
Added a simple profiler Testing LocalToWorldSystem with Parallel execution for root nodes
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user