// 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
Original issue reported on code.google.com by
michaelh...@gmail.com
on 8 Dec 2010 at 11:43