Ejemplo n.º 1
0
            public static Triangle FromString(string s, Dictionary <string, CompoundVertex> compoundVertexes)
            {
                var split = s.Split(' ');

                return(new Triangle
                {
                    a = CompoundVertex.FromString(split[0], compoundVertexes),
                    b = CompoundVertex.FromString(split[1], compoundVertexes),
                    c = CompoundVertex.FromString(split[2], compoundVertexes)
                });
            }
Ejemplo n.º 2
0
 public void Write(BinaryWriter writer, bool bigEndain)
 {
     if (bigEndain)
     {
         writer.Write(CompoundVertex.InverseBytes(x));
         writer.Write(CompoundVertex.InverseBytes(y));
         writer.Write(CompoundVertex.InverseBytes(z));
     }
     else
     {
         writer.Write(x);
         writer.Write(y);
         writer.Write(z);
     }
 }
Ejemplo n.º 3
0
            public static CompoundVertex FromString(string s, Dictionary <string, CompoundVertex> compoundVertexes)
            {
                var split  = s.Split('/');
                var result = new CompoundVertex
                {
                    v  = int.Parse(split[0]),
                    vt = int.Parse(split[1]),
                    vn = int.Parse(split[2]),
                };

                result.key = result.v.ToString() + "/" + result.vn.ToString() + "/" + result.vt.ToString();
                if (compoundVertexes.ContainsKey(result.key))
                {
                    return(compoundVertexes[result.key]);
                }
                compoundVertexes.Add(result.key, result);
                return(result);
            }
Ejemplo n.º 4
0
 public void WriteTransforms(BinaryWriter writer, bool bigEndain)
 {
     for (var i = 0; i < Meshes.Count; i++)
     {
         var mesh = Meshes[i];
         if (bigEndain)
         {
             writer.Write(CompoundVertex.InverseBytes(mesh.X));
             writer.Write(CompoundVertex.InverseBytes(mesh.Y));
             writer.Write(CompoundVertex.InverseBytes(mesh.Z));
         }
         else
         {
             writer.Write(mesh.X);
             writer.Write(mesh.Y);
             writer.Write(mesh.Z);
         }
     }
 }