/// <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); }
/// <summary> /// Clones this object /// </summary> public VertexStructure Clone(bool copyGeometryData = true, int capacityMultiplier = 1) { capacityMultiplier.EnsurePositiveAndNotZero(nameof(capacityMultiplier)); // Create new VertexStructure object int vertexCount = m_rawGeometry.Count; VertexStructure result = new VertexStructure( vertexCount * capacityMultiplier); // Copy geometry if (copyGeometryData) { for (int loop = 0; loop < vertexCount; loop++) { result.m_rawGeometry.Add(m_rawGeometry[loop]); } } // Copy surfaces foreach (VertexStructureSurface actSurface in m_surfaces) { result.m_surfaces.Add(actSurface.Clone(result, copyGeometryData, capacityMultiplier)); } // Copy metadata result.m_description = m_description; result.m_name = m_name; return(result); }
internal VertexStructureSurface(VertexStructure owner, int triangleCapacity) { m_owner = owner; m_indices = new List <int>(triangleCapacity * 3); m_indexCollection = new IndexCollection(m_indices); m_triangleCollection = new TriangleCollection(m_indices); m_materialProperties = new MaterialProperties(); }
/// <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; }
/// <summary> /// Adds all triangles of the given VertexStructure to this one. /// </summary> /// <param name="otherStructure">The structure to add to this one.</param> public void AddStructure(VertexStructure otherStructure) { int baseIndex = (int)m_rawGeometry.Count; int newStructureLength = otherStructure.CountVertices; // Add all raw data collections m_rawGeometry.AddRange(otherStructure.m_rawGeometry); if (m_rawTexture != null) { if (otherStructure.m_rawTexture != null) { m_rawTexture.AddRange(otherStructure.m_rawTexture); } else { for (int actNewIndex = 0; actNewIndex < newStructureLength; actNewIndex++) { m_rawTexture.Add(default(TextureData)); } } } if (m_rawAnimation != null) { if (otherStructure.m_rawAnimation != null) { m_rawAnimation.AddRange(otherStructure.m_rawAnimation); } else { for (int actNewIndex = 0; actNewIndex < newStructureLength; actNewIndex++) { m_rawAnimation.Add(default(AnimationData)); } } } // Copy all structures int otherStructureSurfaceCount = otherStructure.m_surfaces.Count; for (int loopSurface = 0; loopSurface < otherStructureSurfaceCount; loopSurface++) { m_surfaces.Add(otherStructure.m_surfaces[loopSurface].Clone( this, baseIndex: baseIndex)); } }
/// <summary> /// Initializes a new instance of the <see cref="BuiltVerticesRange" /> struct. /// </summary> /// <param name="structure">The structure.</param> /// <param name="startVertex">The start vertex.</param> /// <param name="vertexCount">The vertex count.</param> public BuiltVerticesRange(VertexStructure structure, int startVertex, int vertexCount) { this.Structure = structure; this.StartVertex = startVertex; this.VertexCount = vertexCount; }
/// <summary> /// Initializes a new instance of the <see cref="BuiltVerticesRange" /> struct. /// </summary> /// <param name="structure">The structure.</param> public BuiltVerticesRange(VertexStructure structure) { this.Structure = structure; this.StartVertex = 0; this.VertexCount = 0; }
public void Dispose() { m_host = null; m_actIndex = -1; }
public VertexEnumerator(VertexStructure host) { m_host = host; m_actIndex = -1; }
internal VertexCollection(VertexStructure host) { m_host = host; }