What's New / Spatial, 3D & RealityKit

What's new in _USDKit_RealityKit

+32 NewiOS · macOS · tvOS

_USDKit_RealityKit is a Swift cross-import overlay, not a standalone framework: its API is available only when a target imports both USDKit and RealityKit. It defines identifier and data types that expose USD meshes, materials, textures, and deformations to RealityKit.

The 27 SDK adds 32 APIs and removes none. New paired identifier and data types are DeformationID/DeformationData, MaterialID/MaterialData, MeshID/MeshData, and TextureID/TextureData, plus TextureLevelInfo. It also adds USDStageComponent for attaching a USD stage to an entity, and the USDRenderError and UsdRenderMessage types.

New

32
struct

DeformationData

NewiOSmacOStvOS
public struct DeformationData : Sendable
Declaration
public struct DeformationData : Sendable {

    public let id: DeformationID

    public struct SkinningData : Sendable {

        public let influencePerVertexCount: UInt8

        public let jointTransforms: [float4x4]

        public let inverseBindPoses: [float4x4]

        public let influenceJointIndices: [UInt32]

        public let influenceWeights: [Float]

        public let geometryBindTransform: float4x4

        public struct Update : Sendable {

            public let jointTransforms: [float4x4]?

            public let inverseBindPoses: [float4x4]?

            public let influenceJointIndices: [UInt32]?

            public let influenceWeights: [Float]?

            public let geometryBindTransform: float4x4?
        }
    }

    public struct BlendShapeData : Sendable {

        public let weights: [Float]

        public let positionOffsets: [[SIMD3<Float>]]

        public struct Update : Sendable {

            public let weights: [Float]?

            public let positionOffsets: [[SIMD3<Float>]]?
        }
    }

    public struct RenormalizationData : Sendable {

        public let vertexIndicesPerTriangle: [UInt32]

        public let vertexAdjacencies: [UInt32]

        public let vertexAdjacencyEndIndices: [UInt32]

        public struct Update : Sendable {

            public let vertexIndicesPerTriangle: [UInt32]?

            public let vertexAdjacencies: [UInt32]?

            public let vertexAdjacencyEndIndices: [UInt32]?
        }
    }

    public let skinningData: DeformationData.SkinningData?

    public let blendShapeData: DeformationData.BlendShapeData?

    public let renormalizationData: DeformationData.RenormalizationData?

    public struct Update : Sendable {

        public let id: DeformationID

        public let skinningDataUpdate: DeformationData.SkinningData.Update?

        public let blendShapeDataUpdate: DeformationData.BlendShapeData.Update?

        public let renormalizationDataUpdate: DeformationData.RenormalizationData.Update?
    }

Truncated.

struct

DeformationID

NewiOSmacOStvOS
public struct DeformationID

Deformation resource identifier

Declaration
public struct DeformationID {

    /// A textual representation of this instance.
    ///
    /// Calling this property directly is discouraged. Instead, convert an
    /// instance of any type to a string by using the `String(describing:)`
    /// initializer. This initializer works with any type, and uses the custom
    /// `description` property for types that conform to
    /// `CustomStringConvertible`:
    ///
    ///     struct Point: CustomStringConvertible {
    ///         let x: Int, y: Int
    ///
    ///         var description: String {
    ///             return "(\(x), \(y))"
    ///         }
    ///     }
    ///
    ///     let p = Point(x: 21, y: 30)
    ///     let s = String(describing: p)
    ///     print(s)
    ///     // Prints "(21, 30)"
    ///
    /// The conversion of `p` to a string in the assignment to `s` uses the
    /// `Point` type's `description` property.
    public var description: String { get }

    /// Returns a Boolean value indicating whether two values are equal.
    ///
    /// Equality is the inverse of inequality. For any values `a` and `b`,
    /// `a == b` implies that `a != b` is `false`.
    ///
    /// - Parameters:
    ///   - lhs: A value to compare.
    ///   - rhs: Another value to compare.
    public static func == (a: DeformationID, b: DeformationID) -> Bool

