API reference
API reference
Select your platform
No SDKs available
No versions available

com.meta.spatial.runtime

Package-level declarations

Types

NameSummary
enum AddressMode : Enum<AddressMode>

Enum class representing the addressing mode for texture coordinates outside an image.
enum AlphaMode : Enum<AlphaMode>

Enum class representing the alpha modes for rendering.
data class Anchor(var handle: Long, var uuid: UUID)

Represents a spatial anchor in a mixed reality environment.
class AnimationTrack(val id: Int, val name: String, val length: Float)

Represents an animation track, which is a sequence of animations that can be played back.
interface AssetFetcher
enum BlendFactor : Enum<BlendFactor>

These coefficients are used to calculate the final color and alpha values of a blended layer. "Source" refers to the layer you are currently compositing. "Destination" refers to whatever is already in the buffer.
enum BlendMode : Enum<BlendMode>

Enum class representing the blending modes for rendering.
object ButtonBits

Defines bit flags for controller buttons and input states.
class ButtonClickEventArgs(val hitInfo: HitInfo, val dataModel: DataModel) : EventArgs

Event arguments for button click events.
class ButtonDownEventArgs(val hitInfo: HitInfo, val button: ControllerButton, val dataModel: DataModel) : EventArgs

Event arguments for button press events.
class ButtonHoverEventArgs(val isStart: Boolean, val dataModel: DataModel) : EventArgs

Event arguments for hover events.
class ButtonHoverMoveEventArgs(val hitInfo: HitInfo, val dataModel: DataModel) : EventArgs

Event arguments for hover movement events.
class ButtonReleaseEventArgs(val hitInfo: HitInfo, val button: ControllerButton, val dataModel: DataModel) : EventArgs

Event arguments for button release events.
enum ControllerButton : Enum<ControllerButton>

Represents the various buttons and touch inputs on VR controllers.
data class ControllerPose(val pose: Pose, val flags: Int)

Experimental api that represents a controller’s pose with additional tracking state information.
class CylinderLayerConfig(var radius: Float, var alphaBlend: LayerAlphaBlend? = null, var colorScaleBias: LayerColorScaleBias? = null, var zIndex: Int = 0) : LayerConfig

Layer config for a single-sided, cylindrical surface
enum DepthTest : Enum<DepthTest>

Defines depth test comparison functions used in 3D rendering.
enum DepthWrite : Enum<DepthWrite>

Controls whether rendering operations write to the depth buffer.
class EquirectLayerConfig(var radius: Float, var centralHorizontalAngle: Float = (2.0 * Math.PI).toFloat(), var upperVerticalAngle: Float = (Math.PI / 2).toFloat(), var lowerVerticalAngle: Float = -(Math.PI / 2).toFloat(), var alphaBlend: LayerAlphaBlend? = null, var colorScaleBias: LayerColorScaleBias? = null, var zIndex: Int = 0) : LayerConfig

Layer config for a single-sided, surface projected on the inside of a sphere
enum Filter : Enum<Filter>

Enum class representing the filtering modes for texture sampling.
class HitInfo(val entity: Entity?, val sceneObjectHandle: Long, val nodeId: Int, val meshElementId: Int, val distance: Float, val point: Vector3, val normal: Vector3, val textureCoordinate: Vector2)

Contains information about a ray intersection hit in a 3D scene.
interface InputListener

Interface for handling input events on SceneObjects.
data class LayerAlphaBlend(val sourceFactorColor: BlendFactor, val destinationFactorColor: BlendFactor, val sourceFactorAlpha: BlendFactor, val destinationFactorAlpha: BlendFactor)

Defines the coefficients of how to blend the layer (using an add operation). "Source" refers to the layer you are currently compositing and "destination" refers to whatever is already in the buffer. This compositing can be modeled by:
class LayerColorScaleBias(var scale: Vector4, var bias: Vector4)

Controls color adjustment for rendering layers.
open class LayerConfig(var alphaBlend: LayerAlphaBlend? = null, var colorScaleBias: LayerColorScaleBias? = null, var zIndex: Int = 0, var secure: Boolean = false, var filters: Int = 0)

Configuration options for rendering layers. Setting this in PanelConfig will enable Layers.
object LayerFilters

Provides constants for different layer filter configurations used in spatial rendering.
enum MaterialSidedness : Enum<MaterialSidedness>

Controls which sides of a mesh are rendered with a material.
object NetworkedAssetLoader

