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 ¶
- type Advanced
- type Any
- type Extension
- type Filter
- type ID
- type Instance
- func (self Instance) AlphaBlend() bool
- func (self Instance) AndroidSurfaceSize() Vector2i.XY
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsOpenXRCompositionLayer() Instance
- func (self Instance) EnableHolePunch() bool
- func (self Instance) GetAndroidSurface() JavaObject.Instance
- func (self Instance) ID() ID
- func (self Instance) IntersectsRay(origin Vector3.XYZ, direction Vector3.XYZ) Vector2.XY
- func (self Instance) IsNativelySupported() bool
- func (self Instance) LayerViewport() SubViewport.Instance
- func (self Instance) SetAlphaBlend(value bool)
- func (self Instance) SetAndroidSurfaceSize(value Vector2i.XY)
- func (self Instance) SetEnableHolePunch(value bool)
- func (self Instance) SetLayerViewport(value SubViewport.Instance)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetSortOrder(value int)
- func (self Instance) SetSwapchainStateAlphaSwizzle(value Swizzle)
- func (self Instance) SetSwapchainStateBlueSwizzle(value Swizzle)
- func (self Instance) SetSwapchainStateBorderColor(value Color.RGBA)
- func (self Instance) SetSwapchainStateGreenSwizzle(value Swizzle)
- func (self Instance) SetSwapchainStateHorizontalWrap(value Wrap)
- func (self Instance) SetSwapchainStateMagFilter(value Filter)
- func (self Instance) SetSwapchainStateMaxAnisotropy(value Float.X)
- func (self Instance) SetSwapchainStateMinFilter(value Filter)
- func (self Instance) SetSwapchainStateMipmapMode(value MipmapMode)
- func (self Instance) SetSwapchainStateRedSwizzle(value Swizzle)
- func (self Instance) SetSwapchainStateVerticalWrap(value Wrap)
- func (self Instance) SetUseAndroidSurface(value bool)
- func (self Instance) SortOrder() int
- func (self Instance) SwapchainStateAlphaSwizzle() Swizzle
- func (self Instance) SwapchainStateBlueSwizzle() Swizzle
- func (self Instance) SwapchainStateBorderColor() Color.RGBA
- func (self Instance) SwapchainStateGreenSwizzle() Swizzle
- func (self Instance) SwapchainStateHorizontalWrap() Wrap
- func (self Instance) SwapchainStateMagFilter() Filter
- func (self Instance) SwapchainStateMaxAnisotropy() Float.X
- func (self Instance) SwapchainStateMinFilter() Filter
- func (self Instance) SwapchainStateMipmapMode() MipmapMode
- func (self Instance) SwapchainStateRedSwizzle() Swizzle
- func (self Instance) SwapchainStateVerticalWrap() Wrap
- func (self Instance) UseAndroidSurface() bool
- func (self Instance) Virtual(name string) reflect.Value
- type MipmapMode
- type Swizzle
- type Wrap
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 Extension ¶
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]) AsOpenXRCompositionLayer ¶
type 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.
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 (Instance) AlphaBlend ¶
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 ¶
The size of the Android surface to create if UseAndroidSurface is enabled.
func (Instance) AsOpenXRCompositionLayer ¶
func (Instance) EnableHolePunch ¶
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) IntersectsRay ¶
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 ¶
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 ¶
SetAlphaBlend sets the property returned by [GetAlphaBlend].
func (Instance) SetAndroidSurfaceSize ¶
SetAndroidSurfaceSize sets the property returned by [GetAndroidSurfaceSize].
func (Instance) SetEnableHolePunch ¶
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) SetSortOrder ¶
SetSortOrder sets the property returned by [GetSortOrder].
func (Instance) SetSwapchainStateAlphaSwizzle ¶
SetSwapchainStateAlphaSwizzle sets the property returned by [GetAlphaSwizzle].
func (Instance) SetSwapchainStateBlueSwizzle ¶
SetSwapchainStateBlueSwizzle sets the property returned by [GetBlueSwizzle].
func (Instance) SetSwapchainStateBorderColor ¶
SetSwapchainStateBorderColor sets the property returned by [GetBorderColor].
func (Instance) SetSwapchainStateGreenSwizzle ¶
SetSwapchainStateGreenSwizzle sets the property returned by [GetGreenSwizzle].
func (Instance) SetSwapchainStateHorizontalWrap ¶
SetSwapchainStateHorizontalWrap sets the property returned by [GetHorizontalWrap].
func (Instance) SetSwapchainStateMagFilter ¶
SetSwapchainStateMagFilter sets the property returned by [GetMagFilter].
func (Instance) SetSwapchainStateMaxAnisotropy ¶
SetSwapchainStateMaxAnisotropy sets the property returned by [GetMaxAnisotropy].
func (Instance) SetSwapchainStateMinFilter ¶
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 ¶
SetSwapchainStateRedSwizzle sets the property returned by [GetRedSwizzle].
func (Instance) SetSwapchainStateVerticalWrap ¶
SetSwapchainStateVerticalWrap sets the property returned by [GetVerticalWrap].
func (Instance) SetUseAndroidSurface ¶
SetUseAndroidSurface sets the property returned by [GetUseAndroidSurface].
func (Instance) SortOrder ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.
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 )