Instance Method


Registers a block for SceneKit to call at render time for binding a Metal buffer to the shader program.


func handleBinding(ofBufferNamed name: String, frequency: SCNBufferFrequency, handler block: @escaping SCNBufferBindingBlock)



The name identifying the buffer in Metal shader source code.


An option specifying whether SceneKit calls the block only once per rendered frame or more frequently (for example, once for each object to be rendered).


A block to be run when SceneKit prepares for rendering with the Metal shader.


Use this method to associate a block with a Metal shader program to handle setup of a buffer used in that shader. SceneKit calls your block before rendering any objects whose program property is set to this SCNProgram object. In the block, use the writeBytes(_:count:) method to provide data for the buffer.

See Also

Providing Input for Metal Shaders

enum SCNBufferFrequency

Options for how often SceneKit should execute the binding handler you provide with the handleBinding(ofBufferNamed:frequency:handler:) method.

typealias SCNBufferBindingBlock

A block SceneKit calls at render time for working with buffers in a Metal shader, used by the handleBinding(ofBufferNamed:frequency:handler:) method.