    /// Hashes the essential components of this value by feeding them into the
    /// given hasher.
    ///
    /// Implement this method to conform to the `Hashable` protocol. The
    /// components used for hashing must be the same as the components compared
    /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
    /// with each of these components.
    ///
    /// - Important: In your implementation of `hash(into:)`,
    ///   don't call `finalize()` on the `hasher` instance provided,
    ///   or replace it with a different instance.
    ///   Doing so may become a compile-time error in the future.
    ///
    /// - Parameter hasher: The hasher to use when combining the components
    ///   of this instance.
    public func hash(into hasher: inout Hasher)

    /// The hash value.
    ///
    /// Hash values are not guaranteed to be equal across different executions of
    /// your program. Do not save hash values to use during a future execution.
    ///
    /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
    ///   conform to `Hashable`, implement the `hash(into:)` requirement instead.
    ///   The compiler provides an implementation for `hashValue` for you.
    public var hashValue: Int { get }
}
extension

DeformationID

NewiOSmacOStvOS
extension DeformationID : CustomStringConvertible
Declaration
extension DeformationID : CustomStringConvertible {
}
extension

DeformationID

NewiOSmacOStvOS
extension DeformationID : Sendable
Declaration
extension DeformationID : Sendable {
}
extension

DeformationID

NewiOSmacOStvOS
extension DeformationID : Hashable
Declaration
extension DeformationID : Hashable {
}
struct

MaterialData

NewiOSmacOStvOS
public struct MaterialData : Sendable
Declaration
public struct MaterialData : Sendable {

    public let id: MaterialID

    public let primPath: String

    public let assignedTextures: [String : TextureID]

    public var shaderGraph: ShaderGraph { get }

    public struct Update : Sendable {

        public let id: MaterialID

        public let assignedTextures: [String : TextureID]?
    }
}
struct

MaterialID

NewiOSmacOStvOS
public struct MaterialID

Material resource identifier

Declaration
public struct MaterialID {

    /// A textual representation of this instance.
    ///
    /// Calling this property directly is discouraged. Instead, convert an
    /// instance of any type to a string by using the `String(describing:)`
    /// initializer. This initializer works with any type, and uses the custom
    /// `description` property for types that conform to
    /// `CustomStringConvertible`:
    ///
    ///     struct Point: CustomStringConvertible {
    ///         let x: Int, y: Int
    ///
    ///         var description: String {
    ///             return "(\(x), \(y))"
    ///         }
    ///     }
    ///
    ///     let p = Point(x: 21, y: 30)
    ///     let s = String(describing: p)
    ///     print(s)
    ///     // Prints "(21, 30)"
    ///
    /// The conversion of `p` to a string in the assignment to `s` uses the
    /// `Point` type's `description` property.
    public var description: String { get }

    /// Returns a Boolean value indicating whether two values are equal.
    ///
    /// Equality is the inverse of inequality. For any values `a` and `b`,
    /// `a == b` implies that `a != b` is `false`.
    ///
    /// - Parameters:
    ///   - lhs: A value to compare.
    ///   - rhs: Another value to compare.
    public static func == (a: MaterialID, b: MaterialID) -> Bool

    /// Hashes the essential components of this value by feeding them into the
    /// given hasher.
    ///
    /// Implement this method to conform to the `Hashable` protocol. The
    /// components used for hashing must be the same as the components compared
    /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
    /// with each of these components.
    ///
    /// - Important: In your implementation of `hash(into:)`,
    ///   don't call `finalize()` on the `hasher` instance provided,
    ///   or replace it with a different instance.
    ///   Doing so may become a compile-time error in the future.
    ///
    /// - Parameter hasher: The hasher to use when combining the components
    ///   of this instance.
    public func hash(into hasher: inout Hasher)

