Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,11 @@
<constant name="PLANE_SEMANTIC_LABEL_TABLE" value="5" enum="PlaneSemanticLabel">
Plane represents the surface of a table.
</constant>
<constant name="PLANE_SEMANTIC_LABEL_DOOR" value="6" enum="PlaneSemanticLabel">
Plane represents a door.
</constant>
<constant name="PLANE_SEMANTIC_LABEL_WINDOW" value="7" enum="PlaneSemanticLabel">
Plane represents a windows.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Plane represents a windows.
Plane represents a window.

</constant>
</constants>
</class>
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ XrSpatialCapabilityConfigurationBaseHeaderEXT *OpenXRSpatialCapabilityConfigurat
plane_enabled_components.push_back(XR_SPATIAL_COMPONENT_TYPE_POLYGON_2D_EXT);
}
if (get_supports_labels()) {
plane_enabled_components.push_back(XR_SPATIAL_COMPONENT_TYPE_PLANE_SEMANTIC_LABEL_EXT);
if (capability->is_semantics_label2_supported()) {
plane_enabled_components.push_back(XR_SPATIAL_COMPONENT_TYPE_PLANE_SEMANTIC_LABEL2_EXT);
} else {
plane_enabled_components.push_back(XR_SPATIAL_COMPONENT_TYPE_PLANE_SEMANTIC_LABEL_EXT);
}
}

// Set up our enabled components.
Expand Down Expand Up @@ -124,7 +128,10 @@ bool OpenXRSpatialCapabilityConfigurationPlaneTracking::get_supports_labels() {
OpenXRSpatialEntityExtension *se_extension = OpenXRSpatialEntityExtension::get_singleton();
ERR_FAIL_NULL_V(se_extension, false);

supports_labels = se_extension->supports_component_type(XR_SPATIAL_CAPABILITY_PLANE_TRACKING_EXT, XR_SPATIAL_COMPONENT_TYPE_PLANE_SEMANTIC_LABEL_EXT) ? 1 : 0;
OpenXRSpatialPlaneTrackingCapability *capability = OpenXRSpatialPlaneTrackingCapability::get_singleton();
ERR_FAIL_NULL_V(capability, false);

supports_labels = se_extension->supports_component_type(XR_SPATIAL_CAPABILITY_PLANE_TRACKING_EXT, capability->is_semantics_label2_supported() ? XR_SPATIAL_COMPONENT_TYPE_PLANE_SEMANTIC_LABEL2_EXT : XR_SPATIAL_COMPONENT_TYPE_PLANE_SEMANTIC_LABEL_EXT) ? 1 : 0;
}

return supports_labels == 1;
Expand Down Expand Up @@ -245,6 +252,8 @@ void OpenXRSpatialComponentPlaneSemanticLabelList::_bind_methods() {
BIND_ENUM_CONSTANT(PLANE_SEMANTIC_LABEL_WALL);
BIND_ENUM_CONSTANT(PLANE_SEMANTIC_LABEL_CEILING);
BIND_ENUM_CONSTANT(PLANE_SEMANTIC_LABEL_TABLE);
BIND_ENUM_CONSTANT(PLANE_SEMANTIC_LABEL_DOOR);
BIND_ENUM_CONSTANT(PLANE_SEMANTIC_LABEL_WINDOW);
}

