예제 #1
0
 public static void DrawTriangleList(this GraphicsDevice device, TriangleList list)
 {
     device.DrawUserIndexedPrimitives(
         PrimitiveType.TriangleList,
         list.Vertices.ToArray(),
         0,
         list.Vertices.Count,
         list.Indices.ToArray(),
         0,
         list.Indices.Count / 3);
 }
예제 #2
0
 public static void DrawTriangleList(this GraphicsDevice device, TriangleList list)
 {
     device.DrawUserIndexedPrimitives(
         PrimitiveType.TriangleList,
         list.Vertices.ToArray(),
         0,
         list.Vertices.Count,
         list.Indices.ToArray(),
         0,
         list.Indices.Count / 3);
 }
예제 #3
0
파일: ADT.cs 프로젝트: WoW-Tools/mpqnav
        public void Load()
        {
            wmos = MODFList
                .Select(modf => _wmoLoader.Load(modf))
                .ToList();

            m2S = MDDFList.Select(mmdf => _m2Loader.Load(mmdf))
                .ToList();

            triangeList = GenerateVertexAndIndices();
            triangeListH2O = GenerateVertexAndIndicesH2O();
        }
예제 #4
0
        private static Model LoadM2(string fileName)
        {
            string path = fileName;
            if (path.Substring(path.Length - 4) == ".mdx")
            {
                path = path.Substring(0, path.Length - 4) + ".m2";
            }
            var fileInfo = FileInfoFactory.Create();
            if (!fileInfo.Exists(path))
            {
                throw new Exception(String.Format("File does not exist: {0}", path));
            }

            using (var br = new BinaryReader(fileInfo.OpenRead(path)))
            {
                br.BaseStream.Position = 60; //wotlk
                uint numberOfVerts = br.ReadUInt32();
                uint vertsOffset = br.ReadUInt32();
                uint numberOfViews = br.ReadUInt32();
                //UInt32 viewsOffset = br.ReadUInt32(); //now in skins

                br.BaseStream.Position = 216; //wotlk
                uint nBoundingTriangles = br.ReadUInt32();
                uint ofsBoundingTriangles = br.ReadUInt32();
                uint nBoundingVertices = br.ReadUInt32();
                uint ofsBoundingVertices = br.ReadUInt32();
                uint nBoundingNormals = br.ReadUInt32();
                uint ofsBoundingNormals = br.ReadUInt32();

                var indices = new IndicesParser(br, ofsBoundingTriangles, nBoundingTriangles).Parse();

                var vectors = new VectorsListParser(br, ofsBoundingVertices, nBoundingVertices).Parse();

                //var normals = new VectorsListParser(br, ofsBoundingNormals, nBoundingNormals).Parse();

                var vertices = vectors
                    .Select(t => new VertexPositionNormalColored(t, Color.Red, Vector3.Up))
                    .ToList();

                var list = new TriangleList(indices, vertices);
                return new Model(list);
            }
        }
예제 #5
0
파일: Model.cs 프로젝트: hazzik/mpqnav
 public Model(TriangleList list)
 {
     triangleList = list;
 }
예제 #6
0
파일: Model.cs 프로젝트: WoW-Tools/mpqnav
 public Model(TriangleList list)
 {
     triangleList = list;
 }