    /// The hash value.
    ///
    /// Hash values are not guaranteed to be equal across different executions of
    /// your program. Do not save hash values to use during a future execution.
    ///
    /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
    ///   conform to `Hashable`, implement the `hash(into:)` requirement instead.
    ///   The compiler provides an implementation for `hashValue` for you.
    public var hashValue: Int { get }
}
extension

MaterialID

NewiOSmacOStvOS
extension MaterialID : CustomStringConvertible
Declaration
extension MaterialID : CustomStringConvertible {
}
extension

MaterialID

NewiOSmacOStvOS
extension MaterialID : Sendable
Declaration
extension MaterialID : Sendable {
}
extension

MaterialID

NewiOSmacOStvOS
extension MaterialID : Hashable
Declaration
extension MaterialID : Hashable {
}
struct

MeshData

NewiOSmacOStvOS
public struct MeshData : Sendable
Declaration
public struct MeshData : Sendable {

    public let id: MeshID

    public let primPath: String

    public let descriptor: LowLevelMesh.Descriptor

    public let parts: [LowLevelMesh.Part]

    public let indexData: Data

    public let vertexData: [Data]

    public let instanceTransforms: [float4x4]

    public let assignedMaterials: [MaterialID]

    public let meshType: MeshData.MeshType

    public enum MeshType : Sendable {

        case `static`

        case deformable(DeformationID)
    }

    public struct Update : Sendable {

        public let id: MeshID

        public let parts: [LowLevelMesh.Part]?

        public let indexData: Data?

        public let vertexData: [Data]?

        public let instanceTransforms: [float4x4]?

        public let assignedMaterials: [MaterialID]?

        public let meshType: MeshData.MeshType?
    }
}
struct

MeshID

NewiOSmacOStvOS
public struct MeshID

Mesh resource identifier

Declaration
public struct MeshID {

    /// A textual representation of this instance.
    ///
    /// Calling this property directly is discouraged. Instead, convert an
    /// instance of any type to a string by using the `String(describing:)`
    /// initializer. This initializer works with any type, and uses the custom
    /// `description` property for types that conform to
    /// `CustomStringConvertible`:
    ///
    ///     struct Point: CustomStringConvertible {
    ///         let x: Int, y: Int
    ///
    ///         var description: String {
    ///             return "(\(x), \(y))"
    ///         }
    ///     }
    ///
    ///     let p = Point(x: 21, y: 30)
    ///     let s = String(describing: p)
    ///     print(s)
    ///     // Prints "(21, 30)"
    ///
    /// The conversion of `p` to a string in the assignment to `s` uses the
    /// `Point` type's `description` property.
    public var description: String { get }

    /// Returns a Boolean value indicating whether two values are equal.
    ///
    /// Equality is the inverse of inequality. For any values `a` and `b`,
    /// `a == b` implies that `a != b` is `false`.
    ///
    /// - Parameters:
    ///   - lhs: A value to compare.
    ///   - rhs: Another value to compare.
    public static func == (a: MeshID, b: MeshID) -> Bool

    /// Hashes the essential components of this value by feeding them into the
    /// given hasher.
    ///
    /// Implement this method to conform to the `Hashable` protocol. The
    /// components used for hashing must be the same as the components compared
    /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
    /// with each of these components.
    ///
    /// - Important: In your implementation of `hash(into:)`,
    ///   don't call `finalize()` on the `hasher` instance provided,
    ///   or replace it with a different instance.
    ///   Doing so may become a compile-time error in the future.
    ///
    /// - Parameter hasher: The hasher to use when combining the components
    ///   of this instance.
    public func hash(into hasher: inout Hasher)

    /// The hash value.
    ///
    /// Hash values are not guaranteed to be equal across different executions of
    /// your program. Do not save hash values to use during a future execution.
    ///
    /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
    ///   conform to `Hashable`, implement the `hash(into:)` requirement instead.
    ///   The compiler provides an implementation for `hashValue` for you.
    public var hashValue: Int { get }
}
extension

MeshID

NewiOSmacOStvOS
extension MeshID : CustomStringConvertible
Declaration
extension MeshID : CustomStringConvertible {
}
extension

MeshID

NewiOSmacOStvOS
extension MeshID : Sendable
Declaration
extension MeshID : Sendable {
}
extension

MeshID

NewiOSmacOStvOS
extension MeshID : Hashable
Declaration
extension MeshID : Hashable {
}
extension

NSNotification.Name

NewiOSmacOStvOS
extension NSNotification.Name
Declaration
extension NSNotification.Name {

