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

PanelConfigOptions

PanelConfigOptions

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.
More information on Panel creation and registration can be found here: https://developers.meta.com/horizon/documentation/spatial-sdk/spatial-sdk-2dpanel-registration
See also
 
PanelRegistration

Constructors

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

Types

NameSummary
Companion
object Companion

Properties

NameSummary
alphaMode
open override var alphaMode: AlphaMode

The AlphaMode to use for the panel.
clickButtons
var clickButtons: Int

The buttons mask that we use to determine if we should simulate a click on the panel.
effectShader
var effectShader: String

Optional path to a custom shader to use in the effect chain.
enableLayer
open override var enableLayer: Boolean

Enables Layers for the panel. Deprecated, use layerConfig instead.
enableTransparent
open override var enableTransparent: Boolean

Need to enable this for layer panels to have working transparency. Side Effects: The SceneTexture will be created, and panelShader will be set to SceneMaterial.HOLE_PUNCH_PANEL_SHADER. This shader uses the SceneTexture to selectively holepunch transparent pixels.
forceSceneTexture
open override var forceSceneTexture: Boolean

Forces the SceneTexture to be created when Layers are enabled. This can be useful for masks and shaders but comes at a performance cost.
fractionOfScreen
open override var fractionOfScreen: Float

Percentage of screen that panel should fit in. Optimizes resolution of panel based on resolution of Quest device. Overridden by layoutWidthInDp and layoutWidthInPx.
height
open override var height: Float

The height of the panel in meters, used to calculate the size of the panel in the scene.
includeGlass
open override var includeGlass: Boolean

If true, the panel will have glass frame effect rendered in the scene. Only applies to Quad panels, overriden by sceneMeshCreator.
layerConfig
open override var layerConfig: LayerConfig?

Optional configuration for the panel’s layer. Setting this to non-null will enable Layers. Layers are used to render Panels with higher fidelity. More information can be found here: https://developers.meta.com/horizon/documentation/spatial-sdk/spatial-sdk-2dpanel-layers
layoutDpi
var layoutDpi: Int

The dpi of the panel, used to calculate Android virtual display size in pixels when layoutWidthInDp and layoutHeightInDp are set.
layoutHeightInDp
var layoutHeightInDp: Float

Height of Panel in dp (density-independent pixels). Overridden by layoutHeightInPx.
layoutHeightInPx
var layoutHeightInPx: Int

Height of Android virtual display in pixels. Overrides layoutHeightInDp.
layoutWidthInDp
var layoutWidthInDp: Float

Width of Panel in dp (density-independent pixels). Overridden by layoutWidthInPx. Overrides fractionOfScreen value.
layoutWidthInPx
var layoutWidthInPx: Int

Width of Android virtual display in pixels. Overrides layoutWidthInDp and fractionOfScreen.
mips
var mips: Int

Number of mip levels to use for panel texture. Mipmapping is the process of generating lower resolution versions of a texture to display on panels when they are far away.
panelShader
open override var panelShader: String

Optional path to a custom shader to use for the panel. SceneMaterial.Companion has default bundled shaders that can be used.
panelShapeType
open override var panelShapeType: PanelShapeType

Sets the shape of the Panel. Options exist at PanelShapeType. This parameter is used alongside radius, height, and width, to determine the geometry of the Panel mesh and layer (if enabled).
pivotOffsetHeight
open override var pivotOffsetHeight: Float

Panel offset from Entity origin relative to panel height (Quad panels only). Default of 0.5f places panel in center of Entity.
pivotOffsetWidth
open override var pivotOffsetWidth: Float

Panel offset from Entity origin relative to panel width (Quad panels only). Default of 0.5f places panel in center of Entity.
radiusForCylinderOrSphere
open override var radiusForCylinderOrSphere: Float

The radius of the panel in meters if PanelShapeType is set to Cylinder or Equirect.
samplerConfig
var samplerConfig: SamplerConfig

The SamplerConfig to set the panel texture/layer.
sceneMeshCreator
open override var sceneMeshCreator: PanelShapeConfig.(texture: SceneTexture) -> SceneMesh?

Optional function to create a custom mesh for the panel. Will override any values set for width, height, radius, etc.
stereoMode
open override var stereoMode: StereoMode

The StereoMode to use for the panel.
themeResourceId
var themeResourceId: Int

The theme resource id to use for the panel.
unlit
open override var unlit: Boolean

If true, the panel will ignore scene lighting.
width
open override var width: Float

The width of the panel in meters, used to calculate the size of the panel in the scene.

Functions

NameSummary
calcDPI
fun calcDPI(): Int

Get the current dpi setting.
calcLayoutHeightInPx
fun calcLayoutHeightInPx(): Int

Calculates the height of the panel in pixels based on the current configuration. This is used to creating the Android Virtual Display with the specified height in pixels.
calcLayoutWidthInPx
fun calcLayoutWidthInPx(): Int

Calculates the width of the panel in pixels based on the current configuration. This is used to creating the Android Virtual Display with the specified width in pixels.
dpToPx
fun dpToPx(dp: Float): Int

Converts dp to px based on the current dpi setting.
generateSceneMeshCreator
fun generateSceneMeshCreator(): PanelShapeConfig.(texture: SceneTexture) -> SceneMesh

Generates a scene mesh creator function based on the current configuration.
init
fun init()

Companion

object Companion

Properties

NameSummary
DEFAULT_CLICK_BUTTONS
val DEFAULT_CLICK_BUTTONS: Int
DEFAULT_DPI
const val DEFAULT_DPI: Int
DEFAULT_PANEL_SAMPLER
val DEFAULT_PANEL_SAMPLER: SamplerConfig
DEVICE_DPI
val DEVICE_DPI: Int
DEVICE_PPD
val DEVICE_PPD: <Error class: unknown class>
EYEBUFFER_HEIGHT
const val EYEBUFFER_HEIGHT: Int = 2208
EYEBUFFER_WIDTH
const val EYEBUFFER_WIDTH: Int = 2064
MIPS_MAX
const val MIPS_MAX: Int
Did you find this page helpful?
Thumbs up icon
Thumbs down icon