예제 #1
0
        public override Attach Clone()
        {
            ChunkAttach result = (ChunkAttach)MemberwiseClone();

            if (Vertex != null)
            {
                result.Vertex = new List <VertexChunk>(Vertex.Count);
                foreach (VertexChunk item in Vertex)
                {
                    result.Vertex.Add(item.Clone());
                }
            }
            if (Poly != null)
            {
                result.Poly = new List <PolyChunk>(Poly.Count);
                foreach (PolyChunk item in Poly)
                {
                    result.Poly.Add(item.Clone());
                }
            }
            result.Bounds = Bounds.Clone();
            return(result);
        }
예제 #2
0
        public int[] GetVertexCounts()
        {
            switch (GetModelFormat())
            {
            case ModelFormat.Basic:
            case ModelFormat.BasicDX:
                return(GetObjects().Where(a => a.Animate).Select(a => (a.Attach as BasicAttach)?.Vertex?.Length ?? 0).ToArray());

            case ModelFormat.Chunk:
                return(GetObjects().Where(a => a.Animate).Select(a =>
                {
                    ChunkAttach cnkatt = a.Attach as ChunkAttach;
                    if (cnkatt != null && cnkatt.Vertex != null)
                    {
                        return cnkatt.Vertex.Sum(b => b.VertexCount);
                    }
                    return 0;
                }).ToArray());

            default:
                return(new int[0]);
            }
        }