OpenXRCompositionLayer

package
v0.0.0-...-357ca8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Composition layers allow 2D viewports to be displayed inside of the headset by the XR compositor through special projections that retain their quality. This allows for rendering clear text while keeping the layer at a native resolution.

Note: If the OpenXR runtime doesn't support the given composition layer type, a fallback mesh can be generated with a ViewportTexture, in order to emulate the composition layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsOpenXRCompositionLayer() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsNode3D

func (self *Extension[T]) AsNode3D() Node3D.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsOpenXRCompositionLayer

func (self *Extension[T]) AsOpenXRCompositionLayer() Instance

type Filter

type Filter int //gd:OpenXRCompositionLayer.Filter
const (
	// Perform nearest-neighbor filtering when sampling the texture.
	FilterNearest Filter = 0
	// Perform linear filtering when sampling the texture.
	FilterLinear Filter = 1
	// Perform cubic filtering when sampling the texture.
	FilterCubic Filter = 2
)

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.OpenXRCompositionLayer

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AlphaBlend

func (self Instance) AlphaBlend() bool

Enables the blending the layer using its alpha channel.

Can be combined with Viewport.TransparentBg to give the layer a transparent background.

func (Instance) AndroidSurfaceSize

func (self Instance) AndroidSurfaceSize() Vector2i.XY

The size of the Android surface to create if UseAndroidSurface is enabled.

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsNode3D

func (self Instance) AsNode3D() Node3D.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsOpenXRCompositionLayer

func (self Instance) AsOpenXRCompositionLayer() Instance

func (Instance) EnableHolePunch

func (self Instance) EnableHolePunch() bool

Enables a technique called "hole punching", which allows putting the composition layer behind the main projection layer (i.e. setting SortOrder to a negative value) while "punching a hole" through everything rendered by Godot so that the layer is still visible.

This can be used to create the illusion that the composition layer exists in the same 3D space as everything rendered by Godot, allowing objects to appear to pass both behind or in front of the composition layer.

func (Instance) GetAndroidSurface

func (self Instance) GetAndroidSurface() JavaObject.Instance

Returns a JavaObject representing an android.view.Surface if UseAndroidSurface is enabled and OpenXR has created the surface. Otherwise, this will return null.

Note: The surface can only be created during an active OpenXR session. So, if UseAndroidSurface is enabled outside of an OpenXR session, it won't be created until a new session fully starts.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IntersectsRay

func (self Instance) IntersectsRay(origin Vector3.XYZ, direction Vector3.XYZ) Vector2.XY

Returns UV coordinates where the given ray intersects with the composition layer. 'origin' and 'direction' must be in global space.

Returns Vector2(-1.0, -1.0) if the ray doesn't intersect.

func (Instance) IsNativelySupported

func (self Instance) IsNativelySupported() bool

Returns true if the OpenXR runtime natively supports this composition layer type.

Note: This will only return an accurate result after the OpenXR session has started.

func (Instance) LayerViewport

func (self Instance) LayerViewport() SubViewport.Instance

The SubViewport to render on the composition layer.

func (Instance) SetAlphaBlend

func (self Instance) SetAlphaBlend(value bool)

SetAlphaBlend sets the property returned by [GetAlphaBlend].

func (Instance) SetAndroidSurfaceSize

func (self Instance) SetAndroidSurfaceSize(value Vector2i.XY)

SetAndroidSurfaceSize sets the property returned by [GetAndroidSurfaceSize].

func (Instance) SetEnableHolePunch

func (self Instance) SetEnableHolePunch(value bool)

SetEnableHolePunch sets the property returned by [GetEnableHolePunch].

func (Instance) SetLayerViewport

func (self Instance) SetLayerViewport(value SubViewport.Instance)

SetLayerViewport sets the property returned by [GetLayerViewport].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetSortOrder

func (self Instance) SetSortOrder(value int)

SetSortOrder sets the property returned by [GetSortOrder].

func (Instance) SetSwapchainStateAlphaSwizzle

func (self Instance) SetSwapchainStateAlphaSwizzle(value Swizzle)

SetSwapchainStateAlphaSwizzle sets the property returned by [GetAlphaSwizzle].

func (Instance) SetSwapchainStateBlueSwizzle

func (self Instance) SetSwapchainStateBlueSwizzle(value Swizzle)

SetSwapchainStateBlueSwizzle sets the property returned by [GetBlueSwizzle].

func (Instance) SetSwapchainStateBorderColor

func (self Instance) SetSwapchainStateBorderColor(value Color.RGBA)

SetSwapchainStateBorderColor sets the property returned by [GetBorderColor].

func (Instance) SetSwapchainStateGreenSwizzle

func (self Instance) SetSwapchainStateGreenSwizzle(value Swizzle)

SetSwapchainStateGreenSwizzle sets the property returned by [GetGreenSwizzle].

func (Instance) SetSwapchainStateHorizontalWrap

func (self Instance) SetSwapchainStateHorizontalWrap(value Wrap)

SetSwapchainStateHorizontalWrap sets the property returned by [GetHorizontalWrap].

func (Instance) SetSwapchainStateMagFilter

func (self Instance) SetSwapchainStateMagFilter(value Filter)

SetSwapchainStateMagFilter sets the property returned by [GetMagFilter].

func (Instance) SetSwapchainStateMaxAnisotropy

func (self Instance) SetSwapchainStateMaxAnisotropy(value Float.X)

SetSwapchainStateMaxAnisotropy sets the property returned by [GetMaxAnisotropy].

