Exemplo n.º 1
0
        public MeshPart(MediaLoader ml, MeshDef.MaterialDef m, MeshDef def, Poseable poseable)
        {
            this.poseable = poseable;

            mat = new Material(m.diffuse, ml.fetch <Texture>(m.texture));
            foreach (MeshDef.Tri tri in def.TrianglesFor(m))
            {
                faces.Add(def.lookup(tri));
            }
        }
Exemplo n.º 2
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);
     }
 }
Exemplo n.º 3
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);
        }