Skip to content

Commit ea9ad8d

Browse files
committed
Merge pull request #96185 from dsnopek/openxr-composition-layer-android-surface
OpenXR: Support composition layers based on Android surfaces
2 parents f8fbb86 + 3afa268 commit ea9ad8d

11 files changed

+463
-155
lines changed

modules/openxr/doc_classes/OpenXRCompositionLayer.xml

+15
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
<tutorials>
1111
</tutorials>
1212
<methods>
13+
<method name="get_android_surface">
14+
<return type="JavaObject" />
15+
<description>
16+
Returns a [JavaObject] representing an [code]android.view.Surface[/code] if [member use_android_surface] is enabled and OpenXR has created the surface. Otherwise, this will return [code]null[/code].
17+
[b]Note:[/b] The surface can only be created during an active OpenXR session. So, if [member use_android_surface] is enabled outside of an OpenXR session, it won't be created until a new session fully starts.
18+
</description>
19+
</method>
1320
<method name="intersects_ray" qualifiers="const">
1421
<return type="Vector2" />
1522
<param index="0" name="origin" type="Vector3" />
@@ -32,6 +39,9 @@
3239
Enables the blending the layer using its alpha channel.
3340
Can be combined with [member Viewport.transparent_bg] to give the layer a transparent background.
3441
</member>
42+
<member name="android_surface_size" type="Vector2i" setter="set_android_surface_size" getter="get_android_surface_size" default="Vector2i(1024, 1024)">
43+
The size of the Android surface to create if [member use_android_surface] is enabled.
44+
</member>
3545
<member name="enable_hole_punch" type="bool" setter="set_enable_hole_punch" getter="get_enable_hole_punch" default="false">
3646
Enables a technique called "hole punching", which allows putting the composition layer behind the main projection layer (i.e. setting [member sort_order] to a negative value) while "punching a hole" through everything rendered by Godot so that the layer is still visible.
3747
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.
@@ -43,5 +53,10 @@
4353
The sort order for this composition layer. Higher numbers will be shown in front of lower numbers.
4454
[b]Note:[/b] This will have no effect if a fallback mesh is being used.
4555
</member>
56+
<member name="use_android_surface" type="bool" setter="set_use_android_surface" getter="get_use_android_surface" default="false">
57+
If enabled, an Android surface will be created (with the dimensions from [member android_surface_size]) which will provide the 2D content for the composition layer, rather than using [member layer_viewport].
58+
See [method get_android_surface] for information about how to get the surface so that your application can draw to it.
59+
[b]Note:[/b] This will only work in Android builds.
60+
</member>
4661
</members>
4762
</class>

0 commit comments

Comments
 (0)