    public static let USDStageKitRenderComplete: Notification.Name
}
struct

TextureData

NewiOSmacOStvOS
public struct TextureData : Sendable
Declaration
public struct TextureData : Sendable {

    public let id: TextureID

    public let assetPath: String

    public let descriptor: LowLevelTexture.Descriptor

    public let layout: [TextureLevelInfo]

    public let data: Data
}
struct

TextureID

NewiOSmacOStvOS
public struct TextureID

Texture resource identifier

Declaration
public struct TextureID {

    /// A textual representation of this instance.
    ///
    /// Calling this property directly is discouraged. Instead, convert an
    /// instance of any type to a string by using the `String(describing:)`
    /// initializer. This initializer works with any type, and uses the custom
    /// `description` property for types that conform to
    /// `CustomStringConvertible`:
    ///
    ///     struct Point: CustomStringConvertible {
    ///         let x: Int, y: Int
    ///
    ///         var description: String {
    ///             return "(\(x), \(y))"
    ///         }
    ///     }
    ///
    ///     let p = Point(x: 21, y: 30)
    ///     let s = String(describing: p)
    ///     print(s)
    ///     // Prints "(21, 30)"
    ///
    /// The conversion of `p` to a string in the assignment to `s` uses the
    /// `Point` type's `description` property.
    public var description: String { get }

    /// Returns a Boolean value indicating whether two values are equal.
    ///
    /// Equality is the inverse of inequality. For any values `a` and `b`,
    /// `a == b` implies that `a != b` is `false`.
    ///
    /// - Parameters:
    ///   - lhs: A value to compare.
    ///   - rhs: Another value to compare.
    public static func == (a: TextureID, b: TextureID) -> Bool

    /// Hashes the essential components of this value by feeding them into the
    /// given hasher.
    ///
    /// Implement this method to conform to the `Hashable` protocol. The
    /// components used for hashing must be the same as the components compared
    /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
    /// with each of these components.
    ///
    /// - Important: In your implementation of `hash(into:)`,
    ///   don't call `finalize()` on the `hasher` instance provided,
    ///   or replace it with a different instance.
    ///   Doing so may become a compile-time error in the future.
    ///
    /// - Parameter hasher: The hasher to use when combining the components
    ///   of this instance.
    public func hash(into hasher: inout Hasher)

    /// The hash value.
    ///
    /// Hash values are not guaranteed to be equal across different executions of
    /// your program. Do not save hash values to use during a future execution.
    ///
    /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
    ///   conform to `Hashable`, implement the `hash(into:)` requirement instead.
    ///   The compiler provides an implementation for `hashValue` for you.
    public var hashValue: Int { get }
}
extension

TextureID

NewiOSmacOStvOS
extension TextureID : CustomStringConvertible
Declaration
extension TextureID : CustomStringConvertible {
}
extension

TextureID

NewiOSmacOStvOS
extension TextureID : Sendable
Declaration
extension TextureID : Sendable {
}
extension

TextureID

NewiOSmacOStvOS
extension TextureID : Hashable
Declaration
extension TextureID : Hashable {
}
struct

TextureLevelInfo

NewiOSmacOStvOS
public struct TextureLevelInfo : Sendable
Declaration
public struct TextureLevelInfo : Sendable {

    public let dataOffset: Int

    public let byteCountPerRow: Int

    public let byteCountPerImage: Int
}
struct

USDRenderError

NewiOSmacOStvOS
public struct USDRenderError : Error, Sendable
Declaration
public struct USDRenderError : Error, Sendable {

