예제 #1
0
 private void addMeshes(MediaLoader loader, XmlElement level, RenderableAddTarget target)
 {
     foreach (XmlElement entity in Xml.ElementsNamed(level, "entity"))
     {
         string       t        = Xml.GetAttributeString(entity, "type");
         string       name     = Xml.GetAttributeString(entity, "name");
         string       meshpath = t + ".mdf";
         MeshInstance mesh     = new MeshInstance(loader.fetch <Mesh>(meshpath));
         mesh.pos = GetPosition(entity["position"]);
         mesh.rot = GetRotation(entity["rotation"]);
         target(mesh);
     }
 }
예제 #2
0
        internal static Entity Create(MediaLoader loader, string name, System.Xml.XmlElement root, vec3 pos, quat rot)
        {
            Entity ent = new Entity(name);

            XmlElement visual = root["visual"];

            foreach (XmlElement meshel in Xml.ElementsNamed(visual, "mesh"))
            {
                string       meshpath = Xml.GetAttributeString(meshel, "file");
                MeshInstance mesh     = new MeshInstance(loader.fetch <Mesh>(meshpath));
                mesh.pos = pos;
                mesh.rot = rot;
                ent.add(mesh);
            }

            return(ent);
        }