From 5ed4708034a84f29d96a4fa086a819725b9e7566 Mon Sep 17 00:00:00 2001 From: makc Date: Thu, 29 Nov 2012 21:26:03 +0100 Subject: [PATCH] + minor queue optimization + reordered parseAsync params to group them logically --- src/alternativa/engine3d/loaders/ParserCollada.as | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/alternativa/engine3d/loaders/ParserCollada.as b/src/alternativa/engine3d/loaders/ParserCollada.as index ab9eb0b..e112b78 100644 --- a/src/alternativa/engine3d/loaders/ParserCollada.as +++ b/src/alternativa/engine3d/loaders/ParserCollada.as @@ -89,8 +89,8 @@ package alternativa.engine3d.loaders { * If you need to download textures, use class TexturesLoader. *

Path to collada file should match with URI specification. E.g., file:///C:/test.dae or /C:/test.dae for the full paths and test.dae, ./test.dae in case of relative.

* - * @param data XML data type of collada. * @param onComplete Callback function accepting ParserCollada object as its argument. + * @param data XML data type of collada. * @param baseURL Path to textures relative to swf-file (Or file name only in case of trimPaths=true). * @param trimPaths Use file names only, without paths. * @@ -99,7 +99,7 @@ package alternativa.engine3d.loaders { * @see #hierarchy * @see #materials */ - public function parseAsync(data:XML, onComplete:Function, baseURL:String = null, trimPaths:Boolean = false):void { + public function parseAsync(onComplete:Function, data:XML, baseURL:String = null, trimPaths:Boolean = false):void { init(); var document:DaeDocument = new DaeDocument(data, 0); @@ -220,12 +220,17 @@ package alternativa.engine3d.loaders { private var queue:Vector. = new Vector. (); private function addNodesToQueue(nodes:Vector., parent:Object3D, skinsOnly:Boolean):void { + for (var j:int = 0; j < queue.length; j++) { + if (queue[j].element is DaeNode) { + break; + } + } for (var i:int = nodes.length; i > 0; i--) { var args:QueueElement = new QueueElement; args.element = nodes[i - 1]; args.parent = parent; args.skinsOnly = skinsOnly; - queue.unshift(args); + queue.splice(j, 0, args); } }