Package-level declarations

Types

Link copied to clipboard

A builder for spatial UI attachments

Link copied to clipboard
@Stable
abstract class LoadedModel

Loaded model.

Link copied to clipboard
@Stable
sealed class ModelLoadingState

The state of loading a 3D model.

Link copied to clipboard

The resizability of a 3D model.

Link copied to clipboard
@Stable
open class Source<T>

Define datasource support by SpatialModelView.

Link copied to clipboard
abstract class SpatialModelScope

Scope for SpatialModelView content function.

Link copied to clipboard

The attachments belong to a SpatialView

Properties

Link copied to clipboard

Get the rotation of the volume towards to observer .

Functions

Link copied to clipboard
@Composable
fun attachmentPanelComponent(context: Context = LocalContext.current, size: IntSize = panelSize(Dp.Unspecified, Dp.Unspecified), alignment: AttachmentPanelComponent.Alignment = AttachmentPanelComponent.Alignment.UNSPECIFIED, content: @Composable () -> Unit): AttachmentPanelComponent

Creates a AttachmentPanelComponent in another Composable. Notice that this function is for your convenience to create a AttachmentPanelComponent in your Composable, once the return value set to an Entity, your later changes will not take effect.

Link copied to clipboard
fun AttachmentPanelComponent.content(compositionContext: CompositionContext? = null, content: @Composable () -> Unit): AttachmentPanelComponent

Sets the content of the AttachmentPanelComponent.

Link copied to clipboard
suspend fun Entity.Companion.loadFrom(source: Source<*>): Entity

Load entity from Source. Its running on IO thread. will auto destroy entity when coroutine is canceled

Link copied to clipboard
@Composable
fun SpatialModelScope.Model(model: LoadedModel, modifier: Modifier = Modifier)

Display 3d model when load success.

Link copied to clipboard
@Composable
fun panelSize(width: Dp, height: Dp): IntSize

Converts the Dp size to IntSize in pixel for AttachmentPanelComponent using. If the Dp is Dp.Unspecified, the IntSize will be WRAP_CONTENT.

@Composable
fun panelSize(width: Float, height: Float, lengthUnit: LengthUnit = LengthUnit.Meters): IntSize

Converts the Float size of length unit to IntSize in pixel for AttachmentPanelComponent using. If the Float is Float.NaN, the IntSizewill be WRAP_CONTENT.

Link copied to clipboard

Set compose color to PhysicallyBasedMaterial for convenience.

fun UnlitMaterial.setBaseColor(color: Color)

Set compose color to UnlitMaterial for convenience.

Link copied to clipboard
@Composable
fun SpatialModelView(source: Source<*>, modifier: Modifier = Modifier, resizability: Resizability = Resizability.None, content: @Composable SpatialModelScope.(state: ModelLoadingState) -> Unit = { state -> if (state is ModelLoadingState.Success) { Model(state.model) } })

A view that asynchronously loads and displays a 3D model from source.

Link copied to clipboard
@Composable
fun SpatialView(modifier: Modifier = Modifier, update: (content: SpatialViewContent, attachments: SpatialViewAttachments) -> Unit? = null, attachments: AttachmentPanelBuilder.() -> Unit? = null, initial: suspend (content: SpatialViewContent, attachments: SpatialViewAttachments) -> Unit)

The container for 3D content.

Link copied to clipboard
fun Color.toColor4(): Color4

convert compose Color to ecs Color4 for compose developers