dam, now you know the secret! :)
17 sg fulled up to neck instead of 9708 is indeed why it runs that well.
the trick is simply to offset the vertice count by the amount of cube vertices.
in speudo you will have first if you want to later vertices of a cube
representation
to
1 isolate the sb, a floor %64998
2 diif to count from geo target
3 alter the vertices
4 update all the sg's
Fabrice
On May 12, 2011, at 6:58 PM, John Brookes wrote:
> I see how you do it.
> Was expecting 9708 subgeometries basically one for each cube. But its 17
> subG, each subG being filled to a max of 64998
> Which makes moving 1 cube after merge much more fun.
>
> whcih brings me to...
>
> Confused on vertexdata length
>
> What I understand :0
>
> Basically if keepMaterial is true a new subgeometry is created for each cube.
>
> eg
> var merge:Merge = new Merge(false, false, true);
> var cont:ObjectContainer3D = new ObjectContainer3D();
> for (var i:int = 0; i < 100; i++)
> {
> var c1:Cube = new Cube(new ColorMaterial(0xff0000),5,5,5);
> c1.x = i*5
> cont.addChild(c1)
>
> var newmesh:Mesh = merge.applyToContainer(cont, "cubes")
> scene.addChild(newmesh);
>
> trace(newmesh.subMeshes.length); //traces 100
>
> So later its easy to do something like
>
> newmesh.subMeshes[15].vertexData //the vertices of the 15th cube
>
>
>
> Now the tricky bit (single material)
>
> var merge:Merge = new Merge(false, true, true);
> var cont:ObjectContainer3D = new ObjectContainer3D();
> var mat:ColorMaterial = new ColorMaterial(0xff0000);
> for (var i:int = 0; i < 100; i++)
> {
> var c1:Cube = new Cube(mat,5,5,5);
> c1.x = i*5
> cont.addChild(c1)
> }
>
> var newmesh:Mesh = merge.applyToContainer(cont, "twocubes")
> scene.addChild(newmesh);
>
> trace(newmesh.subMeshes.length); //traces 1
>
> var vNum:Number = newmesh.geometry.subGeometries[0].vertexData.length
> // a single cubes vertexdata.length is 72
> trace(vNum); // traces 10764
>
> Cant work out how 10764 applies to 100 cubes?