Class

MDLMaterialProperty

A definition for one specific aspect of the rendering parameters for a material.

Declaration

@interface MDLMaterialProperty : NSObject

Overview

The collection of material properties in a MDLMaterial instance defines the intended surface appearance for rendering a 3D object. A material property object’s semantic property identifies which aspect of material rendering it affects, and its value (which can be any of several types) determines how the material property contributes to that aspect of rendering.

When you initialize a material property with a specific value (using one of the initializers listed in Creating a Material Property) or set the value of an existing material property (using one of the property setters listed in Working with a Material Property’s Value), the type property changes to reflect the data type of the stored value. To retrieve the material property’s value, you must use the property accessor appropriate to its type. If you read a material property’s value using an accessor for a different type, the result is undefined.

Topics

Creating a Material Property

- initWithName:semantic:

Initializes a material property without a value.

- initWithName:semantic:string:

Initializes a material property with a string value.

- initWithName:semantic:URL:

Initializes a material property with a URL value.

- initWithName:semantic:textureSampler:

Initializes a material property with a texture sampler object.

- initWithName:semantic:color:

Initializes a material property with a color value.

- initWithName:semantic:float:

Initializes a material property with a scalar value.

- initWithName:semantic:float2:

Initializes a material property with a 2-component vector value.

- initWithName:semantic:float3:

Initializes a material property with a 3-component vector value.

- initWithName:semantic:float4:

Initializes a material property with a 4-component vector value.

- initWithName:semantic:matrix4x4:

Initializes a material property with a 4 x 4 matrix value.

Using a Material Property

name

A descriptive name for the material property.

semantic

The semantic meaning for the material property’s value.

type

The data type stored in the material property’s value.

Working with a Material Property’s Value

stringValue

The string value for the material.

URLValue

The URL value for the material property—typically, the URL to a texture image.

textureSamplerValue

A texture sampler object that provides the texture image value for the material property.

color

The color value for the material property.

floatValue

The scalar floating-point value for the material property.

float2Value

The 2-component floating-point vector value for the material property.

float3Value

The 3-component floating-point vector value for the material property.

float4Value

The 4-component floating-point vector value for the material property.

matrix4x4

The 4 x 4 floating-point matrix value for the material property.

Copying a Material Property

- setProperties:

Sets the material property’s attributes to those of the specified material property.

Constants

MDLMaterialSemantic

Options for the semantic use of a material property’s value in rendering a particular surface appearance; used by the semantic property.

MDLMaterialPropertyType

Options for the data type of a material property, used by the type property.

Instance Properties

Relationships

Inherits From

Conforms To

See Also

Materials

MDLMaterial

A collection of material properties that together describe the intended surface appearance for rendering a 3D object.

MDLScatteringFunction

A set of material properties that describes a basic shading model for materials, and the superclass for more complex shading models.

MDLPhysicallyPlausibleScatteringFunction

A set of material properties that describes a physically realistic shading model for materials.