Initializer

init(scnScene:bufferAllocator:)

Creates an asset from the specified SceneKit scene, using the specified allocator.

Declaration

convenience init(scnScene: SCNScene, bufferAllocator: MDLMeshBufferAllocator?)

Parameters

scnScene

A SceneKit scene object.

bufferAllocator

An object responsible for allocating mesh vertex and index data. If nil, Model I/O uses an internal allocator object.

Return Value

A new asset object.

Discussion

SceneKit is a high-level framework for modeling, animating, and displaying 3D scenes. (For details, see SceneKit.) The SCNScene class describes an entire scene to be displayed. A scene contains nodes (SCNNode objects) that manage the position and orientation of content, such as meshes (SCNGeometry objects) with attached materials, cameras, and lights. Use this method to convert an entire SceneKit scene and all of its contents to a Model I/O representation, which you can then process or export.

The allocator parameter controls vertex and index data allocation for any meshes contained in the scene. For example, to use the MetalKit framework for loading vertex data into GPU buffers for rendering using Metal, pass a MTKMeshBufferAllocator object. By specifying an allocator, you can ensure that mesh data is copied a minimal number of times between being read from a file and being loaded into GPU memory for rendering.

See Also

Importing Assets from SceneKit

init(scnScene: SCNScene)

Creates an asset from the specified SceneKit scene.