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

PanelShapeConfig Class

Modifiers: open
This class defines the common properties used to configure the geometry and appearance of panels in 3D space. It serves as the base class for PanelConfigOptions, which provides additional parameters to intialize the Android Virtual Display.

Signature

open class PanelShapeConfig(var pivotOffsetHeight: Float = 0.5f, var pivotOffsetWidth: Float = 0.5f, var fractionOfScreen: Float = 0.5f, var height: Float = 1.0f * 3f / 4f, var width: Float = 1.0f, var radiusForCylinderOrSphere: Float = MAX_RADIUS, var unlit: Boolean = true, var includeGlass: Boolean = true, var stereoMode: StereoMode = StereoMode.None, var alphaMode: AlphaMode = AlphaMode.HOLE_PUNCH, var forceSceneTexture: Boolean = true, var panelShader: String = SceneMaterial.HOLE_PUNCH_PANEL_SHADER, var sceneMeshCreator: PanelShapeConfig.(texture: SceneTexture) -> SceneMesh? = null, var layerConfig: LayerConfig? = LayerConfig(), var panelShapeType: PanelShapeType = PanelShapeType.QUAD, var enableTransparent: Boolean = true, var enableLayerFeatheredEdge: Boolean = false, var layerBlendType: PanelShapeLayerBlendType = PanelShapeLayerBlendType.OPAQUE, var enableLayer: Boolean = false)

Constructors

PanelShapeConfig ( pivotOffsetHeight , pivotOffsetWidth , fractionOfScreen , height , width , radiusForCylinderOrSphere , unlit , includeGlass , stereoMode , alphaMode , forceSceneTexture , panelShader , sceneMeshCreator , layerConfig , panelShapeType , enableTransparent , enableLayerFeatheredEdge , layerBlendType , enableLayer )
Signature
constructor(pivotOffsetHeight: Float = 0.5f, pivotOffsetWidth: Float = 0.5f, fractionOfScreen: Float = 0.5f, height: Float = 1.0f * 3f / 4f, width: Float = 1.0f, radiusForCylinderOrSphere: Float = MAX_RADIUS, unlit: Boolean = true, includeGlass: Boolean = true, stereoMode: StereoMode = StereoMode.None, alphaMode: AlphaMode = AlphaMode.HOLE_PUNCH, forceSceneTexture: Boolean = true, panelShader: String = SceneMaterial.HOLE_PUNCH_PANEL_SHADER, sceneMeshCreator: PanelShapeConfig.(texture: SceneTexture) -> SceneMesh? = null, layerConfig: LayerConfig? = LayerConfig(), panelShapeType: PanelShapeType = PanelShapeType.QUAD, enableTransparent: Boolean = true, enableLayerFeatheredEdge: Boolean = false, layerBlendType: PanelShapeLayerBlendType = PanelShapeLayerBlendType.OPAQUE, enableLayer: Boolean = false)
Parameters
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.
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.
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.
panelShader: String
  Optional path to a custom shader to use for the panel. SceneMaterial.Companion has default bundled shaders that can be used.
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.
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.
enableLayerFeatheredEdge: Boolean
  If enabled, this will feather the edges when using the layerConfig for the overlay.
layerBlendType: PanelShapeLayerBlendType
  Determines the blending mode for the panel. Blending modes in Spatial SDK control how the rendering pipeline handles transparency, depth writing, and color blending. Options exist at PanelShapeLayerBlendType.
enableLayer: Boolean
  Enables Layers for the panel. Deprecated, use layerConfig instead.

Properties

alphaMode : AlphaMode
[Get][Set]
The AlphaMode to use for the panel.
Signature
open var alphaMode: AlphaMode
enableLayer : Boolean
[Get][Set]
DeprecatedUse layerConfig instead
Enables Layers for the panel. Deprecated, use layerConfig instead.
Signature
open var enableLayer: Boolean
enableLayerFeatheredEdge : Boolean
[Get][Set]
If enabled, this will feather the edges when using the layerConfig for the overlay.
Signature
open var enableLayerFeatheredEdge: 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 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 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.
Signature
open 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 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 var includeGlass: Boolean
layerBlendType : PanelShapeLayerBlendType
[Get][Set]
Determines the blending mode for the panel. Blending modes in Spatial SDK control how the rendering pipeline handles transparency, depth writing, and color blending. Options exist at PanelShapeLayerBlendType.
Signature
open var layerBlendType: PanelShapeLayerBlendType
layerConfig : LayerConfig?
[Get][Set]
Optional configuration for the panel's layer. Setting this to non-null will enable Layers.
Signature
open var layerConfig: LayerConfig?
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 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 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 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 var pivotOffsetWidth: Float
radiusForCylinderOrSphere : Float
[Get][Set]
The radius of the panel in meters if PanelShapeType is set to Cylinder or Equirect.
Signature
open var radiusForCylinderOrSphere: Float
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 var sceneMeshCreator: PanelShapeConfig.(texture: SceneTexture) -> SceneMesh?
stereoMode : StereoMode
[Get][Set]
The StereoMode to use for the panel.
Signature
open var stereoMode: StereoMode
unlit : Boolean
[Get][Set]
If true, the panel will ignore scene lighting.
Signature
open 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 var width: Float

Functions

generateSceneMeshCreator ()
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

MAX_RADIUS : Float
[Get]
Maximum radius value for cylindrical and spherical panels
Signature
const val MAX_RADIUS: Float = 100.0f
Did you find this page helpful?