vipnj / as3dmod

Automatically exported from code.google.com/p/as3dmod
0 stars 0 forks source link

File Update for Latest Away3D #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
// converted the usage of arrays into vectors.

package com.as3dmod.plugins.away3d {
    import away3d.core.base.Face;
    import away3d.core.base.Mesh;
    import away3d.core.base.Vertex;

    import com.as3dmod.core.FaceProxy;
    import com.as3dmod.core.MeshProxy;
    import com.as3dmod.core.Vector3;

    import flash.utils.Dictionary;

    public class Away3dMesh extends MeshProxy {

        private var awm:Mesh;

        override public function setMesh(mesh:*):void {
            awm = mesh as Mesh;

            var lookUp : Dictionary = new Dictionary(true);
            var vs:Vector.<Vertex> = awm.vertices;
            var vc:int = vs.length;
            var ts:Vector.<Face> = awm.faces;
            var tc:int = ts.length;

            for (var i:int = 0; i < vc; i++) {
                var nv:Away3dVertex = new Away3dVertex();
                nv.setVertex(vs[i]);
                vertices.push(nv);
                lookUp[vs[i]] = nv;
            }

            for (i = 0; i < tc; i++) {
                var nt:FaceProxy = new FaceProxy();
                nt.addVertex(lookUp[ts[i].vertices[0]]);
                nt.addVertex(lookUp[ts[i].vertices[1]]);
                nt.addVertex(lookUp[ts[i].vertices[2]]);
                faces.push(nt);
            }
        }

        override public function updateMeshPosition(p:Vector3):void {
            awm.x += p.x;
            awm.y += p.y;
            awm.z += p.z;
        }
    }
}

Original issue reported on code.google.com by michaelh...@gmail.com on 8 Dec 2010 at 11:43

GoogleCodeExporter commented 9 years ago
Is this the file from 
http://groups.google.com/group/away3d-dev/browse_frm/thread/1daaffb179461f8f ?

Original comment by makc.the...@gmail.com on 22 Dec 2010 at 8:50