示例#1
0
 public Ambertation.Geometry.Vector3 ToVector3()
 {
     double[] list = ToFloat();
     Ambertation.Geometry.Vector3 v = Ambertation.Geometry.Vector3.Zero;
     if (list.Length > 0)
     {
         v.X = list[0];
     }
     if (list.Length > 1)
     {
         v.Y = list[1];
     }
     if (list.Length > 2)
     {
         v.Z = list[2];
     }
     return(v);
 }
示例#2
0
        GmdcElement BuildNormalElement()
        {
            if (mesh.Normals.Count == 0)
            {
                return(null);
            }
            GmdcElement e = new GmdcElement(gmi.Gmdc);

            e.SetFormat   = SetFormat.Secondary;
            e.BlockFormat = BlockFormat.ThreeFloat;
            e.Identity    = ElementIdentity.Normal;
            e.GroupId     = 0;

            e.Number = mesh.Normals.Count;

            foreach (Ambertation.Geometry.Vector3 v in mesh.Normals)
            {
                Ambertation.Geometry.Vector3 vt = gmi.Component.InverseTransformNormal(v);
                e.Values.Add(new GmdcElementValueThreeFloat((float)vt.X, (float)vt.Y, (float)vt.Z));
            }

            return(e);
        }
示例#3
0
 void Clamp(Ambertation.Geometry.Vector3 v)
 {
     v.X = Math.Max(0, Math.Min(1, v.X));
     v.Y = Math.Max(0, Math.Min(1, v.Y));
     v.Z = Math.Max(0, Math.Min(1, v.Z));
 }
示例#4
0
 public System.Drawing.Color ToRGB()
 {
     Ambertation.Geometry.Vector3 v = ToVector3();
     Clamp(v);
     return(System.Drawing.Color.FromArgb((int)(v.X * 0xff), (int)(v.Y * 0xff), (int)(v.Z * 0xff)));
 }