void OpenXRSpatialComponentPlaneSemanticLabelList::set_capacity(uint32_t p_capacity) {
Expand All @@ -255,16 +264,32 @@ void OpenXRSpatialComponentPlaneSemanticLabelList::set_capacity(uint32_t p_capac
}

XrSpatialComponentTypeEXT OpenXRSpatialComponentPlaneSemanticLabelList::get_component_type() const {
return XR_SPATIAL_COMPONENT_TYPE_PLANE_SEMANTIC_LABEL_EXT;
OpenXRSpatialPlaneTrackingCapability *capability = OpenXRSpatialPlaneTrackingCapability::get_singleton();
ERR_FAIL_NULL_V(capability, XR_SPATIAL_COMPONENT_TYPE_MAX_ENUM_EXT);

if (capability->is_semantics_label2_supported()) {
return XR_SPATIAL_COMPONENT_TYPE_PLANE_SEMANTIC_LABEL2_EXT;
} else {
return XR_SPATIAL_COMPONENT_TYPE_PLANE_SEMANTIC_LABEL_EXT;
}
}

void *OpenXRSpatialComponentPlaneSemanticLabelList::get_structure_data(void *p_next) {
OpenXRSpatialPlaneTrackingCapability *capability = OpenXRSpatialPlaneTrackingCapability::get_singleton();
ERR_FAIL_NULL_V(capability, nullptr);

if (capability->is_semantics_label2_supported()) {
plane_semantic_label_list.type = XR_TYPE_SPATIAL_COMPONENT_PLANE_SEMANTIC_LABEL2_LIST_EXT;
} else {
plane_semantic_label_list.type = XR_TYPE_SPATIAL_COMPONENT_PLANE_SEMANTIC_LABEL_LIST_EXT;
}

plane_semantic_label_list.next = p_next;
return &plane_semantic_label_list;
}

XrSpatialPlaneSemanticLabelEXT OpenXRSpatialComponentPlaneSemanticLabelList::get_plane_semantic_label(int64_t p_index) const {
ERR_FAIL_INDEX_V(p_index, plane_semantic_label_data.size(), XR_SPATIAL_PLANE_SEMANTIC_LABEL_MAX_ENUM_EXT);
XrSpatialPlaneSemanticLabel2EXT OpenXRSpatialComponentPlaneSemanticLabelList::get_plane_semantic_label(int64_t p_index) const {
ERR_FAIL_INDEX_V(p_index, plane_semantic_label_data.size(), XR_SPATIAL_PLANE_SEMANTIC_LABEL_2EXT_MAX_ENUM_EXT);

return plane_semantic_label_data[p_index];
}
Expand Down Expand Up @@ -632,6 +657,7 @@ HashMap<String, bool *> OpenXRSpatialPlaneTrackingCapability::get_requested_exte

if (GLOBAL_GET_CACHED(bool, "xr/openxr/extensions/spatial_entity/enabled") && GLOBAL_GET_CACHED(bool, "xr/openxr/extensions/spatial_entity/enable_plane_tracking")) {
request_extensions[XR_EXT_SPATIAL_PLANE_TRACKING_EXTENSION_NAME] = &spatial_plane_tracking_ext;
request_extensions[XR_EXT_SPATIAL_PLANE_SEMANTIC_LABEL2_EXTENSION_NAME] = &spatial_plane_semantics_label2_supported;
}

return request_extensions;
Expand Down Expand Up @@ -754,6 +780,10 @@ bool OpenXRSpatialPlaneTrackingCapability::is_supported() {
return spatial_plane_tracking_supported;
}

bool OpenXRSpatialPlaneTrackingCapability::is_semantics_label2_supported() {
return spatial_plane_tracking_supported && spatial_plane_semantics_label2_supported;
}

bool OpenXRSpatialPlaneTrackingCapability::start_built_in_tracking() {
ERR_FAIL_COND_V(builtin_tracking_state > 0, false);

Expand Down Expand Up @@ -991,21 +1021,27 @@ void OpenXRSpatialPlaneTrackingCapability::_process_snapshot(RID p_snapshot, RID

if (label_list.is_valid()) {
switch (label_list->get_plane_semantic_label(i)) {
case XR_SPATIAL_PLANE_SEMANTIC_LABEL_UNCATEGORIZED_EXT: {
case XR_SPATIAL_PLANE_SEMANTIC_LABEL2_UNCATEGORIZED_EXT: {
plane_tracker->set_plane_label("Uncategorized plane");
} break;
case XR_SPATIAL_PLANE_SEMANTIC_LABEL_FLOOR_EXT: {
case XR_SPATIAL_PLANE_SEMANTIC_LABEL2_FLOOR_EXT: {
plane_tracker->set_plane_label("Floor plane");
} break;
case XR_SPATIAL_PLANE_SEMANTIC_LABEL_WALL_EXT: {
case XR_SPATIAL_PLANE_SEMANTIC_LABEL2_WALL_EXT: {
plane_tracker->set_plane_label("Wall plane");
} break;
case XR_SPATIAL_PLANE_SEMANTIC_LABEL_CEILING_EXT: {
case XR_SPATIAL_PLANE_SEMANTIC_LABEL2_CEILING_EXT: {
plane_tracker->set_plane_label("Ceiling plane");
} break;
case XR_SPATIAL_PLANE_SEMANTIC_LABEL_TABLE_EXT: {
case XR_SPATIAL_PLANE_SEMANTIC_LABEL2_TABLE_EXT: {
plane_tracker->set_plane_label("Table plane");
} break;
case XR_SPATIAL_PLANE_SEMANTIC_LABEL2_DOOR_EXT: {
plane_tracker->set_plane_label("Door plane");
} break;
case XR_SPATIAL_PLANE_SEMANTIC_LABEL2_WINDOW_EXT: {
plane_tracker->set_plane_label("Window plane");
} break;
default: {
plane_tracker->set_plane_label("Unknown plane");
} break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,26 +125,30 @@ class OpenXRSpatialComponentPlaneSemanticLabelList : public OpenXRSpatialCompone

public:
enum PlaneSemanticLabel {
PLANE_SEMANTIC_LABEL_UNCATEGORIZED = XR_SPATIAL_PLANE_SEMANTIC_LABEL_UNCATEGORIZED_EXT,
PLANE_SEMANTIC_LABEL_FLOOR = XR_SPATIAL_PLANE_SEMANTIC_LABEL_FLOOR_EXT,
PLANE_SEMANTIC_LABEL_WALL = XR_SPATIAL_PLANE_SEMANTIC_LABEL_WALL_EXT,
PLANE_SEMANTIC_LABEL_CEILING = XR_SPATIAL_PLANE_SEMANTIC_LABEL_CEILING_EXT,
PLANE_SEMANTIC_LABEL_TABLE = XR_SPATIAL_PLANE_SEMANTIC_LABEL_TABLE_EXT,
// Original plane semantics overlap with plane semantics 2, so we can just use the new constants
PLANE_SEMANTIC_LABEL_UNCATEGORIZED = XR_SPATIAL_PLANE_SEMANTIC_LABEL2_UNCATEGORIZED_EXT,
PLANE_SEMANTIC_LABEL_FLOOR = XR_SPATIAL_PLANE_SEMANTIC_LABEL2_FLOOR_EXT,
PLANE_SEMANTIC_LABEL_WALL = XR_SPATIAL_PLANE_SEMANTIC_LABEL2_WALL_EXT,
PLANE_SEMANTIC_LABEL_CEILING = XR_SPATIAL_PLANE_SEMANTIC_LABEL2_CEILING_EXT,
PLANE_SEMANTIC_LABEL_TABLE = XR_SPATIAL_PLANE_SEMANTIC_LABEL2_TABLE_EXT,
PLANE_SEMANTIC_LABEL_DOOR = XR_SPATIAL_PLANE_SEMANTIC_LABEL2_DOOR_EXT,
PLANE_SEMANTIC_LABEL_WINDOW = XR_SPATIAL_PLANE_SEMANTIC_LABEL2_WINDOW_EXT

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PLANE_SEMANTIC_LABEL_WINDOW = XR_SPATIAL_PLANE_SEMANTIC_LABEL2_WINDOW_EXT
PLANE_SEMANTIC_LABEL_WINDOW = XR_SPATIAL_PLANE_SEMANTIC_LABEL2_WINDOW_EXT,

};

virtual void set_capacity(uint32_t p_capacity) override;
virtual XrSpatialComponentTypeEXT get_component_type() const override;
virtual void *get_structure_data(void *p_next) override;

XrSpatialPlaneSemanticLabelEXT get_plane_semantic_label(int64_t p_index) const;
XrSpatialPlaneSemanticLabel2EXT get_plane_semantic_label(int64_t p_index) const;

protected:
static void _bind_methods();

private:
Vector<XrSpatialPlaneSemanticLabelEXT> plane_semantic_label_data;
Vector<XrSpatialPlaneSemanticLabel2EXT> plane_semantic_label_data;

XrSpatialComponentPlaneSemanticLabelListEXT plane_semantic_label_list = { XR_TYPE_SPATIAL_COMPONENT_PLANE_SEMANTIC_LABEL_LIST_EXT, nullptr, 0, nullptr };
// XrSpatialComponentPlaneSemanticLabelListEXT and XrSpatialComponentPlaneSemanticLabel2ListEXT are binary compatible, just have different type.
XrSpatialComponentPlaneSemanticLabel2ListEXT plane_semantic_label_list = { XR_TYPE_SPATIAL_COMPONENT_PLANE_SEMANTIC_LABEL_LIST_EXT, nullptr, 0, nullptr };

PlaneSemanticLabel _get_plane_semantic_label(int64_t p_index) const;
};
Expand Down Expand Up @@ -249,6 +253,7 @@ class OpenXRSpatialPlaneTrackingCapability : public OpenXRExtensionWrapper {
Ref<OpenXRFutureResult> start_entity_discovery(RID p_spatial_context, TypedArray<OpenXRSpatialComponentData> p_component_data, Ref<OpenXRStructureBase> p_next_snapshot_create = nullptr, Ref<OpenXRStructureBase> p_next_snapshot_query = nullptr, const Callable &p_user_callback = Callable());

bool is_supported();
bool is_semantics_label2_supported();

OpenXRSpatialEntityExtension::TrackingState get_built_in_tracking_state() { return builtin_tracking_state; }
bool start_built_in_tracking();
Expand All @@ -258,6 +263,7 @@ class OpenXRSpatialPlaneTrackingCapability : public OpenXRExtensionWrapper {
static OpenXRSpatialPlaneTrackingCapability *singleton;
bool spatial_plane_tracking_ext = false;
bool spatial_plane_tracking_supported = false;
bool spatial_plane_semantics_label2_supported = false;

OpenXRSpatialEntityExtension::TrackingState builtin_tracking_state = OpenXRSpatialEntityExtension::TrackingState::TRACKING_NOT_ACTIVE;
Ref<OpenXRFutureResult> built_in_future;
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ Files extracted from upstream source:
## openxr

- Upstream: https://github.com/KhronosGroup/OpenXR-SDK
- Version: 1.1.63 (f2448a8797c85814aa892efc1ab8707900fbcc78, 2026)
- Version: 1.1.65 (24a1f2b92d212501a2b1b8d30ffd53abf55fcfa8, 2026)
- License: Apache 2.0

Files extracted from upstream source:
Expand Down
Loading
Loading