Class

MDLVoxelArray

A model of a 3D object's solid volume as a collection of voxels, or cubic units.

Declaration

@interface MDLVoxelArray : MDLObject

Overview

Unlike a mesh, which models only surface topology, a voxel array models the solid volume of a 3D object. Voxels are useful for modeling volumetric phenomena (such as clouds and fire), performing solid geometry operations (such as intersection and union), and preparing a 3D design for real-world physical production.

Topics

Creating a Voxel Array

- initWithAsset:divisions:interiorShells:exteriorShells:patchRadius:

Initializes a voxel array that models the volume of 3D objects in the specified asset and creates the specified number of voxel shells.

Deprecated
- initWithAsset:divisions:interiorNBWidth:exteriorNBWidth:patchRadius:

Initializes a voxel array that models the volume of 3D objects in the specified asset, creating voxel shells for the specified distances from the object’s surface.

Deprecated
- initWithData:boundingBox:voxelExtent:

Initializes a voxel array with the specified voxel data.

Examining Voxels

count

The number of voxels in the array.

voxelIndexExtent

The indexes that define the corners of the three-dimensional voxel grid.

- voxelExistsAtIndex:allowAnyX:allowAnyY:allowAnyZ:allowAnyShell:

Returns a Boolean value indicating whether the voxel array contains voxel data for the specified index.

- voxelsWithinExtent:

Returns a data object containing all voxels within the specified volume.

- voxelIndices

Returns a data object containing all voxels within the voxel array.

Modifying Voxels

- setVoxelAtIndex:

Sets voxel characteristics at the specified index in the array.

- setVoxelsForMesh:divisions:interiorNBWidth:exteriorNBWidth:patchRadius:

Sets voxel values in the array to model the volume of the specified mesh and creates voxel shells for the specified distances from the object’s surface.

Deprecated
- setVoxelsForMesh:divisions:interiorShells:exteriorShells:patchRadius:

Sets voxel values in the array to model the volume of the specified mesh and creates the specified number of voxel shells.

Deprecated

Performing Constructive Solid Geometry Operations

- unionWithVoxels:

Extends the voxel array to also cover the volume of the specified voxel array.

- intersectWithVoxels:

Reduces the voxel array to cover only the volume within both it and another voxel array.

- differenceWithVoxels:

Reduces the voxel array to cover only the portion of its volume not covered by another voxel array.

Relating Voxels to Scene Space

boundingBox

The extent of the voxel array’s volume in world coordinate space.

- indexOfSpatialLocation:

Returns voxel information corresponding to the specified point in the world coordinate space of the asset from which the voxel array was created.

- spatialLocationOfIndex:

Returns the location of the specified voxel in world coordinate space.

- voxelBoundingBoxAtIndex:

Returns the extent of the specified voxel’s volume in the world coordinate space of the asset from which the voxel array was created.

Creating a Mesh from Voxels

- meshUsingAllocator:

Generates a closed polygon mesh around the volume of space the voxel array describes.

Constants

MDLVoxelIndex

A 4-component vector encoding the location of a voxel in a voxel array and describing its relation to an object’s volume.

MDLVoxelIndexExtent

The corner voxel indices defining a solid rectangular volume of voxels. Used by the voxelIndexExtent property and voxelsWithinExtent: method.

Relationships

Inherits From

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software