public OldAnimationEntryViewer(OldFrame frame,OldModelEntry model)
 {
     this.frames = new List<OldFrame>();
     this.frames.Add(frame);
     this.model = model;
     this.frameid = 0;
 }
 public OldModelEntryController(EntryChunkController entrychunkcontroller,OldModelEntry oldmodelentry)
     : base(entrychunkcontroller,oldmodelentry)
 {
     this.oldmodelentry = oldmodelentry;
     Node.Text = string.Format("Old Model Entry ({0})",oldmodelentry.EIDString);
     Node.ImageKey = "oldmodelentry";
     Node.SelectedImageKey = "oldmodelentry";
 }
 public OldAnimationEntryViewer(IEnumerable<OldFrame> frames,OldModelEntry model)
 {
     this.frames = new List<OldFrame>(frames);
     this.model = model;
     this.frameid = 0;
     this.animatetimer = new Timer();
     this.animatetimer.Interval = 33;
     this.animatetimer.Enabled = true;
     this.animatetimer.Tick += delegate (object sender,EventArgs e)
     {
         frameid++;
         Refresh();
     };
 }
示例#4
0
        public byte[] ToOBJ(OldModelEntry model)
        {
            long xorigin = 0;
            long yorigin = 0;
            long zorigin = 0;

            foreach (OldFrameVertex vertex in vertices)
            {
                xorigin += vertex.X;
                yorigin += vertex.Y;
                zorigin += vertex.Z;
            }
            xorigin /= vertices.Count;
            yorigin /= vertices.Count;
            zorigin /= vertices.Count;
            xorigin -= xoffset;
            yorigin -= yoffset;
            zorigin -= zoffset;
            using (MemoryStream stream = new MemoryStream())
            {
                using (StreamWriter obj = new StreamWriter(stream))
                {
                    obj.WriteLine("# Vertices");
                    foreach (OldFrameVertex vertex in vertices)
                    {
                        obj.WriteLine("v {0} {1} {2}", vertex.X - xorigin, vertex.Y - yorigin, vertex.Z - zorigin);
                    }
                    obj.WriteLine();
                    obj.WriteLine("# Polygons");
                    foreach (OldModelPolygon polygon in model.Polygons)
                    {
                        obj.WriteLine("f {0} {1} {2}", polygon.VertexA / 6 + 1, polygon.VertexB / 6 + 1, polygon.VertexC / 6 + 1);
                    }
                }
                return(stream.ToArray());
            }
        }
示例#5
0
 public byte[] ToOBJ(OldModelEntry model)
 {
     long xorigin = 0;
     long yorigin = 0;
     long zorigin = 0;
     foreach (OldFrameVertex vertex in vertices)
     {
         xorigin += vertex.X;
         yorigin += vertex.Y;
         zorigin += vertex.Z;
     }
     xorigin /= vertices.Count;
     yorigin /= vertices.Count;
     zorigin /= vertices.Count;
     xorigin -= xoffset;
     yorigin -= yoffset;
     zorigin -= zoffset;
     using (MemoryStream stream = new MemoryStream())
     {
         using (StreamWriter obj = new StreamWriter(stream))
         {
             obj.WriteLine("# Vertices");
             foreach (OldFrameVertex vertex in vertices)
             {
                 obj.WriteLine("v {0} {1} {2}",vertex.X - xorigin,vertex.Y - yorigin,vertex.Z - zorigin);
             }
             obj.WriteLine();
             obj.WriteLine("# Polygons");
             foreach (OldModelPolygon polygon in model.Polygons)
             {
                 obj.WriteLine("f {0} {1} {2}",polygon.VertexA / 6 + 1,polygon.VertexB / 6 + 1,polygon.VertexC / 6 + 1);
             }
         }
         return stream.ToArray();
     }
 }