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

PanelConfigOptions Class

Modifiers: final
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.

See Also

Signature

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

Constructors

PanelConfigOptions ( layoutHeightInPx , layoutWidthInPx , layoutHeightInDp , layoutWidthInDp , layoutDpi , height , width , radiusForCylinderOrSphere , pivotOffsetHeight , pivotOffsetWidth , fractionOfScreen , mips , samplerConfig , unlit , includeGlass , stereoMode , alphaMode , forceSceneTexture , clickButtons , panelShader , effectShader , sceneMeshCreator , layerConfig , panelShapeType , enableTransparent , enableLayer , themeResourceId ) : PanelConfigOptions
Signature
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)
Parameters
layoutHeightInPx: Int
Height of Android virtual display in pixels. Overrides layoutHeightInDp.
layoutWidthInPx: Int
Width of Android virtual display in pixels. Overrides layoutWidthInDp and fractionOfScreen.
layoutHeightInDp: Float
Height of Panel in dp (density-independent pixels). Overridden by layoutHeightInPx.
layoutWidthInDp: Float
Width of Panel in dp (density-independent pixels). Overridden by layoutWidthInPx. Overrides fractionOfScreen value.
layoutDpi: Int
The dpi of the panel, used to calculate Android virtual display size in pixels when layoutWidthInDp and layoutHeightInDp are set.
height: Float
The height of the panel in meters, used to calculate the size of the panel in the scene.
width: Float
The width of the panel in meters, used to calculate the size of the panel in the scene.
radiusForCylinderOrSphere: Float
The radius of the panel in meters if PanelShapeType is set to Cylinder or Equirect.
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: Float
Panel offset from Entity origin relative to panel width (Quad panels only). Default of 0.5f places panel in center of Entity.
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.
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.
samplerConfig: SamplerConfig
The SamplerConfig to set the panel texture/layer.
unlit: Boolean
If true, the panel will ignore scene lighting.
includeGlass: Boolean
If true, the panel will have glass frame effect rendered in the scene. Only applies to Quad panels, overriden by sceneMeshCreator.
stereoMode: StereoMode
The StereoMode to use for the panel.
alphaMode: AlphaMode
The AlphaMode to use for the panel.
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.
clickButtons: Int
The buttons mask that we use to determine if we should simulate a click on the panel.
panelShader: String
Optional path to a custom shader to use for the panel. SceneMaterial.Companion has default bundled shaders that can be used.
effectShader: String
Optional path to a custom shader to use in the effect chain.
sceneMeshCreator: Function2?
Optional function to create a custom mesh for the panel. Will override any values set for width, height, radius, etc.
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.
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).
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.
enableLayer: Boolean
Enables Layers for the panel. Deprecated, use layerConfig instead.
themeResourceId: Int
The theme resource id to use for the panel.

Properties

