MDLMesh
A container for vertex buffer data to be used in rendering a 3D object.
Declaration
class MDLMeshOverview
A mesh contains one or more MDLSubmesh objects. Each submesh contains index buffer data that describes how the mesh’s vertices should be combined for drawing and references material information describing an intended surface appearance for the submesh. Typically, you obtain meshes by traversing the object hierarchy of a MDLAsset object, but you can also create meshes from your own vertex data or create parametric meshes. The MDLMesh class also supports processing meshes to generate vertex attributes or to bake lighting information.
Topics
Creating a Custom Mesh
init(vertexBuffer:vertexCount:descriptor:submeshes:)init(vertexBuffers:vertexCount:descriptor:submeshes:)init(bufferAllocator:)newSubdividedMesh(_:submeshIndex:subdivisionLevels:)init(meshBySubdividingMesh:submeshIndex:subdivisionLevels:allocator:)
Working with Vertex Data
boundingBoxsubmeshesvertexBuffersvertexCountvertexDescriptorallocatoraddAttribute(withName:format:)addAttribute(withName:format:type:data:stride:)addAttribute(withName:format:type:data:stride:time:)removeAttributeNamed(_:)replaceAttributeNamed(_:with:)updateAttributeNamed(_:with:)addUnwrappedTextureCoordinates(forAttributeNamed:)vertexAttributeData(forAttributeNamed:)vertexAttributeData(forAttributeNamed:as:)
Generating Geometry Data
addNormals(withAttributeNamed:creaseThreshold:)addTangentBasis(forTextureCoordinateAttributeNamed:tangentAttributeNamed:bitangentAttributeNamed:)addTangentBasis(forTextureCoordinateAttributeNamed:normalAttributeNamed:tangentAttributeNamed:)makeVerticesUnique()
Generating Ambient Occlusion Data
generateAmbientOcclusionTexture(withQuality:attenuationFactor:objectsToConsider:vertexAttributeNamed:materialPropertyNamed:)generateAmbientOcclusionTexture(withSize:raysPerSample:attenuationFactor:objectsToConsider:vertexAttributeNamed:materialPropertyNamed:)generateAmbientOcclusionVertexColors(withQuality:attenuationFactor:objectsToConsider:vertexAttributeNamed:)generateAmbientOcclusionVertexColors(withRaysPerSample:attenuationFactor:objectsToConsider:vertexAttributeNamed:)
Generating Light Map Data
generateLightMapTexture(withQuality:lightsToConsider:objectsToConsider:vertexAttributeNamed:materialPropertyNamed:)generateLightMapTexture(withTextureSize:lightsToConsider:objectsToConsider:vertexAttributeNamed:materialPropertyNamed:)generateLightMapVertexColorsWithLights(toConsider:objectsToConsider:vertexAttributeNamed:)
Creating Parametric Meshes
newBox(withDimensions:segments:geometryType:inwardNormals:allocator:)newEllipsoid(withRadii:radialSegments:verticalSegments:geometryType:inwardNormals:hemisphere:allocator:)newCylinder(withHeight:radii:radialSegments:verticalSegments:geometryType:inwardNormals:allocator:)newEllipticalCone(withHeight:radii:radialSegments:verticalSegments:geometryType:inwardNormals:allocator:)newPlane(withDimensions:segments:geometryType:allocator:)newCapsule(withHeight:radii:radialSegments:verticalSegments:hemisphereSegments:geometryType:inwardNormals:allocator:)newIcosahedron(withRadius:inwardNormals:allocator:)newIcosahedron(withRadius:inwardNormals:geometryType:allocator:)init(boxWithExtent:segments:inwardNormals:geometryType:allocator:)init(sphereWithExtent:segments:inwardNormals:geometryType:allocator:)init(cylinderWithExtent:segments:inwardNormals:topCap:bottomCap:geometryType:allocator:)init(coneWithExtent:segments:inwardNormals:cap:geometryType:allocator:)init(planeWithExtent:segments:geometryType:allocator:)init(icosahedronWithExtent:inwardNormals:geometryType:allocator:)init(capsuleWithExtent:cylinderSegments:hemisphereSegments:inwardNormals:geometryType:allocator:)init(hemisphereWithExtent:segments:inwardNormals:cap:geometryType:allocator:)