Singleton for downloading and caching remote assets.
data class PanelConfigOptions(var layoutHeightInPx: Int = 0, var layoutWidthInPx: Int = 0, var layoutHeightInDp: Float = 0.0f, var layoutWidthInDp: Float = 0.0f, var layoutDpi: Int = DEFAULT_DPI, var height: Float = 1.0f * 3f / 4f, var width: Float = 1.0f, var radiusForCylinderOrSphere: Float = MAX_RADIUS, var pivotOffsetHeight: Float = 0.5f, var pivotOffsetWidth: Float = 0.5f, var fractionOfScreen: Float = 0.5f, var mips: Int = 4, var samplerConfig: SamplerConfig = DEFAULT_PANEL_SAMPLER, var unlit: Boolean = true, var includeGlass: Boolean = true, var stereoMode: StereoMode = StereoMode.None, var alphaMode: AlphaMode = AlphaMode.MASKED, var forceSceneTexture: Boolean = false, var clickButtons: Int = DEFAULT_CLICK_BUTTONS, var panelShader: String = "", var effectShader: String = "", var sceneMeshCreator: PanelShapeConfig.(texture: SceneTexture) -> SceneMesh? = null, var layerConfig: LayerConfig? = null, var panelShapeType: PanelShapeType = PanelShapeType.QUAD, var enableTransparent: Boolean = false, var enableLayer: Boolean = false, var themeResourceId: Int = 0) : PanelShapeConfig

Configuration options for the panel. This is used to configure the panel’s size, shape, resolution, mesh creator, and other properties. This is used to create the panel’s SceneObject.
open class PanelDisplay(ctx: <Error class: unknown class>, val panelSurface: PanelSurface, surfaceDPI: Int, getView: (<Error class: unknown class>) -> <Error class: unknown class>? = null, intent: <Error class: unknown class>? = null, themeResourceId: Int = 0, onAutoReleased: () -> Unit? = null)

Handles displaying content on panels. Supports two display methods:
class PanelInputListener(ctx: SpatialContext, clickButtons: Int, scene_: Scene) : InputListener

Internal input handler for panels that translates 3D spatial input to Android MotionEvents.
class PanelSceneObject : SceneObject

PanelSceneObject combines several components to create an interactive 2D surface in 3D space in the following order:
class PanelShapeconstructor(scene: Scene, options: PanelConfigOptions2, val panelSurface: PanelSurface, sceneObject: SceneObject, var config: PanelShapeConfig? = null)

Creates and manages the 3D shape of a panel.
open class PanelShapeConfig(var pivotOffsetHeight: Float = 0.5f, var pivotOffsetWidth: Float = 0.5f, var fractionOfScreen: Float = 0.5f, var height: Float = 1.0f * 3f / 4f, var width: Float = 1.0f, var radiusForCylinderOrSphere: Float = MAX_RADIUS, var unlit: Boolean = true, var includeGlass: Boolean = true, var stereoMode: StereoMode = StereoMode.None, var alphaMode: AlphaMode = AlphaMode.HOLE_PUNCH, var forceSceneTexture: Boolean = true, var panelShader: String = SceneMaterial.HOLE_PUNCH_PANEL_SHADER, var sceneMeshCreator: PanelShapeConfig.(texture: SceneTexture) -> SceneMesh? = null, var layerConfig: LayerConfig? = LayerConfig(), var panelShapeType: PanelShapeType = PanelShapeType.QUAD, var enableTransparent: Boolean = true, var enableLayer: Boolean = true)

This class defines the common properties used to configure the geometry and appearance of panels in 3D space. It serves as the base class for PanelConfigOptions, which provides additional parameters to intialize the Android Virtual Display.
enum PanelShapeType : Enum<PanelShapeType>

Defines the types of panel shapes available.
class PanelSurface(scene: Scene, val widthInPx: Int, val heightInPx: Int, mips: Int, samplerConfig: SamplerConfig = PanelConfigOptions.DEFAULT_PANEL_SAMPLER, useSwapchain: Boolean, useTexture: Boolean, fragmentShader: String = "", val isProtected: Boolean = false)

Manages the rendering surface for panels in 3D space.
class PointerEvent(val source: Entity, val type: Int, val hitInfo: HitInfo, val scrollInfo: Vector2 = Vector2(), val semanticType: Int = SemanticType.Unknown.id, val pointerType: Int = 0)

Data class representing a pointer event.
enum PointerEventType : Enum<PointerEventType>

Enum class representing different types of pointer events.
class QuadLayerConfig(var alphaBlend: LayerAlphaBlend? = null, var colorScaleBias: LayerColorScaleBias? = null, var zIndex: Int = 0) : LayerConfig

Layer config for a flat, single-sided, rectangular surface
enum ReferenceSpace : Enum<ReferenceSpace>

