, Sr. Member
Well, now Max3DSParser is extended with followings:
1) internal class VertexVO - structured representation of vertex
2) internal class FaceVO - structured representation of face. This object has an “smoothGroup” property!
3) private function parseSmoothingGroups():void - parse binary data of smoothingGroups from 3ds file starting from 0x4150.
4) private function prepareData(vertices:Vector.<VertexVO>, faces:Array, obj:ObjectVO):void - convert data from ObjectVO to separate sets of VertexVO and FaceVO.
5) private function applySmoothGroups(vertices:Vector.<VertexVO>, faces:Array):void - clone vertices according to smoothing groups.
And some native functions and properties are modified a bit:
1) internal class ObjectVO - its properties were extended with “public var smoothingGroups:Vector.<uint>”
2) private function parseFaceList() : void - the following line was added at the end of function: “_cur_obj.smoothingGroups = new Vector.<uint>(count, true);”
3) private function constructObject(obj : ObjectVO, pivot : Vector3D = null) : ObjectContainer3D - smoothing groups were applyed for data before building subgeometries:
var vertices:Vector.<VertexVO> = new Vector.<VertexVO>(obj.verts.length / 3);
var faces:Array = new Array(obj.indices.length / 3);
prepareData(vertices, faces, obj);
applySmoothGroups(vertices, faces);
var i:uint;
obj.verts = new Vector.<Number>(vertices.length * 3, true);
for (i = 0; i < vertices.length; i++) {
obj.verts[i * 3] = vertices[i].x;
obj.verts[i * 3 + 1] = vertices[i].y;
obj.verts[i * 3 + 2] = vertices[i].z;
}
obj.indices = new Vector.<uint>(faces.length * 3, true);
for (i = 0; i < faces.length; i++) {
obj.indices[i * 3] = faces[i].a;
obj.indices[i * 3 + 1] = faces[i].b;
obj.indices[i * 3 + 2] = faces[i].c;
}
obj.uvs = new Vector.<Number>(vertices.length * 2, true);
for (i = 0; i < vertices.length; i++) {
obj.uvs[i * 2] = vertices[i].u;
obj.uvs[i * 2 + 1] = vertices[i].v;
}
Parser works as original Away3D’s Max3DSParser, taking into account smoothing groups. Simply overwrite it in your “away3d.loaders.parsers” folder.