Garrett Johnson 6 năm trước cách đây
mục cha
commit
4a683e26a8
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      examples/js/loaders/LDrawLoader.js

+ 6 - 0
examples/js/loaders/LDrawLoader.js

@@ -317,6 +317,12 @@ THREE.LDrawLoader = ( function () {
 
 					} else {
 
+						// Once the previous subobject has finished we can start processing the next one in the list.
+						// The subobject processing shares scope in processing so it's important that they be loaded serially
+						// to avoid race conditions.
+						// Promise.resolve is used as an approach to asynchronously schedule a task _before_ this frame ends to
+						// avoid stack overflow exceptions when loading many subobjects from the cache. RequestAnimationFrame
+						// will work but causes the load to happen after the next frame which causes the load to take significantly longer.
 						var subobject = parseScope.subobjects[ parseScope.subobjectIndex ];
 						Promise.resolve().then( function () {