Example #1
0
        private void DrawObj()
        {
            string texPath = ConfigurationManager.AppSettings["TexPath"];
            string path    = ConfigurationManager.AppSettings["ObjPath"];

            StringBuilder   builder   = new StringBuilder();
            Stopwatch       watch     = Stopwatch.StartNew();
            Mesh            mesh      = ObjParser.GetMeshFromFile(path);
            List <Material> materials = MtlParser.GetMaterialFromFile("Wood Texture.mtl");

            watch.Stop();
            builder.AppendLine($"Parsing: {watch.ElapsedMilliseconds} ms");
            watch        = Stopwatch.StartNew();
            mesh.Texture = Bitmap.FromFile(texPath) as Bitmap;
            watch.Stop();
            builder.AppendLine($"Loading texture: {watch.ElapsedMilliseconds} ms");
            watch = Stopwatch.StartNew();
            _canvas.DrawMesh(mesh, Line.LineType.Bresenham);
            watch.Stop();
            builder.AppendLine($"Drawing: {watch.ElapsedMilliseconds} ms");
            LogView.Text = builder.ToString();
        }