示例#1
0
        public VertexPositionNormal(IVertexGeometry src)
        {
            Guard.NotNull(src, nameof(src));

            this.Position = src.GetPosition();
            src.TryGetNormal(out this.Normal);
        }
        public static string _GetDebuggerDisplay(IVertexGeometry geo)
        {
            var txt = $"𝐏:{geo.GetPosition()}";

            if (geo.TryGetNormal(out Vector3 n))
            {
                txt += $" 𝚴:{n}";
            }
            if (geo.TryGetTangent(out Vector4 t))
            {
                txt += $" 𝚻:{t}";
            }

            return(txt);
        }
示例#3
0
        public static TvP ConvertToGeometry <TvP>(this IVertexGeometry src)
            where TvP : struct, IVertexGeometry
        {
            if (src.GetType() == typeof(TvP))
            {
                return((TvP)src);
            }

            var dst = default(TvP);

            dst.SetPosition(src.GetPosition());
            if (src.TryGetNormal(out Vector3 nrm))
            {
                dst.SetNormal(nrm);
            }
            if (src.TryGetTangent(out Vector4 tgt))
            {
                dst.SetTangent(tgt);
            }

            return(dst);
        }
示例#4
0
        IVertexGeometry IVertexGeometry.ToDisplaceMorph(IVertexGeometry baseValue)
        {
            var bv = (VertexPosition)baseValue;

            return(new VertexPosition(this.Position - bv.Position));
        }
示例#5
0
        IVertexGeometry IVertexGeometry.ToAbsoluteMorph(IVertexGeometry baseValue)
        {
            var bv = (VertexPosition)baseValue;

            return(new VertexPosition(this.Position + bv.Position));
        }
示例#6
0
 public VertexPosition(IVertexGeometry src)
 {
     Guard.NotNull(src, nameof(src));
     this.Position = src.GetPosition();
 }
示例#7
0
 IVertexGeometry IVertexGeometry.ToDisplaceMorph(IVertexGeometry baseValue)
 {
     throw new NotSupportedException();
 }
示例#8
0
 IVertexGeometry IVertexGeometry.ToAbsoluteMorph(IVertexGeometry baseValue)
 {
     throw new NotSupportedException();
 }
示例#9
0
 public VertexGeometryDelta Subtract(IVertexGeometry baseValue)
 {
     return(new VertexGeometryDelta((VertexPosition)baseValue, this));
 }