PanelEntity
public class PanelEntity extends BaseEntity
| java.lang.Object | |||
| ↳ | androidx.xr.scenecore.BaseScenePose | ||
| ↳ | androidx.xr.scenecore.BaseEntity | ||
| ↳ | androidx.xr.scenecore.PanelEntity |
ActivityPanelEntity |
ActivityPanelEntity creates a spatial panel for embedding an |
MainPanelEntity |
Represents the main spatialized panel in a |
PanelEntity contains an arbitrary 2D Android View, within a spatialized XR scene.
Summary
Public methods |
|
|---|---|
static final @NonNull PanelEntity |
create(Factory method for a spatialized PanelEntity. |
static final @NonNull PanelEntity |
create(Factory method for a spatialized PanelEntity. |
final float |
The corner radius of the PanelEntity, in meters. |
final @NonNull PerceivedResolutionResult |
Gets the perceived resolution of this Entity in the |
final @NonNull FloatSize2d |
getSize()The dimensions of this PanelEntity in local space, in units relative to the scale of this Entity's parent. |
final @NonNull IntSize2d |
The dimensions of this PanelEntity, in pixels, which is the resolution of the underlying surface. |
final boolean |
True if this panel is the MainPanelEntity, false otherwise. |
final void |
setCornerRadius(float cornerRadius)The corner radius of the PanelEntity, in meters. |
final void |
setSize(@NonNull FloatSize2d size)The dimensions of this PanelEntity in local space, in units relative to the scale of this Entity's parent. |
final void |
setSizeInPixels(@NonNull IntSize2d sizeInPixels)The dimensions of this PanelEntity, in pixels, which is the resolution of the underlying surface. |
Inherited methods |
||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
|
Public methods
create
public static final @NonNull PanelEntity create(
@NonNull Session session,
@NonNull View view,
@NonNull FloatSize2d dimensions,
@NonNull String name,
@NonNull Pose pose
)
Factory method for a spatialized PanelEntity.
| Parameters | |
|---|---|
@NonNull Session session |
XR |
@NonNull View view |
|
@NonNull FloatSize2d dimensions |
Spatialized dimensions for the underlying surface for the given view, in meters. |
@NonNull String name |
Name of this PanelEntity. |
@NonNull Pose pose |
|
| Returns | |
|---|---|
@NonNull PanelEntity |
a PanelEntity instance. |
create
public static final @NonNull PanelEntity create(
@NonNull Session session,
@NonNull View view,
@NonNull IntSize2d pixelDimensions,
@NonNull String name,
@NonNull Pose pose
)
Factory method for a spatialized PanelEntity.
| Parameters | |
|---|---|
@NonNull Session session |
XR |
@NonNull View view |
|
@NonNull IntSize2d pixelDimensions |
Dimensions for the underlying surface for the given view, in pixels. |
@NonNull String name |
Name of the panel. |
@NonNull Pose pose |
|
| Returns | |
|---|---|
@NonNull PanelEntity |
a PanelEntity instance. |
getCornerRadius
public final float getCornerRadius()
The corner radius of the PanelEntity, in meters.
getPerceivedResolution
public final @NonNull PerceivedResolutionResult getPerceivedResolution()
Gets the perceived resolution of this Entity in the CameraView.
This API is only intended for use in Full Space Mode and will return PerceivedResolutionResult.InvalidCameraView in Home Space Mode. For applications requiring perceived resolution in Home Space Mode, see MainPanelEntity.getPerceivedResolution.
This value represents the dimensions of the Entity on the camera view if its largest surface was facing the camera without changing the distance of the Entity to the camera. This can be used by clients to dynamically optimize the resolution of assets within the PanelEntity, for example by using lower-resolution assets within panels that are further from the viewer. The Entity's own rotation and the camera's viewing direction are disregarded.
| Returns | |
|---|---|
@NonNull PerceivedResolutionResult |
A |
| Throws | |
|---|---|
kotlin.IllegalStateException |
if Session.config.deviceTracking is not set to |
| See also | |
|---|---|
PerceivedResolutionResult |
getSize
public final @NonNull FloatSize2d getSize()
The dimensions of this PanelEntity in local space, in units relative to the scale of this Entity's parent.
getSizeInPixels
public final @NonNull IntSize2d getSizeInPixels()
The dimensions of this PanelEntity, in pixels, which is the resolution of the underlying surface.
This API doesn't do any scale compensation to the pixel dimensions.
isMainPanelEntity
public final boolean isMainPanelEntity()
True if this panel is the MainPanelEntity, false otherwise.
setCornerRadius
public final void setCornerRadius(float cornerRadius)
The corner radius of the PanelEntity, in meters.
setSize
public final void setSize(@NonNull FloatSize2d size)
The dimensions of this PanelEntity in local space, in units relative to the scale of this Entity's parent.
setSizeInPixels
public final void setSizeInPixels(@NonNull IntSize2d sizeInPixels)
The dimensions of this PanelEntity, in pixels, which is the resolution of the underlying surface.
This API doesn't do any scale compensation to the pixel dimensions.