Entity
public interface Entity extends ScenePose
BaseEntity |
The BaseEntity is an implementation of Entity interface that wraps a platform entity. |
ActivityPanelEntity |
ActivityPanelEntity creates a spatial panel for embedding an |
ActivitySpace |
ActivitySpace is an |
AnchorEntity |
An AnchorEntity tracks a |
GltfModelEntity |
GltfModelEntity is a concrete implementation of Entity that hosts a glTF model. |
GroupEntity |
An |
MainPanelEntity |
Represents the main spatialized panel in a |
PanelEntity |
PanelEntity contains an arbitrary 2D Android |
SurfaceEntity |
SurfaceEntity is an |
Interface for a spatial Entity. An Entity's Poses are represented as being relative to their parent. Applications create and manage Entity instances to construct spatial scenes.
Summary
Public methods |
|
|---|---|
abstract void |
Sets an Entity to be a child of this Entity in the scene graph. |
abstract boolean |
addComponent(@NonNull Component component)Adds a Component to this Entity. |
abstract void |
dispose()Disposes of any system resources held by this Entity, and transitively calls dispose() on all its children. |
default @FloatRange(from = 0.0, to = 1.0) float |
getAlpha()Returns the alpha transparency set for this Entity. |
abstract @FloatRange(from = 0.0, to = 1.0) float |
Returns the alpha transparency set for this Entity, relative to given Space. |
abstract @NonNull List<@NonNull Entity> |
Provides the list of all children of this entity. |
abstract @NonNull List<@NonNull Component> |
Retrieves all components attached to this Entity. |
abstract @NonNull List<@NonNull T> |
<T extends Component> getComponentsOfType(@NonNull Class<@NonNull T> type)Retrieves all Components of the given type |
abstract @NonNull CharSequence |
Alternate text for this Entity to be consumed by Accessibility systems. |
abstract Entity |
The parent of this Entity, from which this Entity will inherit most of its properties. |
default @NonNull Pose |
getPose()Returns the |
abstract @NonNull Pose |
Returns the |
default @FloatRange(from = 0.0) float |
getScale()Returns the local scale of this Entity, not inclusive of the parent's scale. |
abstract @FloatRange(from = 0.0) float |
Returns the scale of this entity, relative to given space. |
abstract boolean |
isEnabled(boolean includeParents)Returns the enabled status of this Entity. |
abstract void |
Remove all components from this Entity. |
abstract void |
removeComponent(@NonNull Component component)Removes the given Component from this Entity. |
default void |
setAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha)Sets the alpha transparency of the Entity and its children. |
abstract void |
setAlpha(Sets the alpha transparency of the Entity relative to given Space. |
abstract void |
setContentDescription(@NonNull CharSequence contentDescription)Alternate text for this Entity to be consumed by Accessibility systems. |
abstract void |
setEnabled(boolean enabled)Sets the local enabled state of this Entity. |
abstract void |
The parent of this Entity, from which this Entity will inherit most of its properties. |
default void |
Sets the |
abstract void |
Sets the |
default void |
setScale(@FloatRange(from = 0.0) float scale)Sets the scale of this Entity relative to its parent. |
abstract void |
setScale(@FloatRange(from = 0.0) float scale, @NonNull Space relativeTo)Sets the scale of this Entity relative to the given Space. |
Inherited methods |
||||||||
|---|---|---|---|---|---|---|---|---|
|
Public methods
addChild
abstract void addChild(@NonNull Entity child)
Sets an Entity to be a child of this Entity in the scene graph. The child Entity will inherit properties from the parent, and will be represented in the parent's coordinate space. From a User's perspective, as this Entity moves, the child Entity will move with it.
addComponent
abstract boolean addComponent(@NonNull Component component)
Adds a Component to this Entity.
| Returns | |
|---|---|
boolean |
True if given Component was successfully added to the Entity. |
dispose
abstract void dispose()
Disposes of any system resources held by this Entity, and transitively calls dispose() on all its children. Once disposed, this Entity is invalid and cannot be used again.
getAlpha
default @FloatRange(from = 0.0, to = 1.0) float getAlpha()
Returns the alpha transparency set for this Entity.
This does not necessarily equal the perceived alpha of the Entity, as the Entity may have some alpha difference applied from its parent or the system.
getAlpha
abstract @FloatRange(from = 0.0, to = 1.0) float getAlpha(@NonNull Space relativeTo)
Returns the alpha transparency set for this Entity, relative to given Space.
getChildren
abstract @NonNull List<@NonNull Entity> getChildren()
Provides the list of all children of this entity.
getComponents
abstract @NonNull List<@NonNull Component> getComponents()
Retrieves all components attached to this Entity.
getComponentsOfType
abstract @NonNull List<@NonNull T> <T extends Component> getComponentsOfType(@NonNull Class<@NonNull T> type)
Retrieves all Components of the given type T and its sub-types attached to this Entity.
getContentDescription
abstract @NonNull CharSequence getContentDescription()
Alternate text for this Entity to be consumed by Accessibility systems.
getParent
abstract Entity getParent()
The parent of this Entity, from which this Entity will inherit most of its properties. For example, this Entity's Pose is defined in relation to the parent Entity's coordinate space, so as the parent moves, this Entity will move with it. Setting the parent to null will remove the Entity from the scene graph.
getPose
default @NonNull Pose getPose()
Returns the Pose for this Entity, relative to its parent.
getPose
abstract @NonNull Pose getPose(@NonNull Space relativeTo)
Returns the Pose for this Entity, relative to the provided Space.
getScale
default @FloatRange(from = 0.0) float getScale()
Returns the local scale of this Entity, not inclusive of the parent's scale.
| Returns | |
|---|---|
@FloatRange(from = 0.0) float |
Current uniform scale applied to self and children. |
getScale
abstract @FloatRange(from = 0.0) float getScale(@NonNull Space relativeTo)
Returns the scale of this entity, relative to given space.
| Parameters | |
|---|---|
@NonNull Space relativeTo |
Get the scale relative to given Space. Default value is the parent space. |
| Returns | |
|---|---|
@FloatRange(from = 0.0) float |
Current uniform scale applied to self and children. |
isEnabled
abstract boolean isEnabled(boolean includeParents)
Returns the enabled status of this Entity.
| Parameters | |
|---|---|
boolean includeParents |
Whether to include the enabled status of parents in the returned value. |
| Returns | |
|---|---|
boolean |
If includeParents is |
removeAllComponents
abstract void removeAllComponents()
Remove all components from this Entity.
removeComponent
abstract void removeComponent(@NonNull Component component)
Removes the given Component from this Entity.
setAlpha
default void setAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha)
Sets the alpha transparency of the Entity and its children. Values are in the range 0, 1 with 0 being fully transparent and 1 being fully opaque.
This value will affect the rendering of this Entity's children. Children of this node will have their alpha levels multiplied by this value and any alpha of this Entity's ancestors.
setAlpha
abstract void setAlpha(
@FloatRange(from = 0.0, to = 1.0) float alpha,
@NonNull Space relativeTo
)
Sets the alpha transparency of the Entity relative to given Space. Values are in the range 0, 1 with 0 being fully transparent and 1 being fully opaque.
This value will affect the rendering of this Entity's children. Children of this node will have their alpha levels multiplied by this value and any alpha of this entity's ancestors.
Usage restrictions:
-
If the provided
alphais outside the 0, 1 range, it will be clamped automatically to 0, 1.
| Parameters | |
|---|---|
@FloatRange(from = 0.0, to = 1.0) float alpha |
Alpha transparency level for the Entity. |
@NonNull Space relativeTo |
Sets alpha relative to given Space. Default value is the parent Space. |
setContentDescription
abstract void setContentDescription(@NonNull CharSequence contentDescription)
Alternate text for this Entity to be consumed by Accessibility systems.
setEnabled
abstract void setEnabled(boolean enabled)
Sets the local enabled state of this Entity.
When false, this Entity and all descendants will not be rendered in the scene, and the Entity will not respond to input events. If an Entity's local enabled state is true, the Entity will still be considered not enabled if at least one of its ancestors is not enabled.
| Parameters | |
|---|---|
boolean enabled |
The new local enabled state of this Entity. |
setParent
abstract void setParent(Entity parent)
The parent of this Entity, from which this Entity will inherit most of its properties. For example, this Entity's Pose is defined in relation to the parent Entity's coordinate space, so as the parent moves, this Entity will move with it. Setting the parent to null will remove the Entity from the scene graph.
setPose
default void setPose(@NonNull Pose pose)
Sets the Pose for this Entity, relative to its parent.
setPose
abstract void setPose(@NonNull Pose pose, @NonNull Space relativeTo)
Sets the Pose for this Entity. The Pose given is set relative to the Space provided.
setScale
default void setScale(@FloatRange(from = 0.0) float scale)
Sets the scale of this Entity relative to its parent. This value will affect the rendering of this Entity's children. As the scale increases, this will uniformly stretch the content of the Entity.
| Parameters | |
|---|---|
@FloatRange(from = 0.0) float scale |
The uniform scale factor from the parent. |
setScale
abstract void setScale(@FloatRange(from = 0.0) float scale, @NonNull Space relativeTo)
Sets the scale of this Entity relative to the given Space. This value will affect the rendering of this Entity's children. As the scale increases, this will uniformly stretch the content of the Entity.
| Parameters | |
|---|---|
@FloatRange(from = 0.0) float scale |
The uniform scale factor. |
@NonNull Space relativeTo |
Set the scale relative to given Space. Default value is the parent Space. |