/// <summary>
        /// Clones this object.
        /// </summary>
        public VertexStructureSurface Clone(
            VertexStructure newOwner,
            bool copyGeometryData = true, int capacityMultiplier = 1,
            int baseIndex         = 0)
        {
            newOwner.EnsureNotNull(nameof(newOwner));

            // Create new VertexStructure object
            int indexCount = m_indices.Count;
            VertexStructureSurface result = new VertexStructureSurface(newOwner, (indexCount / 3) * capacityMultiplier);

            // Copy geometry
            if (copyGeometryData)
            {
                for (int loop = 0; loop < indexCount; loop++)
                {
                    result.m_indices.Add(m_indices[loop] + baseIndex);
                }
            }

            // Copy metadata
            result.m_materialProperties = m_materialProperties.Clone();

            return(result);
        }
Пример #2
0
        /// <summary>
        /// Creates a new vertex
        /// </summary>
        internal Vertex(VertexStructure hostStructure, int vertexIndex)
        {
            hostStructure.EnsureNotNull(nameof(hostStructure));
            vertexIndex.EnsurePositive(nameof(vertexIndex));

            m_hostStructure = hostStructure;
            m_vertexIndex   = vertexIndex;
        }