func (Instance) SetSwapchainStateMinFilter

func (self Instance) SetSwapchainStateMinFilter(value Filter)

SetSwapchainStateMinFilter sets the property returned by [GetMinFilter].

func (Instance) SetSwapchainStateMipmapMode

func (self Instance) SetSwapchainStateMipmapMode(value MipmapMode)

SetSwapchainStateMipmapMode sets the property returned by [GetMipmapMode].

func (Instance) SetSwapchainStateRedSwizzle

func (self Instance) SetSwapchainStateRedSwizzle(value Swizzle)

SetSwapchainStateRedSwizzle sets the property returned by [GetRedSwizzle].

func (Instance) SetSwapchainStateVerticalWrap

func (self Instance) SetSwapchainStateVerticalWrap(value Wrap)

SetSwapchainStateVerticalWrap sets the property returned by [GetVerticalWrap].

func (Instance) SetUseAndroidSurface

func (self Instance) SetUseAndroidSurface(value bool)

SetUseAndroidSurface sets the property returned by [GetUseAndroidSurface].

func (Instance) SortOrder

func (self Instance) SortOrder() int

The sort order for this composition layer. Higher numbers will be shown in front of lower numbers.

Note: This will have no effect if a fallback mesh is being used.

func (Instance) SwapchainStateAlphaSwizzle

func (self Instance) SwapchainStateAlphaSwizzle() Swizzle

The swizzle value for the alpha channel of the swapchain state.

Note: This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.

func (Instance) SwapchainStateBlueSwizzle

func (self Instance) SwapchainStateBlueSwizzle() Swizzle

The swizzle value for the blue channel of the swapchain state.

Note: This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.

func (Instance) SwapchainStateBorderColor

func (self Instance) SwapchainStateBorderColor() Color.RGBA

The border color of the swapchain state that is used when the wrap mode clamps to the border.

Note: This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.

func (Instance) SwapchainStateGreenSwizzle

func (self Instance) SwapchainStateGreenSwizzle() Swizzle

The swizzle value for the green channel of the swapchain state.

Note: This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.

func (Instance) SwapchainStateHorizontalWrap

func (self Instance) SwapchainStateHorizontalWrap() Wrap

The horizontal wrap mode of the swapchain state.

Note: This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.

func (Instance) SwapchainStateMagFilter

func (self Instance) SwapchainStateMagFilter() Filter

The magnification filter of the swapchain state.

Note: This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.

func (Instance) SwapchainStateMaxAnisotropy

func (self Instance) SwapchainStateMaxAnisotropy() Float.X

The max anisotropy of the swapchain state.

Note: This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.

func (Instance) SwapchainStateMinFilter

func (self Instance) SwapchainStateMinFilter() Filter

The minification filter of the swapchain state.

Note: This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.

func (Instance) SwapchainStateMipmapMode

func (self Instance) SwapchainStateMipmapMode() MipmapMode

The mipmap mode of the swapchain state.

Note: This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.

func (Instance) SwapchainStateRedSwizzle

func (self Instance) SwapchainStateRedSwizzle() Swizzle

The swizzle value for the red channel of the swapchain state.

Note: This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.

func (Instance) SwapchainStateVerticalWrap

func (self Instance) SwapchainStateVerticalWrap() Wrap

The vertical wrap mode of the swapchain state.

Note: This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.

func (Instance) UseAndroidSurface

func (self Instance) UseAndroidSurface() bool

If enabled, an Android surface will be created (with the dimensions from AndroidSurfaceSize) which will provide the 2D content for the composition layer, rather than using LayerViewport.

See GetAndroidSurface for information about how to get the surface so that your application can draw to it.

Note: This will only work in Android builds.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type MipmapMode

type MipmapMode int //gd:OpenXRCompositionLayer.MipmapMode
const (
	// Disable mipmapping.
	//
	// Note: Mipmapping can only be disabled in the Compatibility renderer.
	MipmapModeDisabled MipmapMode = 0
	// Use the mipmap of the nearest resolution.
	MipmapModeNearest MipmapMode = 1
	// Use linear interpolation of the two mipmaps of the nearest resolution.
	MipmapModeLinear MipmapMode = 2
)

type Swizzle

type Swizzle int //gd:OpenXRCompositionLayer.Swizzle
const (
	// Maps a color channel to the value of the red channel.
	SwizzleRed Swizzle = 0
	// Maps a color channel to the value of the green channel.
	SwizzleGreen Swizzle = 1
	// Maps a color channel to the value of the blue channel.
	SwizzleBlue Swizzle = 2
	// Maps a color channel to the value of the alpha channel.
	SwizzleAlpha Swizzle = 3
	// Maps a color channel to the value of zero.
	SwizzleZero Swizzle = 4
	// Maps a color channel to the value of one.
	SwizzleOne Swizzle = 5
)

type Wrap

type Wrap int //gd:OpenXRCompositionLayer.Wrap
const (
	// Clamp the texture to its specified border color.
	WrapClampToBorder Wrap = 0
	// Clamp the texture to its edge color.
	WrapClampToEdge Wrap = 1
	// Repeat the texture infinitely.
	WrapRepeat Wrap = 2
	// Repeat the texture infinitely, mirroring it on each repeat.
	WrapMirroredRepeat Wrap = 3
	// Mirror the texture once and then clamp the texture to its edge color.
	//
	// Note: This wrap mode is not available in the Compatibility renderer.
	WrapMirrorClampToEdge Wrap = 4
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL