示例#1
0
        private static List<ModelGeometry> LoadGeometries(XElement geometryNode, SemanticAssociations association, List<Vector4> weights = null, List<Vector4> joints = null)
        {
            List<ModelGeometry> geometries = new List<ModelGeometry>();

            //geometry
            if (geometryNode.GetNode("mesh") != null)
            {
                //if mesh load data
                var mesh = geometryNode.GetNode("mesh");

                var sources = mesh.GetNodes("source");
                var vertices = mesh.GetNodes("vertices");

                //load data, only triangles supported

                foreach (var elem in mesh.Elements())
                {
                    ModelGeometry geometry = new ModelGeometry();
                    geometry.Name = geometryNode.GetAttribute("id");
                    //lines
                    //linestrips
                    switch (elem.Name.LocalName)
                    {
                        case "polygons":
                            break;
                        case "polylist":
                            break;
                        case "triangles":
                            GetTriangleMesh(geometry, elem, mesh, association, weights, joints);
                            geometry.Optimize();
                            geometries.Add(geometry);
                            break;
                        case "trifans":
                            break;
                        case "tristrips":
                            break;
                        default:
                            break;
                    }

                }

            }

            return geometries;
        }