My mistake. I was looking at the snippet that was posted, indeed your class doesn't make new ones. good ;)
Fabrice On May 12, 2011, at 1:38 PM, rjgtav wrote: > @Fabrice > Hi. Did you check my example? I only create 1 cube of each type before > the loop and then, in each iteraction, i only move it to the new > position and merge to the container. Or that also creates a new cube? > > On 12 Maio, 11:53, Fabrice3D <[email protected]> wrote: >> just uploaded an update that should speed up containers feeds. >> >> where it was doing >> >> loop >> parse >> merge >> >> it now does >> >> loop >> parse & collect data >> >> merge >> >> It does not speed up a single merging of two objects. >> It prevents a parsing*n loops for reciever object and all the vectors/var >> generation >> which can be pretty significant boost. >> >> looking now at the massive meshes issue. >> >> @rjgtav >> Even if the above update will probably speed up your case, I think >> generating new cubes >> each iteration is not the way to go... >> >> Fabrice >> >> On May 12, 2011, at 1:02 AM, John Brookes wrote: >> >>> Works if you just use an objectcontainer3D and add wall,floor cubes to that >>> and then after the for loop merge that objectcontainer and add to the scene. >> >>> eg >> >>> var _merger:Merge= new Merge(false, true, true); >>> var obj:ObjectContainer3D = new ObjectContainer3D(); >> >>> for (var py:uint = 0; py < _map.length; py++) { >>> for (var pz:uint = 0; pz < _map[py].length; pz++ ) { >>> for (var px:uint = 0; px < _map[py][pz].length; px++ ) { >>> switch(_map[py][pz][px]) { >>> case 1://FLOOR >>> var floorCube:Cube = new Cube(floorMaterial, CUBESIZE, CUBESIZE, CUBESIZE); >>> floorCube.moveTo(CUBESIZE * px, CUBESIZE * py, CUBESIZE * pz); >>> obj.addChild(floorCube); >> >>> break; >>> case 2://WALL >>> var wallCube:Cube = new Cube(wallMaterial, CUBESIZE, CUBESIZE, CUBESIZE); >>> wallCube.moveTo(CUBESIZE * px, CUBESIZE * py, CUBESIZE * pz); >>> obj.addChild(wallCube); >>> break; >>> } >>> } >>> } >>> } >>> _view.scene.addChild(_merger.applyToContainer(obj));
