New
177extension
ActionEvent
NewiOSmacOStvOSextension ActionEvent where ActionType : BehaviorTreeAction
Extends ActionEvent with behavior-tree-specific properties when the action type conforms to BehaviorTreeAction.
Declaration
extension ActionEvent where ActionType : BehaviorTreeAction {
/// The entity that owns the `BehaviorTreeComponent` and initiated this action.
///
/// This is the entity on which the behavior tree is running,.
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
public var entity: Entity? { get }
}
enum
ActionResult
NewiOSmacOStvOSpublic enum ActionResult : Sendable
Status values that an action can report back to the animation system.
Use these values within action event handlers to communicate the state of your action logic back to the animation system.
Declaration
public enum ActionResult : Sendable {
/// The action is currently running.
case running
/// The action has failed.
case failure
/// The action completed successfully.
case success
/// 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: ActionResult, b: ActionResult) -> 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
ActionResult
NewiOSmacOStvOSextension ActionResult : Equatable
Declaration
extension ActionResult : Equatable {
}
extension
ActionResult
NewiOSmacOStvOSextension ActionResult : Hashable
Declaration
extension ActionResult : Hashable {
}
extension
AnchoringComponent.AccessoryAnchoringSource
NewvisionOSextension AnchoringComponent.AccessoryAnchoringSource
Declaration
extension AnchoringComponent.AccessoryAnchoringSource {
/// Describes the type of accessory to track.
public struct AccessoryType : Codable, Equatable, Hashable {
/// The uniform type identifier for the accessory.
public let identifier: String
/// The chirality of the accessory, if applicable.
public let chirality: AnchoringComponent.Target.Chirality
/// Creates a custom accessory type with a uniform type identifier and chirality.
/// - Parameters:
/// - identifier: The uniform type identifier for the accessory.
/// - chirality: The chirality of the accessory, if applicable.
public init(identifier: String, chirality: AnchoringComponent.Target.Chirality)
/// A left-handed game controller.
public static var leftController: AnchoringComponent.AccessoryAnchoringSource.AccessoryType { get }
/// A right-handed game controller.
public static var rightController: AnchoringComponent.AccessoryAnchoringSource.AccessoryType { get }
/// Either left or right game controller.
public static var eitherController: AnchoringComponent.AccessoryAnchoringSource.AccessoryType { get }
/// A stylus device.
public static var stylus: AnchoringComponent.AccessoryAnchoringSource.AccessoryType { 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: AnchoringComponent.AccessoryAnchoringSource.AccessoryType, b: AnchoringComponent.AccessoryAnchoringSource.AccessoryType) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// 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 }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
Truncated.
extension
AnchoringComponent.Target.Chirality
NewvisionOSextension AnchoringComponent.Target.Chirality : Codable
Declaration
extension AnchoringComponent.Target.Chirality : Codable {
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
}
extension
AnimationEvents
NewiOSmacOStvOSextension AnimationEvents
Declaration
extension AnimationEvents {
/// Fired each frame when the animation graph produces a root motion delta for an entity.
///
/// By default, subscribing to this event suppresses automatic application of the root motion
/// delta. The subscriber is then fully responsible for applying or discarding it.
///
/// To observe root motion without taking over application, set
/// ``suppressesAutomaticApplication`` to `false` inside the handler:
///
/// ```swift
/// scene.subscribe(to: AnimationEvents.RootMotionDidUpdate.self, on: entity) { event in
/// event.suppressesAutomaticApplication = false
/// // Root motion is still applied automatically; use the event for observation only.
/// print("Delta: \(event.rootMotionTransform)")
/// }
/// ```
///
/// To fully control application, leave the default (`true`) and apply the transform yourself:
///
/// ```swift
/// scene.subscribe(to: AnimationEvents.RootMotionDidUpdate.self, on: entity) { event in
/// entity.transform = event.rootMotionTransform * entity.transform
/// }
/// ```
///
/// The event fires after graph evaluation but before the skeletal pose is applied to the mesh.
public struct RootMotionDidUpdate : Event {
/// The entity being animated.
public let entity: Entity
/// The change in position and orientation since the previous frame.
///
/// This is not cumulative — it represents only the delta from the last frame.
public let rootMotionTransform: Transform
/// The elapsed time since the last update.
public let deltaTime: TimeInterval
/// Controls whether subscribing suppresses automatic root motion application.
///
/// Defaults to `true` — the system will not apply root motion automatically
/// when this event has subscribers. Set to `false` to allow automatic
/// application even while observing the event.
///
/// - Note: This property only takes effect when using `scene.subscribe(to:on:)`.
/// Changes made via `scene.publisher(for:on:)` are not written back to the engine.
public var suppressesAutomaticApplication: Bool { get nonmutating set }
}
}
struct
AnimationGraphComponent
NewiOSmacOStvOSpublic struct AnimationGraphComponent : Component
A component that drives skeletal animation on an entity using a node-based animation graph.
Animation graphs blend and transition between multiple animations at runtime using a graph of connected nodes.
Use AnimationGraphComponent to attach a compiled AnimationGraphResource to an entity. RealityKit evaluates the graph each frame and writes the resulting pose to the entity's SkeletalPosesComponent.
### Attach a graph to an entity
entity.components.set(AnimationGraphComponent(resource: graphResource))
### Inspect the active graph state activeNodes reflects all nodes that contributed to the current pose. Use activeStateMachineNodes or activeClipNodes to work directly with a specific node type.
for node in component.activeStateMachineNodes {
print("Current state: \(node.currentState)")
}
for node in component.activeClipNodes {
print("Current cycle: \(node.currentCycle)")
}
Declaration
public struct AnimationGraphComponent : Component {
/// A protocol providing common debug information for any active node within a compiled animation graph.
public protocol ActiveNode : Identifiable, Sendable {
/// Returns the id of the node.
var id: Int { get }
/// Returns the name of the node.
var name: String { get }
/// Returns `true` if the node was reset during the last tick.
var wasReset: Bool { get }
}
/// Contains state machine debug information for an active state machine node within a compiled animation graph, used for inspection and debugging.
public struct ActiveStateMachineNode : AnimationGraphComponent.ActiveNode, Equatable, Sendable {
/// Returns the id of the node.
public let id: Int
/// Returns the name of the node.
public let name: String
/// Returns `true` if the node was reset during the last tick.
public var wasReset: Bool { get }
/// The ID of the current state.
public var currentState: Int { get }
/// The ID of the previous state.
public var previousState: Int { get }
/// The ID of the last active transition.
public var lastTransition: Int { 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 == (lhs: AnimationGraphComponent.ActiveStateMachineNode, rhs: AnimationGraphComponent.ActiveStateMachineNode) -> Bool
/// A type representing the stable identity of the entity associated with
/// an instance.
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
public typealias ID = Int
}
/// Contains clip debug information for an active animation clip node within a compiled animation graph, used for inspection and debugging.
public struct ActiveClipNode : AnimationGraphComponent.ActiveNode, Equatable, Sendable {
/// Returns the id of the node.
public let id: Int
/// Returns the name of the node.
public let name: String
/// Returns `true` if the node was reset during the last tick.
public var wasReset: Bool { get }
/// The current playback cycle.
public var currentCycle: Float { 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 == (lhs: AnimationGraphComponent.ActiveClipNode, rhs: AnimationGraphComponent.ActiveClipNode) -> Bool
/// A type representing the stable identity of the entity associated with
/// an instance.
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
Truncated.
extension
Audio
NewiOSmacOStvOSextension Audio
Declaration
extension Audio {
public struct Material : Hashable, Sendable {
public var name: String?
public init(name: String? = nil, absorption: Audio.Absorption, scattering: Audio.Scattering)
public func scalingAbsorption(by frequencyDependentScalar: (Float) -> Float) -> Audio.Material
public func scalingScattering(by frequencyDependentScalar: (Float) -> Float) -> Audio.Material
public static let `default`: Audio.Material
public static let concrete: Audio.Material
public static let wood: Audio.Material
public static let glass: Audio.Material
public static let metal: Audio.Material
public static let dryWall: Audio.Material
public static let plaster: Audio.Material
public static let brick: Audio.Material
public static let tile: Audio.Material
public static let curtain: Audio.Material
public static let parquet: Audio.Material
public static let carpet: Audio.Material
public static let seatingHard: Audio.Material
public static let seatingUpholstered: Audio.Material
public static let mattress: Audio.Material
public static let marble: Audio.Material
public static let soil: Audio.Material
public static let sand: Audio.Material
public static let water: Audio.Material
public static let trees: Audio.Material
public static let gravel: Audio.Material
public static let ice: Audio.Material
public static let snow: Audio.Material
/// 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: Audio.Material, b: Audio.Material) -> 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.
Truncated.
extension
Audio.Absorption
NewiOSmacOStvOSextension Audio.Absorption : ExpressibleByDictionaryLiteral
Declaration
extension Audio.Absorption : ExpressibleByDictionaryLiteral {
/// Creates an instance initialized with the given key-value pairs.
public init(dictionaryLiteral elements: (Float, Float)...)
/// The key type of a dictionary literal.
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
public typealias Key = Float
/// The value type of a dictionary literal.
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
public typealias Value = Float
}
extension
Audio.Scattering
NewiOSmacOStvOSextension Audio.Scattering : ExpressibleByDictionaryLiteral
Declaration
extension Audio.Scattering : ExpressibleByDictionaryLiteral {
/// Creates an instance initialized with the given key-value pairs.
public init(dictionaryLiteral elements: (Float, Float)...)
/// The key type of a dictionary literal.
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
public typealias Key = Float
/// The value type of a dictionary literal.
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
public typealias Value = Float
}
extension
AudioEvents
NewiOSmacOStvOSextension AudioEvents
Declaration
extension AudioEvents {
/// Group audio playback completed.
public struct PlaybackGroupCompleted : Event {
/// The audio playback group controller that triggered the event.
public var playbackController: AudioPlaybackGroupController
}
}
var
audioListener
NewiOSmacOStvOSpublic var audioListener: Entity?
The entity which defines the listener position and orientation for spatial audio.
By default this audioListener property is nil, which means that the active camera entity will be used as the audio listener. The audioListener can be set to any entity in the scene to use the transform of the entity as the audio listener position and orientation.
extension
AudioPlaybackController
NewiOSmacOStvOSextension AudioPlaybackController
Declaration
extension AudioPlaybackController {
/// Plays the audio resource asynchronously at a specified time.
///
/// Use this method to schedule playback of a sound source to a precise time in the future.
/// This method enables sample-accurate timing for individual sounds and synchronization of
/// multiple audio sources.
///
/// Any call to ``AudioPlaybackController/play()`` cancels a pending scheduled time and
/// plays audio immediately. Any call to ``AudioPlaybackController/play(at:)`` cancels a
/// pending scheduled time and reschedules to the new time. The controller ignores calls
/// to ``AudioPlaybackController/play()`` when audio is already playing.
///
/// Audio preparation must complete before the scheduled playback time to maintain precise
/// timing. If preparation is still in progress when the scheduled time arrives, or if the
/// scheduled time is in the past, playback starts immediately, which may result in timing
/// drift. For accurate synchronization, schedule a time sufficiently far in the future.
///
/// The ``AudioPlaybackController/isPlaying`` property becomes `true` immediately after
/// this call returns. Code that checks `isPlaying` to decide whether to trigger another
/// action reads the correct state without racing against the scheduled start time.
///
/// To synchronize multiple sounds, use the same base time for all scheduled playback calls.
///
/// - Parameter time: The `AVAudioTime` at which the audio resource should start playing.
/// - Throws: An error if the controller fails to schedule playback.
@MainActor @preconcurrency public func play(at time: AVAudioTime) throws
}
extension
AudioPlaybackGroupController
NewiOSmacOStvOSextension AudioPlaybackGroupController
Declaration
extension AudioPlaybackGroupController {
/// Plays all audio resources in the group asynchronously at a specified time.
///
/// Use this method to schedule playback of the group to a precise time in the future.
/// This method enables sample-accurate timing for the group and synchronization with
/// other audio sources.
///
/// Any call to ``AudioPlaybackGroupController/play()`` cancels a pending scheduled time
/// and plays audio immediately. Any call to ``AudioPlaybackGroupController/play(at:)``
/// cancels a pending scheduled time and reschedules to the new time. The controller
/// ignores calls to ``AudioPlaybackGroupController/play()`` when audio is already playing.
///
/// Audio preparation must complete before the scheduled playback time to maintain precise
/// timing. If preparation is still in progress when the scheduled time arrives, or if the
/// scheduled time is in the past, playback starts immediately, which may result in timing
/// drift. For accurate synchronization, schedule a time sufficiently far in the future.
///
/// The ``AudioPlaybackGroupController/isPlaying`` property becomes `true` immediately
/// after this call returns. Code that checks `isPlaying` to decide whether to trigger
/// another action reads the correct state without racing against the scheduled start time.
///
/// To synchronize this group with other audio sources, use the same base time for all
/// scheduled playback calls.
///
/// - Parameter time: The `AVAudioTime` at which the group should start playing.
/// - Throws: An error if the controller fails to schedule playback.
@MainActor @preconcurrency public func play(at time: AVAudioTime) throws
}
extension
AudioPlaybackGroupController
NewiOSmacOStvOSextension AudioPlaybackGroupController : Identifiable
Declaration
extension AudioPlaybackGroupController : Identifiable {
/// The stable identity of the entity associated with this instance.
@MainActor @preconcurrency public var id: UInt64 { get }
/// A type representing the stable identity of the entity associated with
/// an instance.
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
public typealias ID = UInt64
}
extension
AudioPlaybackGroupController
NewiOSmacOStvOSextension AudioPlaybackGroupController : Sendable
Declaration
extension AudioPlaybackGroupController : Sendable {
}
protocol
BehaviorTreeAction
NewiOSmacOStvOSpublic protocol BehaviorTreeAction : EntityAction
Declaration
public protocol BehaviorTreeAction : EntityAction {
}
extension
BehaviorTreeAction
NewiOSmacOStvOSextension BehaviorTreeAction
Declaration
extension BehaviorTreeAction {
/// Shadows the `EntityAction.subscribe(to:_:)` overload that takes a `-> Void` closure.
///
/// When the handler doesn't return a value, the action status is preserved: the value already
/// in `actionStatusPointer` at the time the handler is called is read and written back,
/// leaving the behavior tree's status unchanged.
@MainActor @preconcurrency public static func subscribe(to eventType: ActionEventType, _ handler: @escaping @MainActor (ActionEvent<Self>) -> Void)
@MainActor @preconcurrency public static func subscribe(to eventType: ActionEventType, _ handler: @escaping @MainActor (ActionEvent<Self>) -> ActionResult)
}
protocol
BehaviorTreeActionHandler
NewiOSmacOStvOSpublic protocol BehaviorTreeActionHandler : ActionHandlerProtocol
Declaration
public protocol BehaviorTreeActionHandler : ActionHandlerProtocol {
mutating func actionStartedWithResult(event: Self.EventType) -> ActionResult?
mutating func actionUpdatedWithResult(event: Self.EventType) -> ActionResult?
mutating func actionEndedWithResult(event: Self.EventType) -> ActionResult?
mutating func actionSkippedWithResult(event: Self.EventType) -> ActionResult?
mutating func actionPausedWithResult(event: Self.EventType) -> ActionResult?
mutating func actionResumedWithResult(event: Self.EventType) -> ActionResult?
mutating func actionTerminatedWithResult(event: Self.EventType) -> ActionResult?
}
extension
BehaviorTreeActionHandler
NewiOSmacOStvOSextension BehaviorTreeActionHandler
Declaration
extension BehaviorTreeActionHandler {
@MainActor public mutating func actionStarted(event: Self.EventType)
@MainActor public mutating func actionUpdated(event: Self.EventType)
@MainActor public mutating func actionEnded(event: Self.EventType)
@MainActor public mutating func actionSkipped(event: Self.EventType)
@MainActor public mutating func actionPaused(event: Self.EventType)
@MainActor public mutating func actionResumed(event: Self.EventType)
@MainActor public mutating func actionTerminated(event: Self.EventType)
public mutating func actionStartedWithResult(event: Self.EventType) -> ActionResult?
public mutating func actionUpdatedWithResult(event: Self.EventType) -> ActionResult?
public mutating func actionEndedWithResult(event: Self.EventType) -> ActionResult?
public mutating func actionSkippedWithResult(event: Self.EventType) -> ActionResult?
public mutating func actionPausedWithResult(event: Self.EventType) -> ActionResult?
public mutating func actionResumedWithResult(event: Self.EventType) -> ActionResult?
public mutating func actionTerminatedWithResult(event: Self.EventType) -> ActionResult?
}
struct
BehaviorTreeComponent
NewiOSmacOStvOSpublic struct BehaviorTreeComponent : Component
Declaration
public struct BehaviorTreeComponent : Component {
/// Accesses the current behavior tree. Note that setting the behavior tree to a tree not in
/// `availableBehaviorTrees` will add a uniquely-named entry for the tree in `availableBehaviorTrees`.
public var behaviorTree: BehaviorTreeResource?
/// All the behavior trees that this component can access.
public var availableBehaviorTrees: [String : BehaviorTreeResource]
public init(behaviorTree: BehaviorTreeResource?, availableBehaviorTrees: [String : BehaviorTreeResource])
}
struct
BlendShapeDeformer
NewiOSmacOStvOSpublic struct BlendShapeDeformer : MeshDeformer
A blend-shape deformation that interpolates between N meshes according to a weighted sum. Consumes information from the BlendShapeWeightsComponent
Declaration
public struct BlendShapeDeformer : MeshDeformer {
/// default implementation is provided
public func isDeformerEqual(other: any MeshDeformer) -> Bool
/// Provide a unique identifier for type of deformer.
/// There can only be one `deform` function associated with each type String. However,
/// each `deform` can vary greatly based on run time options and input.
public static var type: String { get }
/// deform the mesh on the GPU (the preferred method)
public func deform(parameter: MeshDeformParameterGPU, encoder: any MTLComputeCommandEncoder)
public init()
/// 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: BlendShapeDeformer, b: BlendShapeDeformer) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
BloomComponent
NewiOSmacOStvOSpublic struct BloomComponent : Component
The BloomComponent adds a luminous glow effect around bright objects in the scene by extracting and blurring the brightest parts of the image, then combining them back with the original rendering. If scope is set to unbounded Bloom will be computed on the entire screen. If scope is set to hierarchical multiple Bloom Components can be used to opt in only the regions around certain objects for blooming.
Note: On visionOS, Bloom only works in an immersive space and will have no effect in a shared space.
To adjust the appearance of the bloom effect, you also need a BloomSettingsComponent
Example Code:
// Add the bloom component to the root and set it to unbounded.
// This enables bloom in the scene with default parameters
var bloomComponent = BloomComponent()
bloomComponent.scope = .unbounded
self.root.components.set(bloomComponent)
// Add the bloom settings component to the root.
// Set strength 1 for a bright effect and threshold 0 so that
// everything blooms no matter how dim.
var bloomSettingsComponent = BloomSettingsComponent()
bloomSettingsComponent.strength = 1
bloomSettingsComponent.threshold = 0
self.root.components.set(bloomSettingsComponent)
Declaration
public struct BloomComponent : Component {
public struct BloomScope : Sendable, Equatable {
/// Bloom is restricted to the bounding box of the attached entity's mesh hierarchy.
public static let hierarchical: BloomComponent.BloomScope
/// Bloom is computed on the entire screen with no bounding box restriction.
public static let unbounded: BloomComponent.BloomScope
/// 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: BloomComponent.BloomScope, b: BloomComponent.BloomScope) -> Bool
}
/// Creates a Bloom Component.
///
/// Default scope is .unbounded
public init()
/// Creates a BloomComponent with the specified scope.
///
/// - Parameter scope: The bloom scope. Defaults to ``BloomScope/unbounded``.
public init(scope: BloomComponent.BloomScope = .unbounded)
/// The scope of where bloom will be computed
///
/// If set to unbounded, bloom will be computed on the entire screen.
///
/// If set to hierarchical, bloom will only be computed in regions near the entity hierarchy beneath all bloom components.
/// This is useful to reduce the cost of bloom, but can create artifacts if something bright enough to bloom is not contained within the hierarchy.
public var scope: BloomComponent.BloomScope
}
struct
BloomOptionsComponent
NewiOSmacOStvOSpublic struct BloomOptionsComponent : Component
A component that sets the properties for the bloom post-processing effects.
This component has no effect without a BloomComponent in your scene.
It's best to maintain a single BloomOptionsComponent in your scene. If more than one BloomOptionsComponent exists in your scene, one will be chosen based on proximity to the camera and depth in the entity hierarchy.
Declaration
public struct BloomOptionsComponent : Component {
/// Creates a Bloom Options Component with default settings.
///
/// The default configuration provides a moderate bloom effect with:
/// - `strength`: 0.25 (25% bloom intensity)
/// - `threshold`: 1.0 (pixels brighter than 1.0 will bloom)
/// - `blurRadius`: 6 (6% of viewport height)
public init()
/// The intensity of the bloom effect.
///
/// Higher values create a more pronounced glow effect. The values can be
/// be in the range `[0.0, 2.0]`, where:
/// - `0.0` disables the bloom effect entirely
/// - `0.25` provides a subtle bloom (default)
/// - `1.0` creates a strong, dramatic bloom effect
/// - `>1` extremely intense effects but may have some visual artifacts
public var strength: Float
/// The brightness threshold for bloom activation.
///
/// Only pixels with luminance values above this threshold will contribute
/// to the bloom effect. The value is typically in the range `[0.0, 1.x]`:
/// - `0.0` makes all pixels contribute to bloom
/// - `1.0` standard threshold for HDR content (default)
/// - `>1` only very bright highlights will bloom
///
/// Higher thresholds create more selective bloom that only affects the
/// brightest elements in the scene.
public var threshold: Float
/// The width of the bloom blur kernel as a percentage of viewport height
///
/// Valid range: `[3, 12]`
public var blurRadius: Float
}
struct
BloomSettingsComponent
NewiOSmacOStvOSpublic struct BloomSettingsComponent : Component
A component that sets the properties for the bloom post-processing effects.
This component has no effect without a BloomComponent in your scene.
It's best to maintain a single BloomSettingsComponent in your scene. If more than one BloomSettingsComponent exists in your scene, one will be chosen based on proximity to the origin and depth in the entity hierarchy.
Declaration
public struct BloomSettingsComponent : Component {
/// Creates a Bloom Settings Component with default settings.
///
/// The default configuration provides a moderate bloom effect with:
/// - `strength`: 0.25 (25% bloom intensity)
/// - `threshold`: 1.0 (pixels brighter than 1.0 will bloom)
/// - `blurRadius`: 6 (6% of screen width)
public init()
/// The intensity of the bloom effect.
///
/// Higher values create a more pronounced glow effect. The values can be
/// be in the range `[0.0, 2.0]`, where:
/// - `0.0` disables the bloom effect entirely
/// - `0.25` provides a subtle bloom (default)
/// - `1.0` creates a strong, dramatic bloom effect
/// - `>1` extremely intense effects but may have some visual artifacts
public var strength: Float
/// The brightness threshold for bloom activation.
///
/// Only pixels with luminance values above this threshold will contribute
/// to the bloom effect. The value is typically in the range `[0.0, 1.x]`:
/// - `0.0` makes all pixels contribute to bloom
/// - `1.0` standard threshold for HDR content (default)
/// - `>1` only very bright highlights will bloom
///
/// Higher thresholds create more selective bloom that only affects the
/// brightest elements in the scene.
public var threshold: Float
/// The width of the bloom blur kernel as a percentage of screen width
///
/// Valid range: `[3, 12]`
public var blurRadius: Float
}
struct
CalculateBoundingBoxDeformer
NewiOSmacOStvOSpublic struct CalculateBoundingBoxDeformer : MeshDeformer
Calculates a bounding box based on the current state of the deformed positions.
Declaration
public struct CalculateBoundingBoxDeformer : MeshDeformer {
/// default implementation is provided
public func isDeformerEqual(other: any MeshDeformer) -> Bool
/// Provide a unique identifier for type of deformer.
/// There can only be one `deform` function associated with each type String. However,
/// each `deform` can vary greatly based on run time options and input.
public static var type: String { get }
/// deform the mesh on the GPU (the preferred method)
public func deform(parameter: MeshDeformParameterGPU, encoder: any MTLComputeCommandEncoder)
public init()
/// 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: CalculateBoundingBoxDeformer, b: CalculateBoundingBoxDeformer) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
ClippingComponent
NewiOSmacOStvOSpublic struct ClippingComponent : Component, Equatable
A component that clips entities and their children to a customizable bounding box volume with feathered edges.
The ClippingComponent provides a powerful and performant way to clip content in RealityKit. It's particularly useful for:
- Creating soft-edge effects with feathered boundaries instead of hard cuts
- Creating polished spatial experiences with hierarchical clipping control
Add a ClippingComponent to an entity by passing it to an entity's set() method.
let windowEntity = Entity()
let bounds = BoundingBox(min: SIMD3<Float>(-10, -10, -10), max: SIMD3<Float>(10, 10, 10))
var clipping = ClippingComponent(bounds: bounds)
clipping.featheredEdge.falloff = .linear
clipping.featheredEdge.positiveEdgeInset = [2, 2, 0.0] // 2-unit feather zone on +X & +Y edges
clipping.featheredEdge.negativeEdgeInset = [0.0, 0.0, 0.0] // no feathering on negative edges
clipping.shouldClipSelf = true
clipping.shouldClipChildren = true
windowEntity.components.set(clipping)
Declaration
public struct ClippingComponent : Component, Equatable {
/// The bounding box that defines the clipping region in the entity's local coordinate space.
///
/// Content outside this bounding box will be clipped (hard edge or faded out based on feathering).
/// The bounds are defined relative to the entity's origin and are affected by the entity's
/// transform.
///
public var bounds: BoundingBox
/// Configuration for feathering the clipping boundaries.
///
/// Feathering is defined separately for positive and negative edges of each axis, providing fine-grained control
/// over how content fades out near the clipping bounds.
public struct FeatheredEdge : Equatable {
public enum Falloff {
case linear
case cubic
/// 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: ClippingComponent.FeatheredEdge.Falloff, b: ClippingComponent.FeatheredEdge.Falloff) -> 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 falloff function used for the feathered edge computation.
public var falloff: ClippingComponent.FeatheredEdge.Falloff
/// The distance from each positive edge (+X, +Y, +Z) of the clip bounds over which opacity fades to 0,
/// expressed in local coordinate space units.
///
/// Values range from `0.0` to the half-extent of the bounding box on each axis. For example:
/// - `0.0` means no feathering on that edge.
/// - An inset distance value of `2.0`on X axis creates a 2-unit feather zone inward from the +X edge.
public var positiveEdgeInset: SIMD3<Float>
/// The distance from each negative edge (-X, -Y, -Z) of the clip bounds over which opacity fades to 0,
/// expressed in local coordinate space units.
///
/// Values range from `0.0` to the half-extent of the bounding box on each axis. For example:
/// - `0.0` means no feathering on that edge.
/// - An inset distance value of `2.0` on X axis creates a 2-unit feather zone inward from the -X edge.
public var negativeEdgeInset: SIMD3<Float>
/// Initializes both ``positiveEdgeInset`` and ``negativeEdgeInset`` with the same symmetric value.
Truncated.
extension
ClippingComponent.FeatheredEdge.Falloff
NewiOSmacOStvOSextension ClippingComponent.FeatheredEdge.Falloff : Equatable
Declaration
extension ClippingComponent.FeatheredEdge.Falloff : Equatable {
}
extension
ClippingComponent.FeatheredEdge.Falloff
NewiOSmacOStvOSextension ClippingComponent.FeatheredEdge.Falloff : Hashable
Declaration
extension ClippingComponent.FeatheredEdge.Falloff : Hashable {
}
struct
ClippingPrimitiveComponent
NewiOSmacOStvOSpublic struct ClippingPrimitiveComponent : Component, Equatable
Use ClippingComponent instead
Declaration
public struct ClippingPrimitiveComponent : Component, Equatable {
/// The bounding box that defines the clipping region in the entity's local coordinate space.
///
/// Content outside this bounding box will be clipped (hard edge or faded out based on feathering).
/// The bounds are defined relative to the entity's origin and are affected by the entity's
/// transform.
///
/// Default value is a zero-size bounding box.
public var bounds: BoundingBox
/// Configuration for feathering the clipping boundaries.
///
/// Feathering is defined separately for positive and negative edges of each axis, providing fine-grained control
/// over how content fades out near the clipping bounds.
public struct Feather : Equatable {
public enum Falloff {
case linear
case cubic
/// 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: ClippingPrimitiveComponent.Feather.Falloff, b: ClippingPrimitiveComponent.Feather.Falloff) -> 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 falloff function used for the feathering computation.
public var falloff: ClippingPrimitiveComponent.Feather.Falloff
/// Feather interval over which opacity lerps to 0 for positive edges (i.e +X, +Y, +Z) of the clip bounds. Expressed as a fraction of the smallest dimension of the clipping volume
/// Values range from `0.0` to `1.0`:
/// - `0.0` means no feathering on that edge
/// - `0.1` means fade across 10% of the bounding box dimension in the positive axes
/// - `1.0` means the feather zone extends across the entire positive box dimension
public var fractionPerPositiveEdge: SIMD3<Float>
/// Feather interval over which opacity lerps to 0 for negative edges (i.e -X, -Y, -Z) of the clip bounds. Expressed as a fraction of the smallest dimension of the clipping volume
/// Values range from `0.0` to `1.0`:
/// - `0.0` means no feathering on that edge
/// - `0.1` means fade across 10% of the bounding box dimension in the negative axes
/// - `1.0` means the feather zone extends across the entire negative box dimension
public var fractionPerNegativeEdge: SIMD3<Float>
public init()
Truncated.
extension
ClippingPrimitiveComponent.Feather.Falloff
NewiOSmacOStvOSextension ClippingPrimitiveComponent.Feather.Falloff : Equatable
Declaration
extension ClippingPrimitiveComponent.Feather.Falloff : Equatable {
}
extension
ClippingPrimitiveComponent.Feather.Falloff
NewiOSmacOStvOSextension ClippingPrimitiveComponent.Feather.Falloff : Hashable
Declaration
extension ClippingPrimitiveComponent.Feather.Falloff : Hashable {
}
struct
DiffuseLightProbeGroupComponent
NewiOSmacOStvOSpublic struct DiffuseLightProbeGroupComponent : Component
A component that stores diffuse probe data for a spatial region.
Attach this component to an entity to designate it as a diffuse probe group — a positioned source of baked diffuse lighting. Other entities can reference this group via DiffuseLightProbeReceiverComponent to receive spatially-varying diffuse illumination.
This follows the same source/receiver pattern as ImageBasedLightComponent / ImageBasedLightReceiverComponent.
let probeGroup = Entity()
probeGroup.components[DiffuseLightProbeGroupComponent.self] =
DiffuseLightProbeGroupComponent(resource: probeResource)
## See Also
DiffuseProbeResourceDiffuseLightProbeReceiverComponent
Declaration
public struct DiffuseLightProbeGroupComponent : Component {
/// The diffuse probe resource containing baked lighting data for this group.
public var resource: DiffuseProbeResource
/// Creates a diffuse light probe group component.
///
/// - Parameter resource: The probe resource containing baked lighting data.
public init(resource: DiffuseProbeResource)
}
struct
DiffuseLightProbeReceiverComponent
NewiOSmacOStvOSpublic struct DiffuseLightProbeReceiverComponent : Component, Equatable
A component that receives diffuse lighting from a referenced probe group.
Attach this component to entities that should receive spatially-varying diffuse indirect lighting. As the entity moves through the scene, the system automatically interpolates diffuse lighting from the probe group based on the entity's current position.
This follows the same receiver pattern as ImageBasedLightReceiverComponent.
character.components[DiffuseLightProbeReceiverComponent.self] =
DiffuseLightProbeReceiverComponent(probeGroup: probeGroupEntity)
## See Also
DiffuseLightProbeGroupComponentDiffuseProbeResource
Declaration
public struct DiffuseLightProbeReceiverComponent : Component, Equatable {
/// The entity providing diffuse probe lighting to this receiver.
///
/// The referenced entity must have a ``DiffuseLightProbeGroupComponent`` attached and must
/// exist within the scene hierarchy. The receiver's diffuse lighting is interpolated from
/// probes in this group based on the receiver entity's position.
public var probeGroup: Entity
/// Creates a diffuse light probe receiver component.
///
/// - Parameter probeGroup: An entity with a ``DiffuseLightProbeGroupComponent`` attached.
public init(probeGroup: Entity)
/// 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 == (lhs: DiffuseLightProbeReceiverComponent, rhs: DiffuseLightProbeReceiverComponent) -> Bool
}
extension
DirectionalLightComponent
NewiOSmacOStvOSextension DirectionalLightComponent
Declaration
extension DirectionalLightComponent {
/// The layers this light illuminates. Only entities whose RenderLayerComponent.layers intersect with these layers will be illuminated.
public var layers: RenderLayer.Set
}
extension
DirectionalLightComponent.Shadow
NewiOSmacOStvOSextension DirectionalLightComponent.Shadow
Declaration
extension DirectionalLightComponent.Shadow {
/// The layers from which this light accepts shadow casters. If nil, uses layers for shadow casting.
/// Only entities whose RenderLayerComponent.layers intersect with these layers will cast shadows in this light's shadow map.
/// If `nil`, the light uses its `layers` for shadow casting. Set to an empty set to disable shadow casting entirely.
public var layers: RenderLayer.Set?
/// Creates a directional light shadow with the specified layers.
/// - Parameter layers: The layers from which this light accepts shadow casters. If nil, uses layers for shadow casting.
public init(layers: RenderLayer.Set? = nil)
}
extension
Entity.ConfigurationCatalog
NewiOSmacOStvOSextension Entity.ConfigurationCatalog
Declaration
extension Entity.ConfigurationCatalog {
/// Writes the configurations of the configuration catalog to a reality file.
///
/// Another configuration catalog instance can open the `.reality` file for reading.
///
/// - Parameters:
/// - url: The destination where the configuration catalog writes the `.reality` file.
/// - options: Options for writing the `.reality` file.
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
nonisolated(nonsending) public func write(to url: URL, options: Entity.WriteOptions) async throws
}
struct
HairLightingModel
NewiOSmacOStvOSpublic struct HairLightingModel : Equatable, Hashable, Sendable
Configuration for RealityKit's hair lighting model.
Declaration
public struct HairLightingModel : Equatable, Hashable, Sendable {
public init()
/// 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: HairLightingModel, b: HairLightingModel) -> 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 }
}
protocol
HasSceneUnderstanding
NewmacOSpublic protocol HasSceneUnderstanding : Entity
A specification that detects and reacts to features of the physical environment.
Declaration
@MainActor @preconcurrency public protocol HasSceneUnderstanding : Entity {
}
extension
HasSceneUnderstanding
NewmacOSextension HasSceneUnderstanding
Declaration
extension HasSceneUnderstanding {
/// An entity component that detects and reacts to features of the physical
/// environment.
@MainActor @preconcurrency public var sceneUnderstanding: SceneUnderstandingComponent { get }
}
extension
IKRig
NewiOSmacOStvOSextension IKRig
Declaration
extension IKRig {
/// Creates an IK rig from a joint hierarchy.
///
/// - Parameters:
/// - name: The name to associate with the rig.
/// - rootJoint: The root joint of the skeleton hierarchy to derive the rig from.
/// - Throws: If the joint hierarchy contains invalid data.
public init(named name: String, rootJoint: SkeletonResource.Joint) throws
}
init
init
NewmacOSpublic convenience init(positions: [SIMD3<Float>], coefficients: [InlineArray<3, SIMD4<Float>>], tetrahedronIndices: [SIMD4<UInt16>]) throws
Creates a diffuse probe resource from arrays of probe data.
Parameters
positions- The 3D positions of each probe, in local space relative to the probe group entity. Must contain at least 4 positions to form a valid tetrahedral mesh.
coefficients- Spherical harmonic coefficients for each probe. Each entry contains exactly 3
SIMD4<Float> values — one per RGB channel, ordered as (L0, L1.x, L1.y, L1.z). Must have the same count as positions. tetrahedronIndices- Indices defining the tetrahedral mesh connectivity. Each
SIMD4<UInt16> references 4 probe positions by index into positions. Must contain at least 1 tetrahedron, and all indices must be less than positions.count.
ReturnsThrows: An error if the data is invalid — for example, if positions.count and coefficients.count differ, if fewer than 4 probes are provided, or if any tetrahedral index is out of bounds.
struct
LevelOfDetailComponent
NewiOSmacOStvOSpublic struct LevelOfDetailComponent : Component
A component that enables Level of Detail (LOD) optimization for entities with multiple detail levels.
The component allows entities to automatically show/hide child entities based on viewing conditions, reducing rendering complexity for distant or small objects.
Declaration
public struct LevelOfDetailComponent : Component {
/// An array of entities representing a single detail level.
/// Entities within a level are shown or hidden together based on LOD selection.
public typealias DetailLevel = [Entity]
/// The strategy used to select which detail level to display.
public struct SelectionStrategy {
public struct ResolutionMetric {
/// A struct containing the ideal switching resolutions for a single detail level in a `LevelOfDetailComponent` when viewed from a specific direction. Note that switching may not actually occur at these resolutions depending on device performance.
public struct DirectionalSwitchingResolutions {
public init(positiveX: Float, negativeX: Float, positiveY: Float, negativeY: Float, positiveZ: Float, negativeZ: Float)
/// Creates an empty `DirectionalSwitchingResolutions` for the base level.
public init()
public var positiveX: Float
public var negativeX: Float
public var positiveY: Float
public var negativeY: Float
public var positiveZ: Float
public var negativeZ: Float
}
/// Creates a resolution metric for a level of detail component to switch with.
/// - Parameters:
/// - switchingResolutions: An array of `DirectionalSwitchingResolutions`. The `DirectionalSwitchingResolutions` at index `i` corresponds to the LOD level `i + 1`.
/// - boundingBox: The bounding box of the entity used when calculating the switching resolutions.
public init(switchingResolutions: [LevelOfDetailComponent.SelectionStrategy.ResolutionMetric.DirectionalSwitchingResolutions], boundingBox: BoundingBox)
public var switchingResolutions: [LevelOfDetailComponent.SelectionStrategy.ResolutionMetric.DirectionalSwitchingResolutions]
public let boundingBox: BoundingBox
}
/// Creates a resolution metric for a level of detail component to switch with.
/// - Parameters:
/// - switchingResolutions: An array of `ResolutionMetric.DirectionalSwitchingResolutions`. The `ResolutionMetric.DirectionalSwitchingResolutions` at index `i` corresponds to the LOD level `i + 1`.
/// - boundingBox: The bounding box of the entity used when calculating the switching resolutions .
/// - Returns: A configured resolution metric selection strategy.
public static func resolutionMetric(switchingResolutions: [LevelOfDetailComponent.SelectionStrategy.ResolutionMetric.DirectionalSwitchingResolutions], boundingBox: BoundingBox) -> LevelOfDetailComponent.SelectionStrategy
/// Switch levels based on distance from the camera.
///
/// Each threshold specifies the maximum camera distance for a level.
/// The last threshold is typically `.infinity` to catch all remaining distances.
public static func cameraDistance(_ thresholds: [Float]) -> LevelOfDetailComponent.SelectionStrategy
/// Switch levels based on projected screen area (0.0 = invisible, 1.0 = fills screen).
///
/// Each threshold specifies the minimum screen area for a level, in descending order.
public static func screenArea(_ thresholds: [Float]) -> LevelOfDetailComponent.SelectionStrategy
}
/// Controls whether LOD selection is automatic or manually overridden.
public struct LevelSelection {
/// Use automatic LOD selection based on the configured strategy.
public static let automatic: LevelOfDetailComponent.LevelSelection
/// Override automatic selection and always display the specified level index.
public static func fixed(_ level: Int) -> LevelOfDetailComponent.LevelSelection
}
/// Creates a new Level of Detail component.
/// - Parameters:
/// - levels: Array of detail levels, where each level contains entities to show at that level.
/// - strategy: The selection strategy with threshold values.
public init(levels: [LevelOfDetailComponent.DetailLevel], switchingAt strategy: LevelOfDetailComponent.SelectionStrategy)
public var levels: [LevelOfDetailComponent.DetailLevel]
Truncated.
enum
LightingModel
NewiOSmacOStvOSpublic enum LightingModel : Equatable, Hashable, Sendable
The lighting model used by a Program.
This must match the type of the surface output node in the ShaderGraph. For example, a graph whose surface node is a PBR surface shader requires .lit.
Declaration
public enum LightingModel : Equatable, Hashable, Sendable {
case lit(LitLightingModel)
case hair(HairLightingModel)
case unlit(UnlitLightingModel)
public static func lit(diffuseModel: LitLightingModel.DiffuseModel = .hammon, specularModel: LitLightingModel.SpecularModel = .ggx, isSubsurfaceScatteringEnabled: Bool = false, isMultiscatteringEnabled: Bool = true, isBentNormalEnabled: Bool = false, isClearcoatEnabled: Bool = false) -> LightingModel
public static func hair() -> LightingModel
public static func unlit(isTonemappingEnabled: Bool = true) -> LightingModel
/// 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: LightingModel, b: LightingModel) -> 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 }
}
struct
LightmapComponent
NewiOSmacOStvOSpublic struct LightmapComponent : Component
Declaration
public struct LightmapComponent : Component {
public typealias EntityIndex = Int
/// A dictionary mapping the descendants of the LightmapComponent-holding entity
/// to their corresponding slot in the Lightmap resource.
public var entityIndexInLightmapResource: [Entity : LightmapComponent.EntityIndex]
/// The LightmapResource backing this component.
public var lightmap: LightmapResource
public var indirectIrradianceContributionScale: Float
public init(resource: LightmapResource)
/// Material that should be used on lightmapped entities using the "beauty" bake type.
/// This material only reads the lightmap data and does not perform shading calculations at runtime.
public struct FinalShadedColorBakeMaterial : Material {
public init()
}
}
extension
LightmapResource.BakeType
NewiOSmacOStvOSextension LightmapResource.BakeType : Equatable
Declaration
extension LightmapResource.BakeType : Equatable {
}
extension
LightmapResource.BakeType
NewiOSmacOStvOSextension LightmapResource.BakeType : Hashable
Declaration
extension LightmapResource.BakeType : Hashable {
}
struct
LitLightingModel
NewiOSmacOStvOSpublic struct LitLightingModel : Equatable, Hashable, Sendable
Configuration for RealityKit's physically based lighting model.
Declaration
public struct LitLightingModel : Equatable, Hashable, Sendable {
/// The diffuse lighting algorithm used in a ``LitLightingModel``.
public enum DiffuseModel : Equatable, Hashable, Sendable {
/// Hammon diffuse, a physically based model that accounts for roughness.
case hammon
/// Lambertian diffuse, a simple and performant constant-factor model.
case lambertian
/// Oren-Nayar diffuse, a roughness-aware model suited to matte surfaces.
case orenNayar
/// 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: LitLightingModel.DiffuseModel, b: LitLightingModel.DiffuseModel) -> 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 specular lighting algorithm used in a ``LitLightingModel``.
public enum SpecularModel : Equatable, Hashable, Sendable {
/// GGX (Trowbridge-Reitz) specular, a physically based microfacet model.
case ggx
/// Blinn-Phong specular, a simple and performant approximation.
case blinnPhong
/// Sheen specular, designed for cloth and fabric surfaces.
case sheen
/// Anisotropic GGX specular, for surfaces with directional highlight variation such as brushed metal.
case anisotropicGGX
/// 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: LitLightingModel.SpecularModel, b: LitLightingModel.SpecularModel) -> Bool
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
Truncated.
extension
LowLevelTexture
NewiOSmacOStvOSextension LowLevelTexture
Declaration
extension LowLevelTexture {
/// Creates a low-level texture from an existing ``LowLevelDeviceResource`` created and managed by the application.
///
/// - Parameter deviceResource: The underlying texture this object should refer to.
/// - Parameter commandBuffer: The <doc://com.apple.documentation/documentation/metal/mtlcommandbuffer>
/// you intend to use for texture modifications.
/// RealityKit waits for the command buffer to complete before utilizing the texture for rendering.
@MainActor public convenience init(deviceResource: LowLevelDeviceResource, using commandBuffer: (any MTLCommandBuffer)? = nil) throws
/// Replaces this object's underlying texture with an existing ``LowLevelDeviceResource`` created and managed by the application.
///
/// While it's valid to replace a LowLevelTexture with an externally-managed texture having different dimensions,
/// the LowLevelTexture will remember its initial size and calling replace(using:) to obtain a new MTLTexture will respect the initial size.
///
/// - Parameter deviceResource: The underlying texture this object should refer to.
/// - Parameter commandBuffer: The <doc://com.apple.documentation/documentation/metal/mtlcommandbuffer>
/// you intend to use for texture modifications.
/// RealityKit waits for the command buffer to complete before utilizing the texture for rendering.
@MainActor public func replace(deviceResource: LowLevelDeviceResource, using commandBuffer: (any MTLCommandBuffer)? = nil)
}
struct
MeshDeformationStack
NewiOSmacOStvOSpublic struct MeshDeformationStack : Sendable, Equatable, Codable
A set of MeshDeformers to apply in order to a mesh, or a proper subset of the mesh specified by Targets. If at any point, a deformer in the stack updates, all deformers later in the stack will also update.
Declaration
public struct MeshDeformationStack : Sendable, Equatable, Codable {
/// Returns a Boolean value indicating whether two values are equal.
public static func == (lhs: MeshDeformationStack, rhs: MeshDeformationStack) -> Bool
/// The `Deformers` to apply in order to a mesh.
public var deformers: [any MeshDeformer]
/// The set of `MeshScope`s that will be deformed by the `MeshDeformationStack`.
public var targets: [MeshScope]
/// Default empty initializer
public init()
/// Initializer deformers, and target configurations.
public init(deformers: [any MeshDeformer], targets: [MeshScope])
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
}
typealias
MeshDeformCPUBufferInput
NewiOSmacOStvOSpublic typealias MeshDeformCPUBufferInput = UnsafeBufferPointer<UInt8>
The underlying type of deformer input data buffers for the CPU functions.
typealias
MeshDeformCPUBufferOutput
NewiOSmacOStvOSpublic typealias MeshDeformCPUBufferOutput = UnsafeMutableBufferPointer<UInt8>
The underlying type of deformer output data buffers for the CPU functions.
protocol
MeshDeformer
NewiOSmacOStvOSpublic protocol MeshDeformer : Decodable, Encodable, Equatable, Sendable
An interface for all deformation types in a deformation definition, both built-in and custom. The users overrides all functions to implement a custom MeshDeformer, and can in general ignore all but the constructors for built-in deformers.
Declaration
public protocol MeshDeformer : Decodable, Encodable, Equatable, Sendable {
/// specify which `deform` function will be called, default implementation is provided
static var mode: MeshDeformerExecutionMode { get }
/// Provide a unique identifier for type of deformer.
/// There can only be one `deform` function associated with each type String. However,
/// each `deform` can vary greatly based on run time options and input.
static var type: String { get }
/// deform the mesh on the GPU (the preferred method)
func deform(parameter: MeshDeformParameterGPU, encoder: any MTLComputeCommandEncoder)
/// deform the mesh on the CPU (may be useful for debugging), a no-op is allowed, default implementation is provided
func deform(parameter: MeshDeformParameterCPU)
/// default implementation is provided
func isDeformerEqual(other: any MeshDeformer) -> Bool
/// specify which `deform` function will be called, default implementation is provided
var mode: MeshDeformerExecutionMode { get }
/// provide options for the deformer, default implementation is provided
var options: MeshDeformerOptions { get }
/// provide a unique identifier for type of deformer, default implementation provided
var type: String { get }
}
extension
MeshDeformer
NewiOSmacOStvOSextension MeshDeformer
extension to simplify creating custom deformers
Declaration
extension MeshDeformer {
/// defaults to `.gpu`
public static var mode: MeshDeformerExecutionMode { get }
/// default implementation for convenience
public var mode: MeshDeformerExecutionMode { get }
/// default implementation for convenience
public var type: String { get }
/// default implementaiton for `cpu` version of `deform` as its primary intention is to aid debugging
public func deform(parameter: MeshDeformParameterCPU)
/// returns default `MeshDeformerOptions`
public var options: MeshDeformerOptions { get }
}
struct
MeshDeformerComponent
NewiOSmacOStvOSpublic struct MeshDeformerComponent : Component
The component that applies mesh deformations to an Entity.
Declaration
public struct MeshDeformerComponent : Component {
/// the deformations applied the entity
public var deformations: [MeshDeformationStack]
/// Validates the deformation and throws errors if a configuration problem is detected.
public init(from: [MeshDeformationStack]) throws
}
enum
MeshDeformerExecutionMode
NewiOSmacOStvOSpublic enum MeshDeformerExecutionMode : Sendable, Equatable, Codable
Specifies which MesDeformer.deform function will be called when used with custom deformers.
Declaration
public enum MeshDeformerExecutionMode : Sendable, Equatable, Codable {
/// specifies calling `MeshDeformer.deform(parameter: MeshDeformParameterGPU, encoder: any MTLComputeCommandEncoder)`
case gpu
/// specifies calling `MeshDeformer.deform(parameter: MeshDeformParameterCPU)`
case cpu
/// 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: MeshDeformerExecutionMode, b: MeshDeformerExecutionMode) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// 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 }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
extension
MeshDeformerExecutionMode
NewiOSmacOStvOSextension MeshDeformerExecutionMode : Hashable
Declaration
extension MeshDeformerExecutionMode : Hashable {
}
struct
MeshDeformerOptions
NewiOSmacOStvOSpublic struct MeshDeformerOptions : Sendable, Equatable, Codable
Specifies constant options for MeshDeformer
Declaration
public struct MeshDeformerOptions : Sendable, Equatable, Codable {
/// Specifies when RealityKit applies the custom deformer functions.
public enum Cadence : Sendable, Equatable, Codable {
/// Applies the custom deformer function only when you request it.
/// You can explicitly request the deformer function to be called by setting new input.
/// Like all other deformers, the deformer updates again if a previous deformer in the `MeshDeformationStack` updates.
case onDemand
/// Applies the custom deformer function automatically, every frame.
case everyFrame
/// 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: MeshDeformerOptions.Cadence, b: MeshDeformerOptions.Cadence) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// 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 }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
/// Determines the update frequence for the defomer type.
public let cadence: MeshDeformerOptions.Cadence
/// The expected vertex buffer input spec for the deformer type.
///
/// This is used to determine dependencies lower in the deformation stack that may re-trigger this deformation.
public let inputSpec: MeshDeformerVertexOptions
/// The expected vertex buffer output spec for the deformer type.
public let outputSpec: MeshDeformerVertexOptions
Truncated.
extension
MeshDeformerOptions.Cadence
NewiOSmacOStvOSextension MeshDeformerOptions.Cadence : Hashable
Declaration
extension MeshDeformerOptions.Cadence : Hashable {
}
struct
MeshDeformerVertexOptions
NewiOSmacOStvOSpublic struct MeshDeformerVertexOptions : OptionSet, Sendable, Equatable, Codable, Hashable
MeshDeformerVertexOptions allows developers to specify which vertex types in the mesh to allocate in the input and output buffers for mesh deformations.
Declaration
public struct MeshDeformerVertexOptions : OptionSet, Sendable, Equatable, Codable, Hashable {
/// Specifies positions only.
public static var positions: MeshDeformerVertexOptions { get }
/// Specifies normals only.
public static var normals: MeshDeformerVertexOptions { get }
/// Specifies tangents only.
public static var tangents: MeshDeformerVertexOptions { get }
/// Specifies bitangents only.
public static var bitangents: MeshDeformerVertexOptions { get }
/// Specifies uvs only.
public static var uvs: MeshDeformerVertexOptions { get }
/// Specifies uv1s only.
public static var uv1s: MeshDeformerVertexOptions { get }
/// Specifies uv2s only.
public static var uv2s: MeshDeformerVertexOptions { get }
/// Specifies uv3s only.
public static var uv3s: MeshDeformerVertexOptions { get }
/// Specifies uv4s only.
public static var uv4s: MeshDeformerVertexOptions { get }
/// Specifies uv5s only.
public static var uv5s: MeshDeformerVertexOptions { get }
/// Specifies uv6s only.
public static var uv6s: MeshDeformerVertexOptions { get }
/// Specifies uv7s only.
public static var uv7s: MeshDeformerVertexOptions { get }
/// Specifies all of the normalizable vertex types.
public static var tangentFrame: MeshDeformerVertexOptions { get }
/// Specifies all vertex types.
public static var all: MeshDeformerVertexOptions { get }
public typealias OptionStorage = UInt16
/// The corresponding value of the raw type.
///
/// A new instance initialized with `rawValue` will be equivalent to this
/// instance. For example:
///
/// enum PaperSize: String {
/// case A4, A5, Letter, Legal
/// }
///
/// let selectedSize = PaperSize.Letter
/// print(selectedSize.rawValue)
/// // Prints "Letter"
///
/// print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!)
/// // Prints "true"
public var rawValue: MeshDeformerVertexOptions.OptionStorage
/// Creates a new option set from the given raw value.
///
/// This initializer always succeeds, even if the value passed as `rawValue`
/// exceeds the static properties declared as part of the option set. This
/// example creates an instance of `ShippingOptions` with a raw value beyond
/// the highest element, with a bit mask that effectively contains all the
/// declared static members.
///
/// let extraOptions = ShippingOptions(rawValue: 255)
/// print(extraOptions.isStrictSuperset(of: .all))
/// // Prints "true"
///
/// - Parameter rawValue: The raw value of the option set to create. Each bit
/// of `rawValue` potentially represents an element of the option set,
/// though raw values may include bits that are not defined as distinct
/// values of the `OptionSet` type.
public init(rawValue: MeshDeformerVertexOptions.RawValue)
Truncated.
typealias
MeshDeformGPUBufferInput
NewiOSmacOStvOSpublic typealias MeshDeformGPUBufferInput = MTLBuffer
The underlying type of deformer input data buffers for the GPU functions.
typealias
MeshDeformGPUBufferOutput
NewiOSmacOStvOSpublic typealias MeshDeformGPUBufferOutput = MTLBuffer
The underlying type of deformer input data buffers for the GPU functions.
struct
MeshDeformParameter
NewiOSmacOStvOSpublic struct MeshDeformParameter<InputBuffer, OutputBuffer>
Base class for GPU and CPU custom deform function input
Declaration
public struct MeshDeformParameter<InputBuffer, OutputBuffer> {
/// The vertices requested by the developer when they defined their custom deformations.
/// These will be passed into their custom deformation functions.
public struct VertexBuffers<Buffer> {
/// Provides low-level information about the memory allocation of the buffers.
public struct Data {
/// The allocation containing the vertex data.
public let buffer: Buffer
/// The format of the vertices.
public let format: MTLVertexFormat
/// The offset of the vertex data.
public let offset: Int
/// The stride of the vertex data.
public let stride: Int
}
/// The positions buffer, if the custom deformer author specified it.
public let positions: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<Buffer>.Data?
/// The normals buffer, if the custom deformer author specified it.
public let normals: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<Buffer>.Data?
/// The tangents buffer, if the custom deformer author specified it.
public let tangents: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<Buffer>.Data?
/// The bitangents buffer, if the custom deformer author specified it.
public let bitangents: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<Buffer>.Data?
/// The uvs buffer, if the custom deformer author specified it
public let uvs: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<Buffer>.Data?
/// The uv1s buffer, if the custom deformer author specified it
public let uv1s: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<Buffer>.Data?
/// The uv2s buffer, if the custom deformer author specified it
public let uv2s: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<Buffer>.Data?
/// The uv3s buffer, if the custom deformer author specified it
public let uv3s: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<Buffer>.Data?
/// The uv4s buffer, if the custom deformer author specified it
public let uv4s: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<Buffer>.Data?
/// The uv5s buffer, if the custom deformer author specified it
public let uv5s: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<Buffer>.Data?
/// The uv6s buffer, if the custom deformer author specified it
public let uv6s: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<Buffer>.Data?
/// The uv7s buffer, if the custom deformer author specified it
public let uv7s: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<Buffer>.Data?
/// The number of elements in each of the specified buffers.
public let count: Int
}
/// The specified input vertex data for the deformer function.
public var inputBuffers: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<InputBuffer>
/// The specified output vertex data for the deformer function.
public var outputBuffers: MeshDeformParameter<InputBuffer, OutputBuffer>.VertexBuffers<OutputBuffer>
}
typealias
MeshDeformParameterCPU
NewiOSmacOStvOSpublic typealias MeshDeformParameterCPU = MeshDeformParameter<MeshDeformCPUBufferInput, MeshDeformCPUBufferOutput>
typealias
MeshDeformParameterGPU
NewiOSmacOStvOSpublic typealias MeshDeformParameterGPU = MeshDeformParameter<any MTLBuffer, any MTLBuffer>
typealias
MeshDeformParametersCPU
NewiOSmacOStvOSpublic typealias MeshDeformParametersCPU = [MeshDeformParameterCPU]
typealias
MeshDeformParametersGPU
NewiOSmacOStvOSpublic typealias MeshDeformParametersGPU = [MeshDeformParameterGPU]
struct
MeshScope
NewiOSmacOStvOSpublic struct MeshScope : Sendable, Codable, Equatable, Hashable, CustomStringConvertible
The elements of a mesh resource that a deformation stack applies to.
Declaration
public struct MeshScope : Sendable, Codable, Equatable, Hashable, CustomStringConvertible {
/// Apply to all models and instances.
public static var all: MeshScope { get }
/// Apply to model by `name`, all parts if `part` is nil, otherwise only to the specific `part`.
public static func model(name: String, part: String? = nil) -> MeshScope
/// Apply to instance by `name`, all parts if `part` is nil, otherwise only to the specific `part`.
public static func instance(name: String, part: String? = nil) -> MeshScope
public var isAll: Bool { get }
public var isInstance: Bool { get }
public var isModel: Bool { get }
/// A textual representation of this instance.
public var description: String { get }
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// 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: MeshScope, b: MeshScope) -> 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 }
}
struct
NavigationComponent
NewiOSmacOStvOSpublic struct NavigationComponent : Component
Declaration
public struct NavigationComponent : Component {
public struct Filter {
public var areaCosts: [NavigationMeshResource.Area : Float]
public var ignoreFlags: NavigationMeshResource.FlagGroup
public var includeFlags: NavigationMeshResource.FlagGroup
public init()
}
public init(layer: NavigationMeshResource.Layer? = nil, filter: NavigationComponent.Filter? = nil)
public var filter: NavigationComponent.Filter?
public var layer: NavigationMeshResource.Layer?
}
struct
NavigationController
NewiOSmacOStvOSpublic struct NavigationController
Declaration
public struct NavigationController {
public enum PathfindStatus {
case none
case inProgress
case failed
case succeeded
/// 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: NavigationController.PathfindStatus, b: NavigationController.PathfindStatus) -> 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 }
}
public init(entity: Entity) throws
public func requestPath(to targetPosition: SIMD3<Float>)
public func requestPath(from startPosition: SIMD3<Float>, to targetPosition: SIMD3<Float>)
public func computePath(to targetPosition: SIMD3<Float>) async -> [NavigationMeshResource.PathNode]?
public func computePath(from startPosition: SIMD3<Float>, to targetPosition: SIMD3<Float>) async -> [NavigationMeshResource.PathNode]?
public func stopPathfind()
public var pathfindStatus: NavigationController.PathfindStatus { get }
public var currentPath: [NavigationMeshResource.PathNode] { get }
}
extension
NavigationController.PathfindStatus
NewiOSmacOStvOSextension NavigationController.PathfindStatus : Equatable
Declaration
extension NavigationController.PathfindStatus : Equatable {
}
extension
NavigationController.PathfindStatus
NewiOSmacOStvOSextension NavigationController.PathfindStatus : Hashable
Declaration
extension NavigationController.PathfindStatus : Hashable {
}
struct
NavigationMeshComponent
NewiOSmacOStvOSpublic struct NavigationMeshComponent : Component
Declaration
public struct NavigationMeshComponent : Component {
public init(navigationMeshes: [NavigationMeshResource])
public var navigationMeshes: [NavigationMeshResource]
}
extension
NavigationMeshResource.Configuration.PartitionMethod
NewiOSmacOStvOSextension NavigationMeshResource.Configuration.PartitionMethod : Equatable
Declaration
extension NavigationMeshResource.Configuration.PartitionMethod : Equatable {
}
extension
NavigationMeshResource.Configuration.PartitionMethod
NewiOSmacOStvOSextension NavigationMeshResource.Configuration.PartitionMethod : Hashable
Declaration
extension NavigationMeshResource.Configuration.PartitionMethod : Hashable {
}
extension
NavigationMeshResource.PathNode.Category
NewiOSmacOStvOSextension NavigationMeshResource.PathNode.Category : Equatable
Declaration
extension NavigationMeshResource.PathNode.Category : Equatable {
}
extension
NavigationMeshResource.PathNode.Category
NewiOSmacOStvOSextension NavigationMeshResource.PathNode.Category : Hashable
Declaration
extension NavigationMeshResource.PathNode.Category : Hashable {
}
struct
OcclusionCullingComponent
NewiOSmacOStvOSpublic struct OcclusionCullingComponent : Component
A component that controls whether the system performs occlusion culling on the owning Entity and its descendants.
Occlusion culling can improve performance by skipping rendering for entities that are fully hidden behind other geometry. Entities are opted into this system by default.
This component can be used to disable occlusion culling for an Entity hierarchy if it's observed that culling produces incorrect visuals. Such scenarios may include:
- Content that quickly moves in and out of occluded areas.
- Content that uses a Geometry Modifier to warp vertices outside
of the mesh's reported bounds.
- A camera teleports to a new location in a single frame and
starts viewing the scene from a drastically different angle or position.
The enablement setting on this component will be applied recursively to descendant Entities. A component added to a descendant Entity will override any settings inherited from its parent.
Declaration
public struct OcclusionCullingComponent : Component {
/// Whether occlusion culling should be performed on this Entity and its children.
public var isEnabled: Bool
public init(isEnabled: Bool)
}
struct
OpenSubdivisionDeformer
NewiOSmacOStvOSpublic struct OpenSubdivisionDeformer : MeshDeformer
OpenSubdiv surface deformation
Declaration
public struct OpenSubdivisionDeformer : MeshDeformer {
/// default implementation is provided
public func isDeformerEqual(other: any MeshDeformer) -> Bool
/// Provide a unique identifier for type of deformer.
/// There can only be one `deform` function associated with each type String. However,
/// each `deform` can vary greatly based on run time options and input.
public static var type: String { get }
/// deform the mesh on the GPU (the preferred method)
public func deform(parameter: MeshDeformParameterGPU, encoder: any MTLComputeCommandEncoder)
public init()
/// 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: OpenSubdivisionDeformer, b: OpenSubdivisionDeformer) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
struct
PhysicallyBasedDecalComponent
NewiOSmacOStvOSpublic struct PhysicallyBasedDecalComponent : Component
Declaration
public struct PhysicallyBasedDecalComponent : Component {
/// Creates a new instance with PhysicallBasedMaterial.BaseColor
/// The tint color is multiplied with the baseColor
/// If base color is not specified, the tint color is applied as a solid color
public init(baseColor: PhysicallyBasedMaterial.BaseColor)
/// Creates a new instance without a base color
public init()
/// The optional base color texture for the decal
/// Expects pre-multiplied alpha texture
public var baseColor: PhysicallyBasedMaterial.BaseColor?
/// An optional normal texture for the decal
public var normal: PhysicallyBasedMaterial.Normal?
/// An optional roughness texture for the decal
public var roughness: PhysicallyBasedMaterial.Roughness?
/// An optional metallic texture for the decal
public var metallic: PhysicallyBasedMaterial.Metallic?
/// An optional specular texture for the decal
public var specular: PhysicallyBasedMaterial.Specular?
/// An optional emissive texture for the decal
public var emissive: PhysicallyBasedMaterial.EmissiveColor?
/// An optional opacity texture for the decal
public var opacity: PhysicallyBasedMaterial.Opacity?
/// An optional set of receiver entities that are not part of any layers
/// The limit on the number of receiver entities is 8, extra entities are ignored
public var receiverEntities: Set<Entity>
/// The sort layer for the decal
/// Higher layers show up on top of lower layers
public var sortOrder: Int32
/// The layers this decal affects.
/// Only entities whose RenderLayerComponent.layers intersect with these layers will be affected.
public var layers: RenderLayer.Set
/// The bounds of the decal volume defined in entity local space
public var bounds: SIMD3<Float>
}
extension
PhysicallyBasedMaterial
NewiOSmacOStvOSextension PhysicallyBasedMaterial
Declaration
extension PhysicallyBasedMaterial {
public var subsurfaceWeight: PhysicallyBasedMaterial.SubsurfaceWeight
public var subsurfaceColor: PhysicallyBasedMaterial.SubsurfaceColor
public var subsurfaceRadius: PhysicallyBasedMaterial.SubsurfaceRadius
public var subsurfaceRadiusScale: PhysicallyBasedMaterial.SubsurfaceRadiusScale
public var subsurfaceScatterAnisotropy: PhysicallyBasedMaterial.SubsurfaceScatterAnisotropy
/// The bent normal map for the entity.
///
/// _Bent normal mapping_ describes the average direction of least occlusion at each surface point.
/// This is used to modulate lighting intensity and direction of the material. Use with ambient occlusion
/// to improve the accuracy of indirect diffuse lighting. You can generate bent normals maps from
/// a 3D software package.
///
/// The following code loads a bent normal map texture and uses it to set this property:
///
/// ```swift
/// if let bentNormalResource = try? TextureResource.load(named:"entity_bentNormalMap") {
/// let bentNormalMap = PhysicallyBasedMaterial.Texture(bentNormalResource)
/// material.bentNormal = .init(texture: bentNormalMap)
/// }
/// ```
public var bentNormal: PhysicallyBasedMaterial.BentNormal
/// Enables specular occlusion computations.
///
/// When enabled, this property reduces specular highlights in areas that are occluded from ambient light,
/// allowing for more realistic indirect lighting. This uses bent normal maps to modulate specular reflections
/// based on ambient occlusion and roughness.
///
/// Specular occlusion is particularly useful for character rendering and complex surfaces where
/// traditional ambient occlusion alone may not provide sufficient detail for realistic specular lighting.
///
/// - Note: This feature requires bent normal maps. Enable bent normals using
/// ``PhysicallyBasedMaterial/bentNormal-swift.property``.
///
/// ```swift
/// material.enableSpecularOcclusion = boolean_value
/// ```
public var enableSpecularOcclusion: Bool
}
extension
PointLightComponent
NewiOSmacOStvOSextension PointLightComponent
Declaration
extension PointLightComponent {
/// The layers this light illuminates. Only entities whose RenderLayerComponent.layers intersect with these layers will be illuminated.
public var layers: RenderLayer.Set
}
enum
PortalFactory
NewiOSmacOStvOSpublic enum PortalFactory
A factory for creating portal entities with simplified configuration.
PortalFactory provides a convenient way to create complete portal setups by automatically configuring all necessary components including WorldComponent, ModelComponent with mesh and PortalMaterial, and PortalComponent with appropriate clipping and crossing modes.
The factory returns a PortalSetup containing a root entity with both the portal and world entities as children. Simply add the root entity to your scene to display the portal.
## Example Usage
Create a simple flat portal:
let setup = PortalFactory.createPortal(
style: .plane(width: 2.0, height: 1.5)
)
content.add(setup.rootEntity)
// Add content to the portal world
let sphere = ModelEntity(mesh: .generateSphere(radius: 0.3), materials: [SimpleMaterial()])
setup.worldEntity.addChild(sphere)
Declaration
public enum PortalFactory {
/// Defines the visual appearance and geometry of a portal.
public enum Style {
/// A flat or curved planar portal.
///
/// Creates a rectangular portal that can be flat or curved into a cylindrical shape.
/// The portal surface uses a plane mesh generated with `MeshResource.generatePlane`.
///
/// - Parameters:
/// - width: The width of the portal plane in meters. Must be positive.
/// - height: The height of the portal plane in meters. Must be positive.
/// - radius: The radius of curvature. Zero creates a flat plane (default),
/// positive values create a cylindrical curved portal. Must be non-negative.
///
/// ## Coordinate Space
/// The portal plane is positioned at the entity's local origin `[0, 0, 0]` with a normal
/// facing the positive Z direction `[0, 0, 1]`.
case plane(width: Float, height: Float, radius: Float = 0.0)
}
/// Contains the portal and world entities created by `PortalFactory`.
///
/// The setup includes a root entity containing both the portal and world entities as children.
/// Simply add `rootEntity` to your scene to display the portal.
public struct PortalSetup {
/// The root entity containing both portal and world entities as children.
///
/// Add this entity to your scene to display the complete portal setup.
/// Position and orient this entity to place the portal in your 3D space.
public let rootEntity: Entity
/// The portal entity with `ModelComponent` and `PortalComponent` configured.
///
/// This entity displays the portal surface and is a child of `rootEntity`.
public let portalEntity: Entity
/// The world entity with `WorldComponent` configured.
///
/// Add child entities to this entity to populate the portal's world.
/// Content added here will be visible through the portal.
/// This entity is a child of `rootEntity`.
public let worldEntity: Entity
}
/// Creates a complete portal setup with new entities.
///
/// This method creates a root entity containing a portal entity and a world entity.
/// The portal entity has a `ModelComponent` with generated mesh and `PortalMaterial`,
/// plus a `PortalComponent` with specified clipping and crossing modes.
/// The world entity has a `WorldComponent` and is set as the portal's target.
///
/// - Parameters:
/// - style: The visual style and geometry of the portal.
/// - enableClipping: When `true`, content is clipped at the portal boundary.
/// Prevents content from rendering outside the portal bounds.
/// Default is `true`.
/// - enableCrossing: When `true`, enables portal crossing for entities with
/// `PortalCrossingComponent`. Allows entities to move between
/// the portal world and the outside world. Default is `false`.
///
/// - Returns: A `PortalSetup` containing the root entity with configured portal and world.
///
/// ## Example
/// ```swift
/// // Create a flat portal with default settings
/// let setup = PortalFactory.createPortal(
/// style: .plane(width: 2.0, height: 1.5)
/// )
///
/// // Add the portal to your scene
/// content.add(setup.rootEntity)
///
/// // Add content to the portal world
/// let sphere = ModelEntity(mesh: .generateSphere(radius: 0.3), materials: [SimpleMaterial()])
/// setup.worldEntity.addChild(sphere)
/// ```
public static func createPortal(style: PortalFactory.Style, enableClipping: Bool = true, enableCrossing: Bool = false) -> PortalFactory.PortalSetup
Truncated.
extension
PortalMaterial
NewiOSmacOStvOSextension PortalMaterial
Declaration
extension PortalMaterial {
/// A compiled shader program that drives the appearance of a portal's surface and geometry.
public struct Program : Equatable, Hashable, Sendable {
/// Configuration used to compile a ``PortalMaterial/Program``.
public struct Descriptor : Equatable {
/// The shader graph that describes the shading logic for this program.
public var shaderGraph: ShaderGraph
/// Initial values for the inputs declared in ``shaderGraph``.
public var inputValues: [String : MaterialParameters.Value]
/// Values for the function constant inputs declared in ``shaderGraph``.
///
/// Function constants are compiled directly into the shader and cannot be
/// changed after the program is created.
public var constantValues: MTLFunctionConstantValues
/// Creates a descriptor with the given shader graph and optional initial values.
///
/// - Parameters:
/// - shaderGraph: The shader graph describing the shading logic for this program.
/// - inputValues: Initial values for the inputs declared in the shader graph.
/// - constantValues: Values for function constant inputs to be baked into the compiled shader.
public init(shaderGraph: ShaderGraph, inputValues: [String : MaterialParameters.Value] = [:], constantValues: MTLFunctionConstantValues = .init())
/// 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: PortalMaterial.Program.Descriptor, b: PortalMaterial.Program.Descriptor) -> Bool
}
/// 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 == (lhs: PortalMaterial.Program, rhs: PortalMaterial.Program) -> 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 descriptor used to create this program.
public var descriptor: PortalMaterial.Program.Descriptor { get }
/// Creates a program by compiling the shader node graph in the given descriptor.
///
/// - Throws: If the graph is invalid or shader compilation fails.
public init(descriptor: PortalMaterial.Program.Descriptor) async throws
/// 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
Truncated.
struct
RenderLayer
NewiOSmacOStvOSpublic struct RenderLayer : Sendable
A structured representation of render layers that provides type safety and clear semantics.
RenderLayer allows developers to use either named layers for custom groupings or the default layer for standard rendering behavior.
Declaration
public struct RenderLayer : Sendable {
/// The default layer which all meshes and lights are in unless otherwise specified
public static var defaultLayer: RenderLayer { get }
/// Creates a custom render layer with the specified compile-time constant name.
///
/// This initializer accepts only compile-time string constants. A precondition
/// checks the validity of the layer name. Use this for defining layer constants
/// in extensions of RenderLayer.
///
/// It is recommended to use descriptive names with namespace prefixes to avoid
/// conflicts, such as
/// `"com.myapp.hero-lighting"` or `"com.myapp.background"`.
///
/// This can look like layer constants as extensions:
/// ```swift
/// extension RenderLayer {
/// static let background = RenderLayer("com.myapp.background")
/// }
/// ```
///
/// - Parameter rawValue: A unique compile-time constant name for this layer.
/// - Precondition: The layer name must not be empty.
public init(_ rawValue: StaticString)
/// Creates a custom render layer with the specified runtime name.
///
/// This failable initializer allows creating layers from runtime string values,
/// such as user input or data loaded from files. Returns `nil` if the layer name
/// is invalid (empty).
///
/// Use descriptive names with namespace prefixes to avoid conflicts, such as
/// `"com.myapp.hero-lighting"` or `"com.myapp.background"`.
///
/// - Parameter rawValue: A unique name for this layer.
/// - Returns: A new `RenderLayer` instance, or `nil` if the name is invalid.
public init?(rawValue: String)
}
extension
RenderLayer
NewiOSmacOStvOSextension RenderLayer
Declaration
extension RenderLayer {
/// An unordered collection of unique render layers.
///
/// `RenderLayer.Set` is used wherever a group of layers is specified—for example,
/// on light components and `RenderLayerComponent`.
///
/// You can create a `RenderLayer.Set` using an array literal:
/// ```swift
/// let layers: RenderLayer.Set = [.defaultLayer, RenderLayer("com.myapp.hero")]
/// ```
public struct Set : Sendable {
/// Creates an empty set of render layers.
public init()
/// Creates a set of render layers from a sequence.
public init<S>(_ sequence: S) where S : Sequence, S.Element == RenderLayer
/// A Boolean value indicating whether the set contains no layers.
public var isEmpty: Bool { get }
/// The number of layers in the set.
public var count: Int { get }
/// Returns a Boolean value indicating whether the set contains the given layer.
public func contains(_ layer: RenderLayer) -> Bool
/// Inserts the given layer into the set.
@discardableResult
public mutating func insert(_ layer: RenderLayer) -> (inserted: Bool, memberAfterInsert: RenderLayer)
/// Removes the given layer from the set if it exists.
@discardableResult
public mutating func remove(_ layer: RenderLayer) -> RenderLayer?
}
}
extension
RenderLayer.Set
NewiOSmacOStvOSextension RenderLayer.Set : Equatable
Declaration
extension RenderLayer.Set : 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.
public static func == (lhs: RenderLayer.Set, rhs: RenderLayer.Set) -> Bool
}
extension
RenderLayer.Set
NewiOSmacOStvOSextension RenderLayer.Set : Sequence
Declaration
extension RenderLayer.Set : Sequence {
/// A type that provides the sequence's iteration interface and
/// encapsulates its iteration state.
public struct Iterator : IteratorProtocol {
/// Advances to the next element and returns it, or `nil` if no next element
/// exists.
///
/// Repeatedly calling this method returns, in order, all the elements of the
/// underlying sequence. As soon as the sequence has run out of elements, all
/// subsequent calls return `nil`.
///
/// You must not call this method if any other copy of this iterator has been
/// advanced with a call to its `next()` method.
///
/// The following example shows how an iterator can be used explicitly to
/// emulate a `for`-`in` loop. First, retrieve a sequence's iterator, and
/// then call the iterator's `next()` method until it returns `nil`.
///
/// let numbers = [2, 3, 5, 7]
/// var numbersIterator = numbers.makeIterator()
///
/// while let num = numbersIterator.next() {
/// print(num)
/// }
/// // Prints "2"
/// // Prints "3"
/// // Prints "5"
/// // Prints "7"
///
/// - Returns: The next element in the underlying sequence, if a next element
/// exists; otherwise, `nil`.
public mutating func next() -> RenderLayer?
/// The type of element traversed by the iterator.
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
public typealias Element = RenderLayer
}
/// Returns an iterator over the elements of this sequence.
public func makeIterator() -> RenderLayer.Set.Iterator
/// A type representing the sequence's elements.
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
public typealias Element = RenderLayer
}
struct
RenderLayerComponent
NewiOSmacOStvOSpublic struct RenderLayerComponent : Component
A component that defines which layers an entity participates in.
When attached to an entity with ModelComponent, it defines which layers that entity belongs to. Light components use their layers and shadow components use their layers properties to determine which entities they affect.
Declaration
public struct RenderLayerComponent : Component {
/// The layers this entity participates in.
///
/// Layers can be either named custom layers or the default layer. Common conventions include:
/// - `.defaultLayer` for general entities
/// - `RenderLayer("com.myapp.hero")` for main character objects
/// - `RenderLayer("com.myapp.background")` for background elements
/// - `RenderLayer("com.myapp.props")` for scene props
public var layers: RenderLayer.Set
/// Creates a layer component with the specified layers.
/// - Parameter layers: The layers this entity participates in
public init(layers: RenderLayer.Set)
/// Creates a layer component with the specified layers.
/// - Parameter layers: The layers this entity participates in
public init(_ layers: RenderLayer...)
/// Creates a layer component with a single layer.
/// - Parameter layer: The layer this entity participates in
public init(layer: RenderLayer)
}
extension
RenderLayerComponent
NewiOSmacOStvOSextension RenderLayerComponent
Declaration
extension RenderLayerComponent {
/// The default layer used when no `RenderLayerComponent` is present.
public static let defaultLayer: RenderLayerComponent
}
struct
RenormalizationDeformer
NewiOSmacOStvOSpublic struct RenormalizationDeformer : MeshDeformer
Recalculates tangent frame based on current state of positions
Declaration
public struct RenormalizationDeformer : MeshDeformer {
/// default implementation is provided
public func isDeformerEqual(other: any MeshDeformer) -> Bool
/// Provide a unique identifier for type of deformer.
/// There can only be one `deform` function associated with each type String. However,
/// each `deform` can vary greatly based on run time options and input.
public static var type: String { get }
/// deform the mesh on the GPU (the preferred method)
public func deform(parameter: MeshDeformParameterGPU, encoder: any MTLComputeCommandEncoder)
public init()
/// 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: RenormalizationDeformer, b: RenormalizationDeformer) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
extension
RetargetingConfiguration
NewiOSmacOStvOSextension RetargetingConfiguration : Sendable
Declaration
extension RetargetingConfiguration : Sendable {
}
extension
ReverbMeshResource
NewiOSmacOStvOSextension ReverbMeshResource
Declaration
extension ReverbMeshResource {
public convenience init(positions: [SIMD3<Float>], triangleIndices: [UInt32], materials: [UInt32]) throws
@MainActor public convenience init(from mesh: MeshResource) throws
public convenience init(from descriptors: [MeshDescriptor]) throws
public static func plane(width: Float, depth: Float) -> Self
public static func box(size: SIMD3<Float>) -> Self
public static func shoebox(size: SIMD3<Float>) -> Self
}
extension
ReverbMeshResource
NewiOSmacOStvOSextension ReverbMeshResource : Hashable
Declaration
extension ReverbMeshResource : Hashable {
/// 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 == (lhs: ReverbMeshResource, rhs: ReverbMeshResource) -> 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.
final 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.
final public var hashValue: Int { get }
}
extension
SampledAnimation
NewiOSmacOStvOSextension SampledAnimation where Value == JointTransforms
Declaration
extension SampledAnimation where Value == JointTransforms {
/// Operations that can be performed on skeletal animations.
public struct SkeletalAnimationOperation {
/// Options for controlling root motion extraction.
public struct RootMotionOptions : OptionSet {
/// The corresponding value of the raw type.
///
/// A new instance initialized with `rawValue` will be equivalent to this
/// instance. For example:
///
/// enum PaperSize: String {
/// case A4, A5, Letter, Legal
/// }
///
/// let selectedSize = PaperSize.Letter
/// print(selectedSize.rawValue)
/// // Prints "Letter"
///
/// print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!)
/// // Prints "true"
public let rawValue: UInt16
/// Creates a new option set from the given raw value.
///
/// This initializer always succeeds, even if the value passed as `rawValue`
/// exceeds the static properties declared as part of the option set. This
/// example creates an instance of `ShippingOptions` with a raw value beyond
/// the highest element, with a bit mask that effectively contains all the
/// declared static members.
///
/// let extraOptions = ShippingOptions(rawValue: 255)
/// print(extraOptions.isStrictSuperset(of: .all))
/// // Prints "true"
///
/// - Parameter rawValue: The raw value of the option set to create. Each bit
/// of `rawValue` potentially represents an element of the option set,
/// though raw values may include bits that are not defined as distinct
/// values of the `OptionSet` type.
public init(rawValue: UInt16)
/// Translation X is extracted.
public static let translationX: SampledAnimation<JointTransforms>.SkeletalAnimationOperation.RootMotionOptions
/// Translation Y is extracted.
public static let translationY: SampledAnimation<JointTransforms>.SkeletalAnimationOperation.RootMotionOptions
/// Translation Z is extracted.
public static let translationZ: SampledAnimation<JointTransforms>.SkeletalAnimationOperation.RootMotionOptions
/// Rotation X is extracted.
public static let rotationX: SampledAnimation<JointTransforms>.SkeletalAnimationOperation.RootMotionOptions
/// Rotation Y is extracted.
public static let rotationY: SampledAnimation<JointTransforms>.SkeletalAnimationOperation.RootMotionOptions
/// Rotation Z is extracted.
public static let rotationZ: SampledAnimation<JointTransforms>.SkeletalAnimationOperation.RootMotionOptions
/// Translation XZ is extracted (common for ground-based locomotion).
public static let translationXZ: SampledAnimation<JointTransforms>.SkeletalAnimationOperation.RootMotionOptions
/// All motion is extracted and returned.
public static let extractAll: SampledAnimation<JointTransforms>.SkeletalAnimationOperation.RootMotionOptions
/// The type of the elements of an array literal.
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
public typealias ArrayLiteralElement = SampledAnimation<JointTransforms>.SkeletalAnimationOperation.RootMotionOptions
/// The element type of the option set.
///
/// To inherit all the default implementations from the `OptionSet` protocol,
/// the `Element` type must be `Self`, the default.
@available(macOS 27.0, iOS 27.0, tvOS 27.0, *)
public typealias Element = SampledAnimation<JointTransforms>.SkeletalAnimationOperation.RootMotionOptions
/// The raw type that can be used to represent all values of the conforming
/// type.
Truncated.
struct
SceneUnderstandingComponent
NewmacOSpublic struct SceneUnderstandingComponent : Component
A component that specifies an entity is participating in the system's scene-understanding features.
Scene understanding refers to RealityKit features like physics collision, shadows, and occlusion with real-world geometry. In iOS, SceneUnderstandingComponent is a read-only component. Manually adding it doesn't have any effect.
In visionOS and macOS, SceneUnderstandingComponent is a write-only component. Add SceneUnderstandingComponent to your custom entities to let it behave as a virtual scene-understanding mesh.
For more information about scene-understanding features, see <doc:realitykit-scene-understanding>.
Declaration
public struct SceneUnderstandingComponent : Component {
/// Types of real-world objects that a scene-understanding component models.
@available(iOS 15.0, visionOS 1.0, macOS 27.0, *)
public enum EntityType : Hashable {
/// An entity that models the physical shape of the environment within
/// a given cubic region.
///
/// When ``SpotLightComponent.SurroundingsLight`` or ``PointLightComponent.SurroundingsLight``is enabled:
/// - On visionOS, RealityKit automatically selects the opaque meshes that intersects the bounding box of the
/// entity's mesh and illuminates them with surroundings light.
/// - On macOS, surroundings light illuminates the entity's mesh.
case meshChunk
/// 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: SceneUnderstandingComponent.EntityType, b: SceneUnderstandingComponent.EntityType) -> 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 }
}
/// Creates a component for the given entity type that makes an entity aware
/// of certain aspects of the physical environment.
///
/// - Parameters:
/// - entityType: The entity type to make the component for.
@available(iOS 15.0, visionOS 1.0, macOS 27.0, *)
public init(entityType: SceneUnderstandingComponent.EntityType?)
/// Creates a component that makes an entity aware of certain aspects of the
/// physical environment.
@available(iOS 15.0, visionOS 1.0, macOS 27.0, *)
public init()
/// The type of real-world objects that the component models.
@available(iOS 15.0, visionOS 1.0, macOS 27.0, *)
public var entityType: SceneUnderstandingComponent.EntityType?
}
extension
SceneUnderstandingComponent
NewmacOSextension SceneUnderstandingComponent
Declaration
extension SceneUnderstandingComponent {
/// Types of scene-understanding origins this component lives in.
public enum Origin : Hashable {
/// A scene-understanding component that is owned and created by the system.
/// Component of this origin type will model an object in real world environment.
case system
/// A scene-understanding component that is owned and created by the developer.
/// Component of this origin type will model an object in virtual environment.
case user
/// 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: SceneUnderstandingComponent.Origin, b: SceneUnderstandingComponent.Origin) -> 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 origin that RealityKit creates the component from.
public var origin: SceneUnderstandingComponent.Origin { get }
}
extension
ShaderGraphMaterial.Program
NewiOSmacOStvOSextension ShaderGraphMaterial.Program
Declaration
extension ShaderGraphMaterial.Program {
/// Creates a program by compiling the shader node graph in the given descriptor.
///
/// - Throws: If the graph is invalid or shader compilation fails.
public init(descriptor: ShaderGraphMaterial.Program.Descriptor) async throws
}
extension
SkeletonResource
NewiOSmacOStvOSextension SkeletonResource
Declaration
extension SkeletonResource {
/// Creates a skeleton resource from a mesh resource skeleton.
///
/// - Parameter skeleton: The mesh resource skeleton to convert.
/// - Throws: If the skeleton asset cannot be created.
public convenience init(from skeleton: MeshResource.Skeleton) throws
}
struct
SkinningDeformer
NewiOSmacOStvOSpublic struct SkinningDeformer : MeshDeformer
A deformation that binds a 3D mesh to an underlying skeleton.
Declaration
public struct SkinningDeformer : MeshDeformer {
/// default implementation is provided
public func isDeformerEqual(other: any MeshDeformer) -> Bool
/// Specifies whether to skin normals, tangents, and bitangents.
public var skinsTangentFrame: Bool
/// Provide a unique identifier for type of deformer.
/// There can only be one `deform` function associated with each type String. However,
/// each `deform` can vary greatly based on run time options and input.
public static var type: String { get }
/// deform the mesh on the GPU (the preferred method)
public func deform(parameter: MeshDeformParameterGPU, encoder: any MTLComputeCommandEncoder)
public init(skinsTangentFrame: Bool = false)
/// 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: SkinningDeformer, b: SkinningDeformer) -> Bool
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
extension
SpotLightComponent
NewiOSmacOStvOSextension SpotLightComponent
Declaration
extension SpotLightComponent {
/// The layers this light illuminates. Only entities whose RenderLayerComponent.layers intersect with these layers will be illuminated.
public var layers: RenderLayer.Set
}
struct
ToneMappingComponent
NewiOSmacOStvOSpublic struct ToneMappingComponent : Component
Declaration
public struct ToneMappingComponent : Component {
/// In F-stops
public var exposure: Float
/// As a ratio, clamped to [0.0, 1.0]
public var toeStrength: Float
/// As a ratio, clamped to [0.0, 1.0], where 1.0 means 50% of white point
public var toeLength: Float
/// In Fstops, clamped to [0.0, 10.0]
public var shoulderStrength: Float
/// As a ratio, clamped to [0.0, 1.0]
public var shoulderLength: Float
/// As a ratio, clamped to [0.0, 1.0]
public var shoulderAngle: Float
/// Initializes a `ToneMappingComponent` with the specified parameters. Values outside of their respective ranges are clamped.
public init(exposure: Float = 0.0, toeStrength: Float = 0.25, toeLength: Float = 0.37, shoulderStrength: Float = 1.0, shoulderLength: Float = 0.7, shoulderAngle: Float = 1.0)
}
struct
UnlitLightingModel
NewiOSmacOStvOSpublic struct UnlitLightingModel : Equatable, Hashable, Sendable
Configuration for an unlit lighting model, which renders without any light interaction.
Declaration
public struct UnlitLightingModel : Equatable, Hashable, Sendable {
/// Whether to apply tonemapping to this material's output.
public var isTonemappingEnabled: Bool
public init()
/// 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: UnlitLightingModel, b: UnlitLightingModel) -> 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
VirtualEnvironmentProbeComponent
NewiOSmacOStvOSextension VirtualEnvironmentProbeComponent
Declaration
extension VirtualEnvironmentProbeComponent {
/// Defines the spatial influence of an environment probe.
public struct Influence {
/// A global influence — the probe affects all objects in the world regardless of position.
public static var global: VirtualEnvironmentProbeComponent.Influence { get }
/// A local influence using a single bounding box for both parallax correction and influence volume.
///
/// - Parameters:
/// - parallaxBounds: The bounding box used for parallax correction (local space).
/// - blendDistance: The distance from the edge of the influence volume over which the probe fades.
public static func local(parallaxBounds: BoundingBox, blendDistance: Float) -> VirtualEnvironmentProbeComponent.Influence
/// A local influence with independent parallax correction and influence volumes.
///
/// - Parameters:
/// - parallaxBounds: The bounding box used for parallax correction (local space).
/// - influenceBounds: The bounding box that defines the probe's area of influence (local space).
/// - blendDistance: The distance from the edge of the influence volume over which the probe fades.
public static func local(parallaxBounds: BoundingBox, influenceBounds: BoundingBox, blendDistance: Float) -> VirtualEnvironmentProbeComponent.Influence
}
}
var
ActionEvent.entity
NewiOSmacOStvOSpublic var entity: Entity? { get }
The entity that owns the BehaviorTreeComponent and initiated this action.
This is the entity on which the behavior tree is running,.
init
AnchoringComponent.ObjectAnchoringSource.init
NewiOSmacOSpublic init(referenceObject data: Data)
Creates the object anchoring source by reference object file data.
Parameters
referenceObject- The data of the reference object file.
typealias
AnimationGraphComponent.ActiveClipNode.ID
NewiOSmacOStvOSpublic typealias ID = Int
A type representing the stable identity of the entity associated with an instance.
typealias
AnimationGraphComponent.ActiveStateMachineNode.ID
NewiOSmacOStvOSpublic typealias ID = Int
A type representing the stable identity of the entity associated with an instance.
typealias
AnimationGraphComponent.ActiveTag.ID
NewiOSmacOStvOSpublic typealias ID = Int
A type representing the stable identity of the entity associated with an instance.
var
AnimationLibraryComponent.automaticallyPlaysDefaultAnimation
NewiOSmacOStvOSpublic var automaticallyPlaysDefaultAnimation: Bool { get }
Whether to automatically play the default animation when the entity is added to a scene and enabled. Default value is false, meaning the default animation will not be automatically played by default. This value can only be set when initializing AnimationLibraryComponent
When set to true, the animation system automatically plays the default animation when the entity is added to a scene and enabled. The default animation is determined by defaultKey or, if that's not set, the first animation in the library.
When set to false, animations require manual playback using playAnimation(_:transitionDuration:startsPaused:).
## Example
var library = AnimationLibraryComponent(automaticallyPlaysDefaultAnimation: true)
library["idle"] = idleAnimation
library.defaultKey = "idle"
entity.components.set(library)
// Animation plays automatically when the entity is added to a scene and enabled
Returns- true if automatically play default animation is enabled - false if automatically play default animation is disabled
init
AnimationLibraryComponent.init
NewiOSmacOStvOSpublic init(dictionaryLiteral elements: (String, AnimationResource)..., automaticallyPlaysDefaultAnimation: Bool)
Creates an animation library from a variadic list of key-value pairs
Use the <doc://com.apple.documentation/documentation/swift/expressiblebydictionaryliteral> initializer by directly assigning the library to a dictionary literal.
Parameters
elements- A list of key-value pairs that make up the dictionary. Each key is a unique animation name, and each value is an animation resource.
automaticallyPlaysDefaultAnimation- Whether to automatically play the default animation when the entity is added to a scene and enabled. When
true, the animation system plays the default animation automatically. When false, animations require manual playback. See automaticallyPlaysDefaultAnimation for details.
init
AnimationLibraryComponent.init
NewiOSmacOStvOSpublic init(animations: [String : AnimationResource], automaticallyPlaysDefaultAnimation: Bool)
Creates an animation library from a dictionary that associates an animation’s data with its name.
Parameters
animations- A dictionary of animation resources that you key by name.
automaticallyPlaysDefaultAnimation- Whether to automatically play the default animation when the entity is added to a scene and enabled. When
true, the animation system plays the default animation automatically. When false, animations require manual playback. See automaticallyPlaysDefaultAnimation for details.
init
AnimationLibraryComponent.init
NewiOSmacOStvOSpublic init(automaticallyPlaysDefaultAnimation: Bool)
Creates an empty animation library.
Parameters
automaticallyPlaysDefaultAnimation- Whether to automatically play the default animation when the entity is added to a scene and enabled. When
true, the animation system plays the default animation automatically. When false, animations require manual playback. See automaticallyPlaysDefaultAnimation for details.
typealias
Audio.Absorption.Key
NewiOSmacOStvOSpublic typealias Key = Float
The key type of a dictionary literal.
typealias
Audio.Absorption.Value
NewiOSmacOStvOSpublic typealias Value = Float
The value type of a dictionary literal.
typealias
Audio.Scattering.Key
NewiOSmacOStvOSpublic typealias Key = Float
The key type of a dictionary literal.
typealias
Audio.Scattering.Value
NewiOSmacOStvOSpublic typealias Value = Float
The value type of a dictionary literal.
init
AudioFileResource.init
NewiOSmacOStvOSpublic convenience init(from data: Data, configuration: AudioFileResource.Configuration = .init()) async throws
Initializes an AudioFileResource from in-memory data asynchronously.
This API creates a memory-resident audio resource that never writes to disk. The data must contain a valid audio file format (WAV, M4A, etc.).
Parameters
data- The audio file data in memory
configuration- Configuration settings for the audio resource
ReturnsThrows: AudioFileResource.Error if the data is invalid or cannot be processed
typealias
AudioPlaybackGroupController.ID
NewiOSmacOStvOSpublic typealias ID = UInt64
A type representing the stable identity of the entity associated with an instance.
typealias
BakeType.AllCases
NewiOSmacOStvOSpublic typealias AllCases = [LightmapResource.BakeType]
A type that can represent a collection of all values of this type.
typealias
BlendMask.ID
NewiOSmacOStvOSpublic typealias ID = String
A type representing the stable identity of the entity associated with an instance.
init
Descriptor.init
NewiOSmacOStvOSpublic init(vertexCapacity: Int = 0, vertexAttributes: [LowLevelMesh.Attribute] = [Attribute](), vertexLayouts: [LowLevelMesh.Layout] = [Layout](), indexCapacity: Int = 0, indexType: MTLIndexType = MTLIndexType.uint32, instanceCapacity: Int = 0)
Creates a descriptor for a low-level mesh.
To create a new LowLevelMesh, first create a Descriptor object and set its property values, then use that Descriptor with init(descriptor:).
Parameters
vertexCapacity- The maximum number of vertices the system can store in the mesh.
vertexAttributes- The attributes of the vertices.
vertexLayouts- The layouts for the vertex buffers.
indexCapacity- The maximum number of vertices the system can store in a single buffer.
indexType- The index type to use for the mesh.
instanceCapacity- The maximum number of instances the mesh supports.
var
Descriptor.instanceCapacity
NewiOSmacOStvOSpublic var instanceCapacity: Int
The maximum number of instances the mesh supports.
Use this when using vertex attributes with a per-instance step rate.
func
Entity.write
NewiOSmacOStvOSnonisolated(nonsending) public static func write(_ scenes: [Entity], to url: URL, options: Entity.WriteOptions = WriteOptions()) async throws
Exports an array of entities as separate scenes within a single RealityKit file.
This method generates a file with a .reality suffix, automatically setting its compatibility with other systems based on all the entity tree contents. The entities and their children may contain components or assets that can require the resulting RealityKit file to be compatible with system versions between:
- iOS 18 or later
- macOS 15 or later
- visionOS 2 or later
Elements of the entities array must have a non-empty name property. Each name must be unique within the array to allow unambiguous scene loading.
After writing, individual scenes can be loaded using the init(contentsOf:withName:) initializer with the entity's name as the scene identifier.
Logs with the prefix [RealityKit File Compatibility Info] will be posted to the console whenever a component or asset requires a compatibility adjustment.
Important: During its initial setup phase, this method can indirectly block the main thread, and also has the potential to block it for the full duration of the call if the system has additional work it needs to do there.
Parameters
entities- An array of named entities to be written as separate scenes in the Reality file.
url- The location URL in the file system where you want to save the
.reality file. options- Options for writing the Reality file, such as texture compression settings.
ReturnsThrows: missingSceneName if any entity in the array has an empty name.
func
Entity.ConfigurationCatalog.write
NewiOSmacOStvOSnonisolated(nonsending) public func write(to url: URL, options: Entity.WriteOptions) async throws
Writes the configurations of the configuration catalog to a reality file.
Another configuration catalog instance can open the .reality file for reading.
Parameters
url- The destination where the configuration catalog writes the
.reality file. options- Options for writing the
.reality file.
case
Entity.WriteError._proto_deploymentTargetUnspecified_v1
NewiOSmacOStvOScase _proto_deploymentTargetUnspecified_v1
typealias
Entity.WriteOptions.ArrayLiteralElement
NewiOSmacOStvOSpublic typealias ArrayLiteralElement = Entity.WriteOptions
The type of the elements of an array literal.
var
Entity.WriteOptions.preferFastExport
NewiOSmacOStvOSpublic static var preferFastExport: Entity.WriteOptions { get }
Expedite the reality file export when possible. This may disable reality file compression, resulting in larger file size.
func
Entity.WriteOptions.preferSmallTextureFiles
NewiOSmacOSpublic static func preferSmallTextureFiles(quality: Entity.WriteOptions.TextureQuality) -> Entity.WriteOptions
Reduce textures' file size.
RealityKit reduces the file size while preserving its dimensions. RealityKit can use various strategies to reduce the file size including lossy encoding the texture as an image or storing the original source image. Mipmaps can also be regenerated.
Writing smaller texture files can increase memory usage and load time. Without this option, textures can be written to a compressed pixel format, resulting in larger file sizes but smaller memory usage and load time.
Note: RealityKit ignores this option for textures created with none.
struct
Entity.WriteOptions.TextureQuality
NewiOSmacOSpublic struct TextureQuality : Hashable, Sendable
Declaration
public struct TextureQuality : Hashable, Sendable {
/// Reduces the texture file size while preserving most details.
public static var standard: Entity.WriteOptions.TextureQuality { get }
/// Reduces more the texture file size.
/// RealityKit might not preserve fine details to reach a small file size.
public static var medium: Entity.WriteOptions.TextureQuality { get }
/// Aggressively reduces the texture file size.
/// RealityKit can suppress some visual details to reach the smallest file size.
public static var low: Entity.WriteOptions.TextureQuality { 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: Entity.WriteOptions.TextureQuality, b: Entity.WriteOptions.TextureQuality) -> 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 }
}
init
EnvironmentResource.init
NewiOSmacOStvOSpublic convenience init(named name: String, in bundle: Bundle? = nil, skyboxMode: EnvironmentResource.SkyboxMode) async throws
Asynchronously loads an environment resource from a bundle.
- parameter skyboxMode: Skybox's preservation in the environment resource.
init
EnvironmentResource.init
NewiOSmacOStvOSpublic convenience init(equirectangular cgImage: CGImage, options: EnvironmentResource.CreateOptions) throws
Synchronously creates an environment resource from an equirectangular image.
Loading an EnvironmentResource with this method blocks the main actor because it’s synchronous, so only call it from a command-line application. The method can stall a regular app, which makes it visibly hitch, and the system terminates an app if its UI becomes unresponsive.
- parameter options: A configuration for generating the environment resource.
Parameters
cgImage- The source equirectangular (latitude, longitude) image. To preserve all details use an image where the width is half the height.
init
EnvironmentResource.init
NewiOSmacOStvOSpublic convenience init(equirectangular cgImage: CGImage, options: EnvironmentResource.CreateOptions) async throws
Asynchronously generates an environment resource from an equirectangular image.
- parameter options: A configuration for generating the environment resource.
Parameters
cgImage- The source equirectangular (latitude, longitude) image. To preserve all details use an image where the width is half the height.
init
EnvironmentResource.init
NewiOSmacOStvOSpublic convenience init(skybox skyboxTexture: TextureResource?, specular specularTexture: TextureResource, diffuse diffuseTexture: TextureResource) throws
Creates an EnvironmentResource a skybox, specular and diffuse texture resources.
- parameters:
- skyboxTexture: a skybox texture to preserve. If nil, derives a low-resolution proxy from
other inputs for lower memory usage.
- specularTexture: an image based light specular texture.
- diffuseTexture: an image based light diffuse texture.
Note: SkyboxGenerator and ImageBasedLightTextureGenerator can generate required textures into a LowLevelTexture, itself wrapped as a TextureResource.
Note: The skybox is not needed for image based lighting with VirtualEnvironmentProbeComponent and ImageBasedLightComponent.
struct
EnvironmentResource.SkyboxMode
NewiOSmacOStvOSpublic struct SkyboxMode : Hashable, Sendable
An enumeration controlling how to preserve the skybox.
Declaration
public struct SkyboxMode : Hashable, Sendable {
/// Preserve and reference the original skybox cube texture.
public static var preserve: EnvironmentResource.SkyboxMode { get }
/// Only keep a low-resolution proxy of the skybox, reducing memory usage.
///
/// - Note: The skybox is not needed for lighting
/// with `VirtualEnvironmentProbeComponent` and
/// `ImageBasedLightComponent`.
public static var discard: EnvironmentResource.SkyboxMode { 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: EnvironmentResource.SkyboxMode, b: EnvironmentResource.SkyboxMode) -> 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 }
}
init
EnvironmentResource.CreateOptions.init
NewiOSmacOStvOSpublic init(skyboxMode: EnvironmentResource.SkyboxMode, samplingQuality: EnvironmentResource.CreateOptions.SamplingQuality = .fast, specularCubeDimension: Int? = nil, compression: EnvironmentResource.Compression = .default)
Creates an environment creation options structure.
Note: The skybox is not needed for image based lighting with VirtualEnvironmentProbeComponent and ImageBasedLightComponent.
Parameters
samplingQuality- The skybox sampling quality for lighting textures.
specularCubeDimension- The dimension of the computed specular cubemap for material reflections.
compression- The compression to apply to environment textures.
skyboxMode- Skybox's preservation in the environment resource.
var
EnvironmentResource.CreateOptions.skyboxMode
NewiOSmacOStvOSpublic var skyboxMode: EnvironmentResource.SkyboxMode
Skybox's preservation in the environment resource.
typealias
FlagGroup.ArrayLiteralElement
NewiOSmacOStvOSpublic typealias ArrayLiteralElement = NavigationMeshResource.FlagGroup
The type of the elements of an array literal.
typealias
FlagGroup.Element
NewiOSmacOStvOSpublic typealias Element = NavigationMeshResource.FlagGroup
The element type of the option set.
To inherit all the default implementations from the OptionSet protocol, the Element type must be Self, the default.
typealias
Joint.ID
NewiOSmacOStvOSpublic typealias ID = String
A type representing the stable identity of the entity associated with an instance.
init
Layout.init
NewiOSmacOStvOSpublic init(bufferIndex: Int, bufferOffset: Int = 0, bufferStride: Int, stepFunction: MTLVertexStepFunction = .perVertex, stepRate: Int = 1)
var
Layout.stepFunction
NewiOSmacOStvOSpublic var stepFunction: MTLVertexStepFunction
Determines how the vertex shader steps through the data in this layout.
Set to .perInstance to supply per-instance data (for example, per-instance color) from a vertex buffer. Defaults to .perVertex.
var
Layout.stepRate
NewiOSmacOStvOSpublic var stepRate: Int
The number of instances that share the same per-instance vertex data.
Used together with stepFunction. When stepFunction is .perInstance, the vertex shader advances to the next entry in this layout once per stepRate instances. Defaults to 1.
init
LowLevelTexture.Descriptor.init
NewiOSmacOStvOSpublic init(_ mtlDescriptor: MTLTextureDescriptor)
Create from a Metal texture descriptor.
typealias
MeshDeformerVertexOptions.ArrayLiteralElement
NewiOSmacOStvOSpublic typealias ArrayLiteralElement = MeshDeformerVertexOptions
The type of the elements of an array literal.
typealias
MeshDeformerVertexOptions.Element
NewiOSmacOStvOSpublic typealias Element = MeshDeformerVertexOptions
The element type of the option set.
To inherit all the default implementations from the OptionSet protocol, the Element type must be Self, the default.
typealias
MeshDeformerVertexOptions.RawValue
NewiOSmacOStvOSpublic typealias RawValue = MeshDeformerVertexOptions.OptionStorage
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.
typealias
PhysicallyBasedMaterial.SubsurfaceRadius.FloatLiteralType
NewiOSmacOStvOSpublic typealias FloatLiteralType = Float
A type that represents a floating-point literal.
Valid types for FloatLiteralType are Float, Double, and Float80 where available.
typealias
PhysicallyBasedMaterial.SubsurfaceScatterAnisotropy.FloatLiteralType
NewiOSmacOStvOSpublic typealias FloatLiteralType = Float
A type that represents a floating-point literal.
Valid types for FloatLiteralType are Float, Double, and Float80 where available.
typealias
PhysicallyBasedMaterial.SubsurfaceWeight.FloatLiteralType
NewiOSmacOStvOSpublic typealias FloatLiteralType = Float
A type that represents a floating-point literal.
Valid types for FloatLiteralType are Float, Double, and Float80 where available.
struct
PointLightComponent.SurroundingsLight
NewmacOSvisionOSpublic struct SurroundingsLight : Component, Equatable
A component that specifies that the point light illuminates the physical and immersive environment.
Declaration
public struct SurroundingsLight : Component, Equatable {
/// Creates a new surroundings light object.
public init()
/// 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: PointLightComponent.SurroundingsLight, b: PointLightComponent.SurroundingsLight) -> Bool
}
var
PortalComponent.lightingBlendDistance
NewiOSmacOSpublic var lightingBlendDistance: Float
The lighting blend distance from the clipping/crossing plane.
This property controls the smooth blending between outside world environment probe lighting and portal world environment probe lighting for crossing entities. The blend is calculated based on fragment distance to the portal surface as defined by the crossing modes.
Behavior:
- Value 0: Sharp lighting transition at portal boundary
- Positive values: Smooth gradient over the specified distance in meters
- Distance calculation: Uses the SDF (Signed Distance Field) from crossing geometry
- Plane mode: Distance to plane or cylindrical surface
- Volume mode: Distance to box boundary
Note: Only functional when crossing mode is enabled and target world uses blend lighting mode.
case
PortalComponent.ClippingMode.volume
NewiOSmacOStvOScase volume(PortalComponent.Volume)
Clips the contents within the portal using a volumetric box.
The volume is defined by a box with position and extents in portal-local space. This is useful for room portals and bounded portal spaces.
Parameters
volume- A
Volume describing the box position and extents
case
PortalComponent.CrossingMode.volume
NewiOSmacOStvOScase volume(PortalComponent.Volume)
Allows contents within the portal to cross using a volumetric box.
Entities with PortalCrossingComponent will cross the box boundary. Parts of entities inside the volume render as portal content, parts outside render normally.
Parameters
volume- A
Volume describing the box position and extents
init
PortalComponent.Plane.init
NewiOSmacOSpublic init(position: SIMD3<Float>, normal: SIMD3<Float>, radius: Float)
Creates a curved portal plane (cylinder) with position, normal, and curvature.
The curved plane represents an infinite cylindrical surface in portal-local space, equivalent to the radius behavior in UICurvatureComponent. The plane's position and normal define the cylinder's center axis orientation, while radius defines how much the plane bends.
Parameters
position- The center position of the plane in portal-local space
normal- The axis direction along which the cylinder extends (for curved planes)
radius- The cylinder's radius. Zero for flat planes, positive for curved. Defaults to 0 (flat plane).
typealias
RenderLayer.Set.ArrayLiteralElement
NewiOSmacOStvOSpublic typealias ArrayLiteralElement = RenderLayer
The type of the elements of an array literal.
typealias
RenderLayer.Set.Element
NewiOSmacOStvOSpublic typealias Element = RenderLayer
A type representing the sequence's elements.
typealias
RenderLayer.Set.Iterator.Element
NewiOSmacOStvOSpublic typealias Element = RenderLayer
The type of element traversed by the iterator.
typealias
SampledAnimation.SkeletalAnimationOperation.RootMotionOptions.ArrayLiteralElement
NewiOSmacOStvOSpublic typealias ArrayLiteralElement = SampledAnimation<JointTransforms>.SkeletalAnimationOperation.RootMotionOptions
The type of the elements of an array literal.
typealias
SampledAnimation.SkeletalAnimationOperation.RootMotionOptions.Element
NewiOSmacOStvOSpublic typealias Element = SampledAnimation<JointTransforms>.SkeletalAnimationOperation.RootMotionOptions
The element type of the option set.
To inherit all the default implementations from the OptionSet protocol, the Element type must be Self, the default.
typealias
SampledAnimation.SkeletalAnimationOperation.RootMotionOptions.RawValue
NewiOSmacOStvOSpublic typealias RawValue = UInt16
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.
var
Scene.commandQueue
NewiOSmacOStvOSpublic var commandQueue: (any MTLCommandQueue)? { get }
If this scene uses a MTLCommandQueue for rendering, returns it.
You use this command queue for GPU workloads that need consistent ordering relative to RealityKit's scene rendering.
var
SceneUnderstandingComponent.entityType
NewmacOSpublic var entityType: SceneUnderstandingComponent.EntityType?
The type of real-world objects that the component models.
enum
SceneUnderstandingComponent.EntityType
NewmacOSpublic enum EntityType : Hashable
Types of real-world objects that a scene-understanding component models.
Declaration
public enum EntityType : Hashable {
/// An entity that models the physical shape of the environment within
/// a given cubic region.
///
/// When ``SpotLightComponent.SurroundingsLight`` or ``PointLightComponent.SurroundingsLight``is enabled:
/// - On visionOS, RealityKit automatically selects the opaque meshes that intersects the bounding box of the
/// entity's mesh and illuminates them with surroundings light.
/// - On macOS, surroundings light illuminates the entity's mesh.
case meshChunk
/// 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: SceneUnderstandingComponent.EntityType, b: SceneUnderstandingComponent.EntityType) -> 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 }
}
init
SceneUnderstandingComponent.init
NewmacOSpublic init(entityType: SceneUnderstandingComponent.EntityType?)
Creates a component for the given entity type that makes an entity aware of certain aspects of the physical environment.
Parameters
entityType- The entity type to make the component for.
init
SceneUnderstandingComponent.init
NewmacOSpublic init()
Creates a component that makes an entity aware of certain aspects of the physical environment.
struct
SpotLightComponent.SurroundingsLight
NewmacOSvisionOSpublic struct SurroundingsLight : Component, Equatable
A component that specifies that the spot light illuminates the physical and immersive environment.
Declaration
public struct SurroundingsLight : Component, Equatable {
/// Creates a surroundings light object
public init()
/// 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: SpotLightComponent.SurroundingsLight, b: SpotLightComponent.SurroundingsLight) -> Bool
}
var
SpotLightComponent.Shadow.lightSize
NewiOSmacOSpublic var lightSize: Float
The light size that determines the softness of the shadows Larger size would mean a larger penumbra and a larger transition range from fully shadowed to lit. It is the radius of the light in world space units. It is also modulated by the attenaution radius, i.e., lights with larger attenuation radius need larger light size.
var
SpotLightComponent.Shadow.quality
NewiOSmacOSpublic var quality: SpotLightComponent.Shadow.QualityMode
struct
SpotLightComponent.Shadow.QualityMode
NewiOSmacOSpublic struct QualityMode : Equatable, Hashable, Sendable
The quality for the shadows. Low uses shadows that don't change with light size and the distance between light-blocker-receiver Medium and high allow soft shadows with varying sample counts
Declaration
public struct QualityMode : Equatable, Hashable, Sendable {
public var rawValue: Int
public init(rawValue: Int)
public static var low: SpotLightComponent.Shadow.QualityMode { get }
public static var medium: SpotLightComponent.Shadow.QualityMode { get }
public static var high: SpotLightComponent.Shadow.QualityMode { 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: SpotLightComponent.Shadow.QualityMode, b: SpotLightComponent.Shadow.QualityMode) -> 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 }
}
var
VideoPlayerComponent.portalSize
NewvisionOSpublic var portalSize: SIMD2<Float>
The portal entity size in meters.
This property has the format [width, height]. Defaults to [1.0, 0.5625] to have 16:9 aspect ratio. This is not available for Spatial Videos.
var
VirtualEnvironmentProbeComponent.influence
NewiOSmacOStvOSpublic var influence: VirtualEnvironmentProbeComponent.Influence
init
VirtualEnvironmentProbeComponent.init
NewiOSmacOStvOSpublic init(source: VirtualEnvironmentProbeComponent.Source = .none, influence: VirtualEnvironmentProbeComponent.Influence = .global)
No APIs match your filter.