/// <summary> /// Construct a new mesh from an ASE GeomObject /// </summary> /// <param name="obj">ASE GeomObject to read from</param> public Mesh(ASE.GeomObject obj) { children = new List<Node>(); name = obj.name; color = Colors.Random(); polygon = new Polygon(); polygon.Material = null; //Vertices foreach (ASE.Vector3D v in obj.mesh.verticies) polygon.Vertices.Add(new Vertex(v.x, v.y, v.z)); //Normals foreach (ASE.Vector3D v in obj.mesh.vertexNormals) polygon.Normals.Add(new Vertex(v.x, v.y, v.z)); //Texture coordinates foreach (ASE.Vector3D uv in obj.mesh.textureCoordinates) polygon.UVs.Add(new UV(uv.x, uv.y)); //Faces foreach (ASE.Face face in obj.mesh.faces) { Face f = new Face(); foreach (int i in face.vertex) f.Indices.Add(new Index(i, -1, i)); f.Material = new Material(); polygon.Faces.Add(f); } setColor(); bone = null; }
/// <summary> /// Construct a new Bone from an ASE GeomObject /// </summary> /// <param name="vertex">ASE GeomObject to read from</param> public Bone(ASE.GeomObject obj) { children = new List<Node>(); name = obj.name; color = Colors.Random(); ASE.Vector3D v = obj.mesh.verticies[0]; position = new Vertex(v.x, v.y, v.z); translate = new Vertex(); meshes = new List<Mesh>(); ani = new List<Keyframe>(); //Create visual representation sphere = makeSphere(); }