Skip to content

Commit

Permalink
refactor(transform): deduplicate tag ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
luishfonseca committed Feb 1, 2024
1 parent 7b8cc20 commit 62c3cf4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions engine/src/cubos/engine/transform/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ void cubos::engine::transformPlugin(Cubos& cubos)

cubos.system("add LocalToWorld to entities with Position")
.tagged("cubos.transform.missing.local_to_world")
.before("cubos.transform.missing")
.without<LocalToWorld>()
.with<Position>()
.call([](Commands cmds, Query<Entity> query) {
Expand All @@ -23,7 +22,6 @@ void cubos::engine::transformPlugin(Cubos& cubos)

cubos.system("add LocalToWorld to entities with Rotation")
.tagged("cubos.transform.missing.local_to_world")
.before("cubos.transform.missing")
.without<LocalToWorld>()
.with<Rotation>()
.call([](Commands cmds, Query<Entity> query) {
Expand All @@ -35,7 +33,6 @@ void cubos::engine::transformPlugin(Cubos& cubos)

cubos.system("add LocalToWorld to entities with Scale")
.tagged("cubos.transform.missing.local_to_world")
.before("cubos.transform.missing")
.without<LocalToWorld>()
.with<Scale>()
.call([](Commands cmds, Query<Entity> query) {
Expand All @@ -45,9 +42,10 @@ void cubos::engine::transformPlugin(Cubos& cubos)
}
});

cubos.tag("cubos.transform.missing.local_to_world").before("cubos.transform.missing");

cubos.system("add Position to entities with LocalToWorld")
.tagged("cubos.transform.missing")
.before("cubos.transform.update")
.without<Position>()
.with<LocalToWorld>()
.call([](Commands cmds, Query<Entity> query) {
Expand All @@ -59,7 +57,6 @@ void cubos::engine::transformPlugin(Cubos& cubos)

cubos.system("add Rotation to entities with LocalToWorld")
.tagged("cubos.transform.missing")
.before("cubos.transform.update")
.without<Rotation>()
.with<LocalToWorld>()
.call([](Commands cmds, Query<Entity> query) {
Expand All @@ -71,7 +68,6 @@ void cubos::engine::transformPlugin(Cubos& cubos)

cubos.system("add Scale to entities with LocalToWorld")
.tagged("cubos.transform.missing")
.before("cubos.transform.update")
.without<Scale>()
.with<LocalToWorld>()
.call([](Commands cmds, Query<Entity> query) {
Expand All @@ -81,6 +77,8 @@ void cubos::engine::transformPlugin(Cubos& cubos)
}
});

cubos.tag("cubos.transform.missing").before("cubos.transform.update");

cubos.system("update LocalToWorld")
.tagged("cubos.transform.update")
.call([](Query<Entity, LocalToWorld&, Opt<const Position&>, Opt<const Rotation&>, Opt<const Scale&>> query) {
Expand Down

0 comments on commit 62c3cf4

Please sign in to comment.