    /// Retrieve the localized description for this error.
    public var localizedDescription: String
}
struct

UsdRenderMessage

NewiOSmacOStvOS
public struct UsdRenderMessage : Equatable, CustomStringConvertible, CustomDebugStringConvertible
Declaration
public struct UsdRenderMessage : Equatable, CustomStringConvertible, CustomDebugStringConvertible {

    /// A textual representation of this instance.
    ///
    /// Calling this property directly is discouraged. Instead, convert an
    /// instance of any type to a string by using the `String(describing:)`
    /// initializer. This initializer works with any type, and uses the custom
    /// `description` property for types that conform to
    /// `CustomStringConvertible`:
    ///
    ///     struct Point: CustomStringConvertible {
    ///         let x: Int, y: Int
    ///
    ///         var description: String {
    ///             return "(\(x), \(y))"
    ///         }
    ///     }
    ///
    ///     let p = Point(x: 21, y: 30)
    ///     let s = String(describing: p)
    ///     print(s)
    ///     // Prints "(21, 30)"
    ///
    /// The conversion of `p` to a string in the assignment to `s` uses the
    /// `Point` type's `description` property.
    public var description: String { get }

    /// A textual representation of this instance, suitable for debugging.
    ///
    /// Calling this property directly is discouraged. Instead, convert an
    /// instance of any type to a string by using the `String(reflecting:)`
    /// initializer. This initializer works with any type, and uses the custom
    /// `debugDescription` property for types that conform to
    /// `CustomDebugStringConvertible`:
    ///
    ///     struct Point: CustomDebugStringConvertible {
    ///         let x: Int, y: Int
    ///
    ///         var debugDescription: String {
    ///             return "(\(x), \(y))"
    ///         }
    ///     }
    ///
    ///     let p = Point(x: 21, y: 30)
    ///     let s = String(reflecting: p)
    ///     print(s)
    ///     // Prints "(21, 30)"
    ///
    /// The conversion of `p` to a string in the assignment to `s` uses the
    /// `Point` type's `debugDescription` property.
    public var debugDescription: String { get }

    public enum MessageType : String {

        case warning

        case error

        case status

        case fatal

        /// Creates a new instance with the specified raw value.
        ///
        /// If there is no value of the type that corresponds with the specified raw
        /// value, this initializer returns `nil`. For example:
        ///
        ///     enum PaperSize: String {
        ///         case A4, A5, Letter, Legal
        ///     }
        ///
        ///     print(PaperSize(rawValue: "Legal"))
        ///     // Prints "Optional(PaperSize.Legal)"
        ///
        ///     print(PaperSize(rawValue: "Tabloid"))
        ///     // Prints "nil"
        ///
        /// - Parameter rawValue: The raw value to use for the new instance.
        public init?(rawValue: String)

Truncated.

extension

UsdRenderMessage.MessageType

NewiOSmacOStvOS
extension UsdRenderMessage.MessageType : Equatable
Declaration
extension UsdRenderMessage.MessageType : Equatable {
}
extension

UsdRenderMessage.MessageType

NewiOSmacOStvOS
extension UsdRenderMessage.MessageType : Hashable
Declaration
extension UsdRenderMessage.MessageType : Hashable {
}
extension

UsdRenderMessage.MessageType

NewiOSmacOStvOS
extension UsdRenderMessage.MessageType : RawRepresentable
Declaration
extension UsdRenderMessage.MessageType : RawRepresentable {
}
struct

USDStageComponent

NewiOSmacOStvOS
public struct USDStageComponent : Component

A component that renders a USD stage as RealityKit entities.

Attach a USDStageComponent to an entity to render USD content as child entities. The component supports two modes of operation:

  • Manual mode: Created with init(allowsHitTesting:). You control

when rendering occurs by calling render(_:to:at:).

  • Automatic mode: Created with init(_:timeCode:allowsHitTesting:).

The component manages rendering internally and updates when the stage or time code changes.

Declaration
public struct USDStageComponent : Component {

    /// The result of a render operation.
    public struct RenderResult : Sendable {

