Creates a Model I/O object from the specified SceneKit node, using the specified allocator.
- iOS 10.0+
- macOS 10.12+
- tvOS 10.0+
A SceneKit node.
An object responsible for allocating mesh vertex and index data. If
nil, Model I/O uses an internal allocator object.
A new Model I/O object.
SceneKit is a high-level framework for modeling, animating, and displaying 3D scenes. (For details, see SceneKit.) The
SCNNode class describes the location, orientation, and other transform parameters for an element of a scene and serves as a container for visual content such as geometry, cameras, and lights. SceneKit nodes can also contain a hierarchy of child nodes, each with its own content and a transform relative to its parent. Use this method to convert a SceneKit node or node hierarchy to a Model I/O representation, which you can then process or export.
In Model I/O, objects representing scene content (cameras, lights, and meshes) are subclasses of the
MDLObject class, containing both descriptions of their content as well as transform and hierarchy information. In SceneKit, scene content classes provide only their content and serve as attachments to an
SCNNode object that provides transform and hierarchy. When you use this method to import a SceneKit node with a content object, it returns the appropriate
MDLObject subclass. For example, importing a node whose
geometry property references an
SCNGeometry object creates a
MDLMesh object containing that mesh as well as the transform information from the containing node. If you import a SceneKit node containing multiple attachments, this method creates a hierarchy of
MDLObject instances containing the appropriate Model I/O classes for those attachments.
allocator parameter controls vertex and index data allocation for any meshes contained in the node. For example, to use the MetalKit framework for loading vertex data into GPU buffers for rendering using Metal, pass a
MTKMesh 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.