alphaMode : AlphaMode
[Get][Set]
The AlphaMode to use for the panel.
Signature
open override var alphaMode: AlphaMode
clickButtons : Int
[Get][Set]
The buttons mask that we use to determine if we should simulate a click on the panel.
Signature
var clickButtons: Int
effectShader : String
[Get][Set]
Optional path to a custom shader to use in the effect chain.
Signature
var effectShader: String
enableLayer : Boolean
[Get][Set]
DeprecatedUse layerConfig instead
Enables Layers for the panel. Deprecated, use layerConfig instead.
Signature
open override var enableLayer: Boolean
enableTransparent : Boolean
[Get][Set]
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.
Signature
open override var enableTransparent: Boolean
forceSceneTexture : Boolean
[Get][Set]
Forces the SceneTexture to be created when Layers are enabled. This can be useful for masks and shaders but comes at a performance cost.
Signature
open override var forceSceneTexture: Boolean
fractionOfScreen : Float
[Get][Set]
Percentage of screen that panel should fit in. Optimizes resolution of panel based on resolution of Quest device. Overridden by layoutWidthInDp and layoutWidthInPx.
Signature
open override var fractionOfScreen: Float
height : Float
[Get][Set]
The height of the panel in meters, used to calculate the size of the panel in the scene.
Signature
open override var height: Float
includeGlass : Boolean
[Get][Set]
If true, the panel will have glass frame effect rendered in the scene. Only applies to Quad panels, overriden by sceneMeshCreator.
Signature
open override var includeGlass: Boolean
layerConfig : LayerConfig?
[Get][Set]
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.
Signature
open override var layerConfig: LayerConfig?
layoutDpi : Int
[Get][Set]
The dpi of the panel, used to calculate Android virtual display size in pixels when layoutWidthInDp and layoutHeightInDp are set.
Signature
var layoutDpi: Int
layoutHeightInDp : Float
[Get][Set]
Height of Panel in dp (density-independent pixels). Overridden by layoutHeightInPx.
Signature
var layoutHeightInDp: Float
layoutHeightInPx : Int
[Get][Set]
Height of Android virtual display in pixels. Overrides layoutHeightInDp.
Signature
var layoutHeightInPx: Int
layoutWidthInDp : Float
[Get][Set]
Width of Panel in dp (density-independent pixels). Overridden by layoutWidthInPx. Overrides fractionOfScreen value.
Signature
var layoutWidthInDp: Float
layoutWidthInPx : Int
[Get][Set]
Width of Android virtual display in pixels. Overrides layoutWidthInDp and fractionOfScreen.
Signature
var layoutWidthInPx: Int
mips : Int
[Get][Set]
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.
Signature
var mips: Int
panelShader : String
[Get][Set]
Optional path to a custom shader to use for the panel. SceneMaterial.Companion has default bundled shaders that can be used.
Signature
open override var panelShader: String
panelShapeType : PanelShapeType
[Get][Set]
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).
Signature
open override var panelShapeType: PanelShapeType
pivotOffsetHeight : Float
[Get][Set]
Panel offset from Entity origin relative to panel height (Quad panels only). Default of 0.5f places panel in center of Entity.
Signature
open override var pivotOffsetHeight: Float
pivotOffsetWidth : Float
[Get][Set]
Panel offset from Entity origin relative to panel width (Quad panels only). Default of 0.5f places panel in center of Entity.
Signature
open override var pivotOffsetWidth: Float
radiusForCylinderOrSphere : Float
[Get][Set]
The radius of the panel in meters if PanelShapeType is set to Cylinder or Equirect.
Signature
open override var radiusForCylinderOrSphere: Float
samplerConfig : SamplerConfig
[Get][Set]
The SamplerConfig to set the panel texture/layer.
Signature
var samplerConfig: SamplerConfig
sceneMeshCreator : Function2?
[Get][Set]
Optional function to create a custom mesh for the panel. Will override any values set for width, height, radius, etc.
Signature
open override var sceneMeshCreator: PanelShapeConfig.(texture: SceneTexture) -> SceneMesh?
stereoMode : StereoMode
[Get][Set]
The StereoMode to use for the panel.
Signature
open override var stereoMode: StereoMode
themeResourceId : Int
[Get][Set]
The theme resource id to use for the panel.
Signature
var themeResourceId: Int
unlit : Boolean
[Get][Set]
If true, the panel will ignore scene lighting.
Signature
open override var unlit: Boolean
width : Float
[Get][Set]
The width of the panel in meters, used to calculate the size of the panel in the scene.
Signature
open override var width: Float

Functions

calcDPI () : Int
Get the current dpi setting.
Signature
fun calcDPI(): Int
Returns
Int
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.
Signature
fun calcLayoutHeightInPx(): Int
Returns
Int
The height of the panel in pixels.
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.
Signature
fun calcLayoutWidthInPx(): Int
Returns
Int
The width of the panel in pixels.
dpToPx ( dp ) : Int
Converts dp to px based on the current dpi setting.
Signature
fun dpToPx(dp: Float): Int
Parameters
dp: Float
The value in dp to convert to px.
Returns
Int
generateSceneMeshCreator () : Function2
Generates a scene mesh creator function based on the current configuration.
This method determines which mesh creator to use based on the panel shape type and other configuration properties. If a custom mesh creator is already set, it will be returned instead.
Signature
fun generateSceneMeshCreator(): PanelShapeConfig.(texture: SceneTexture) -> SceneMesh
Returns
Function2
A function that creates a SceneMesh for the panel
init ()
Signature
fun init()

Companion Object

Companion Object Properties

DEFAULT_CLICK_BUTTONS : Int
[Get]
Signature
val DEFAULT_CLICK_BUTTONS: Int
DEFAULT_DPI : Int
[Get]
Signature
const val DEFAULT_DPI: Int
DEFAULT_PANEL_SAMPLER : SamplerConfig
[Get]
Signature
val DEFAULT_PANEL_SAMPLER: SamplerConfig
DEVICE_DPI : Int
[Get]
Signature
val DEVICE_DPI: Int
DEVICE_PPD :
[Get]
Signature
val DEVICE_PPD: 
EYEBUFFER_HEIGHT : Int
[Get]
Signature
const val EYEBUFFER_HEIGHT: Int = 2208
EYEBUFFER_WIDTH : Int
[Get]
Signature
const val EYEBUFFER_WIDTH: Int = 2064
MIPS_MAX : Int
[Get]
Signature
const val MIPS_MAX: Int
Did you find this page helpful?
Thumbs up icon
Thumbs down icon