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> /// Tries to get an existing surface using given MaterialProperties. /// If none exists, then a new surface is created. /// </summary> /// <param name="matProperties">The material properties.</param> /// <param name="triangleCapacity">The triangle capacity.</param> public VertexStructureSurface CreateOrGetExistingSurface(MaterialProperties matProperties, int triangleCapacity = 512) { foreach (VertexStructureSurface actSurface in m_surfaces) { if (actSurface.MaterialProperties == matProperties) { return(actSurface); } } VertexStructureSurface result = CreateSurface(triangleCapacity); result.MaterialProperties = matProperties; return(result); }