Skip to content

Commit

Permalink
Improve performance for multiple nested compounds
Browse files Browse the repository at this point in the history
  • Loading branch information
QuirkyCort committed Aug 24, 2023
1 parent fe4344b commit 530ae29
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion public/arena.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
</div>
</main>

<script src="js/worlds/World_Base.js?v=36f6149a"></script>
<script src="js/worlds/World_Base.js?v=32afe8bb"></script>
<script src="js/worlds/world_Grid.js?v=3ed03b45"></script>
<script src="js/worlds/world_Maze.js?v=6571b2a6"></script>
<script src="js/worlds/world_Arena.js?v=c1828281"></script>
Expand Down
2 changes: 1 addition & 1 deletion public/builder.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</div>
</main>

<script src="js/worlds/World_Base.js?v=36f6149a"></script>
<script src="js/worlds/World_Base.js?v=32afe8bb"></script>
<script src="js/worlds/world_Custom.js?v=a56a2eb0"></script>
<script src="js/robotComponents.js?v=70339366"></script>
<script src="js/robotTemplates.js?v=c254ce16"></script>
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
<script src="js/pybricks_generator.js?v=13a33c1a"></script>
<script src="js/blockly.js?v=6f34b31b"></script>
<script src="js/skulpt.js?v=41599f05"></script>
<script src="js/worlds/World_Base.js?v=36f6149a"></script>
<script src="js/worlds/World_Base.js?v=32afe8bb"></script>
<script src="js/worlds/world_Grid.js?v=3ed03b45"></script>
<script src="js/worlds/world_LineFollowing.js?v=8e36de6c"></script>
<script src="js/worlds/world_Gyro.js?v=15f87e04"></script>
Expand Down
10 changes: 8 additions & 2 deletions public/js/worlds/World_Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,13 @@ var World_Base = function() {
}

// Compute all world matrices in order
self.computeAllWorldMatrices(scene.meshes);
let parentlessMeshes = [];
for (let mesh of scene.meshes) {
if (mesh.parent == null) {
parentlessMeshes.push(mesh);
}
}
self.computeAllWorldMatrices(parentlessMeshes);

// Remove designated parents, keeping transform
self.removeParents(self.parentsToRemove);
Expand Down Expand Up @@ -532,7 +538,7 @@ var World_Base = function() {
this.computeAllWorldMatrices = function(meshes) {
for (let mesh of meshes) {
mesh.computeWorldMatrix(true);
let childMeshes = mesh.getChildMeshes();
let childMeshes = mesh.getChildren();
if (childMeshes.length > 0) {
self.computeAllWorldMatrices(childMeshes);
}
Expand Down

0 comments on commit 530ae29

Please sign in to comment.