        /// The status of a render operation.
        public enum Status : Sendable {

            case completed

            case failed

            /// Returns a Boolean value indicating whether two values are equal.
            ///
            /// Equality is the inverse of inequality. For any values `a` and `b`,
            /// `a == b` implies that `a != b` is `false`.
            ///
            /// - Parameters:
            ///   - lhs: A value to compare.
            ///   - rhs: Another value to compare.
            public static func == (a: USDStageComponent.RenderResult.Status, b: USDStageComponent.RenderResult.Status) -> Bool

            /// Hashes the essential components of this value by feeding them into the
            /// given hasher.
            ///
            /// Implement this method to conform to the `Hashable` protocol. The
            /// components used for hashing must be the same as the components compared
            /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
            /// with each of these components.
            ///
            /// - Important: In your implementation of `hash(into:)`,
            ///   don't call `finalize()` on the `hasher` instance provided,
            ///   or replace it with a different instance.
            ///   Doing so may become a compile-time error in the future.
            ///
            /// - Parameter hasher: The hasher to use when combining the components
            ///   of this instance.
            public func hash(into hasher: inout Hasher)

            /// The hash value.
            ///
            /// Hash values are not guaranteed to be equal across different executions of
            /// your program. Do not save hash values to use during a future execution.
            ///
            /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
            ///   conform to `Hashable`, implement the `hash(into:)` requirement instead.
            ///   The compiler provides an implementation for `hashValue` for you.
            public var hashValue: Int { get }
        }

        /// The status of the render operation.
        public let status: USDStageComponent.RenderResult.Status

        /// Any issues encountered during the render, or an empty array if there were none.
        public let errors: [USDRenderError]
    }

    /// Whether the rendered entities support hit testing.
    /// Set at initialization and cannot be changed afterwards.
    public let allowsHitTesting: Bool

    /// Whether the component renders automatically in response to stage
    /// or time code changes. `false` indicates manual mode, in which
    /// rendering must be triggered explicitly via ``render(_:to:at:)``.
    public let rendersAutomatically: Bool

    /// The stage currently being rendered by this component, or `nil` if
    /// the component is in manual mode and no render has been performed yet.
    public var stage: USDStage? { get }

    /// The time code to render at.
    ///
    /// In automatic mode, the system reads this value to determine what
    /// time to render at. Updating this value triggers a re-render.
    /// In manual mode, this value is unused. Pass the time code directly
    /// to ``render(_:to:at:)`` instead.
    public var timeCode: USDStage.TimeCode

    /// Creates a USDStageComponent in manual mode.
    ///

Truncated.

extension

USDStageComponent

NewiOSmacOStvOS
extension USDStageComponent : Equatable
Declaration
extension USDStageComponent : Equatable {

    /// Returns a Boolean value indicating whether two values are equal.
    ///
    /// Equality is the inverse of inequality. For any values `a` and `b`,
    /// `a == b` implies that `a != b` is `false`.
    ///
    /// - Parameters:
    ///   - lhs: A value to compare.
    ///   - rhs: Another value to compare.
    nonisolated public static func == (lhs: USDStageComponent, rhs: USDStageComponent) -> Bool
}
extension

USDStageComponent.RenderResult.Status

NewiOSmacOStvOS
extension USDStageComponent.RenderResult.Status : Equatable
Declaration
extension USDStageComponent.RenderResult.Status : Equatable {
}
extension

USDStageComponent.RenderResult.Status

NewiOSmacOStvOS
extension USDStageComponent.RenderResult.Status : Hashable
Declaration
extension USDStageComponent.RenderResult.Status : Hashable {
}
typealias

UsdRenderMessage.MessageType.RawValue

NewiOSmacOStvOS
public typealias RawValue = String

The raw type that can be used to represent all values of the conforming type.

Every distinct value of the conforming type has a corresponding unique value of the RawValue type, but there may be values of the RawValue type that don't have a corresponding value of the conforming type.

No APIs match your filter.

← More in Spatial, 3D & RealityKit