Reference spaces determine how positions and orientations are interpreted relative to the user and physical environment. Each space has different behavior when the user recenters their view or moves around in the physical world.
data class RenderConfiguration(val suggestRenderSizeScale: Float = 1.0f)

Controls the render resolution scaling for the app. Set in AppSystemActivity.renderConfiguration().
data class SamplerConfig(val minFilter: Filter = Filter.LINEAR, val magFilter: Filter = Filter.LINEAR, val mipmapMode: Filter = Filter.LINEAR, val addressModeU: AddressMode = AddressMode.REPEAT, val addressModeV: AddressMode = AddressMode.REPEAT, val lodBias: Float = 0.0f)

Data class representing a sampler configuration.
class Scene(val spatialInterface: SpatialInterface)

Scene class for representing the 3D scene. This class provides methods for querying the scene, managing scene objects, handling input interactions, and configuring the environment settings.
class SceneAudioAsset

Represents an audio asset that can be played in a 3D scene.
class SceneAudioPlayer

Controls playback of spatial audio in a 3D scene with dynamic control capabilities.
class SceneCylinderLayer(scene: Scene, swapChain: SceneSwapchain, radius: Float, centralAngle: Float, aspectRatio: Float, pivotX: Float, pivotY: Float, stereoMode: StereoMode, sceneObject: SceneObject) : SceneLayer

SceneCylinderLayer creates a Layer that wraps content around a cylindrical surface.
class SceneEquirectLayer(scene: Scene, swapChain: SceneSwapchain, radius: Float, centralHorizontalAngle: Float, upperVerticalAngle: Float, lowerVerticalAngle: Float, pivotX: Float, pivotY: Float, stereoMode: StereoMode, sceneObject: SceneObject) : SceneLayer

SceneEquirectLayer creates a layer that maps content onto a spherical surface. Can be used to create 180 or 360 degree content by adjusting the centralHorizontalAngle.
abstract class SceneLayer(scene_: Scene, id_: Int)

Base class for creating a Layer in the Scene.
class SceneMaterial

Represents a material used for rendering SceneMeshes. SceneMaterials are created from SceneTextures and can also be generated with custom shaders via SceneMaterial.custom().
class SceneMaterialAttribute(val name: String, val type: SceneMaterialDataType)

Defines a named attribute for use with custom shaders.
enum SceneMaterialDataType : Enum<SceneMaterialDataType>

Defines the data types that can be used as attributes in custom shaders.
class SceneMesh

SceneMesh combines SceneMaterials with geometry to create a textured 3D Object. Geometries can come from:
open class SceneObject

The SceneObject class combines a SceneMesh with position and rotation to fully represent a 3D Object in the scene. Entitys with meshes have SceneObjects created and managed by the com.meta.spatial.toolkit.Transform, com.meta.spatial.toolkit.Mesh, and com.meta.spatial.toolkit.Panel components.
open class ScenePhysicsObject

Represents a physics-enabled object in a 3D scene. Can be used to create custom physics implementations using the ECS.
class SceneQuadLayer(scene: Scene, swapChain: SceneSwapchain, dimW: Float, dimH: Float, pivotX: Float, pivotY: Float, stereoMode: StereoMode, sceneObject: SceneObject) : SceneLayer

SceneQuadLayer creates a Layer for a flat rectangular surface.
class SceneSwapchain

Represents a swapchain for rendering Layers. Multiple SceneLayers can sample from a single SceneSwapchain
class SceneTexture

The SceneTexture class represents a texture resource. SceneTextures are used to construct SceneMaterials and can be used as inputs for shaders also in the construction of SceneMaterials.
enum SemanticType : Enum<SemanticType>

Enum class representing different semantic types for pointer events.
enum SortOrder : Enum<SortOrder>

Defines the rendering order for materials in a 3D scene.
enum StereoMode : Enum<StereoMode>

StereoMode controls how a single texture is mapped to left and right eye views for stereoscopic rendering. Used in PanelConfigOptions for panel creation and SceneMaterial for material mapping based on eye display.
class TriangleMesh

TriangleMesh provides direct access to the vertex and index data of a 3D mesh, allowing for dynamic creation and modification of geometry.
open class VrActivity

VrActivity serves as the base class inherited by AppSystemActivity, which should be used for creating Spatial Activities instead of directly subclassing VrActivity. This class provides essential functionalities required by all Meta Spatial applications, including:

Properties

NameSummary
errorCodeMap
val errorCodeMap: Map<Int, NativeResult>
Did you find this page helpful?
Thumbs up icon
Thumbs down icon