XR_ANDROID_spatial_component_subsumed_by

Name String

XR_ANDROID_spatial_component_subsumed_by

Erweiterungstyp

Instanzerweiterung

Registrierte Erweiterungsnummer

792

Version

1

Ratifizierungsstatus

Nicht ratifiziert

Abhängigkeiten von Erweiterungen und Versionen

XR_EXT_spatial_entity
und
XR_EXT_spatial_plane_tracking

Datum der letzten Änderung

2025-08-19

IP-Status

Keine bekannten IP-Ansprüche.

Mitwirkende

Brian Chen, Google
Kyle Chen, Google
Levana Chen, Google
Nihav Jain, Google
Spencer Quin, Google

Übersicht

Diese Erweiterung basiert auf XR_EXT_spatial_entity und bietet eine neue Komponente für XR_SPATIAL_CAPABILITY_PLANE_TRACKING_EXT, um die XrSpatialEntityIdEXT verfügbar zu machen, die die aktuelle Entität subsumiert.

Wenn die Laufzeit genügend Umgebungsinformationen erfasst hat, um zu erkennen, dass zwei verfolgte Ebenen identisch sind, wird die Komponente XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID mit der ID einer der Ebenen an die andere angehängt. Ab diesem Zeitpunkt muss die Anwendung nur noch die Entität verarbeiten, die nicht die Komponente XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID hat.

Diese Erweiterung führt auch einen neuen Filter ein, den die Anwendung anhängen an XrSpatialDiscoverySnapshotCreateInfoEXT kann, um alle Entitäten herauszufiltern, die die Komponente XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID haben.

Berechtigungen

Android-Anwendungen müssen die Berechtigung android.permission.SCENE_UNDERSTANDING_COARSE in ihrem Manifest auflisten, da diese Erweiterung Ebenen in der Umgebung verfolgt. Die Berechtigung android.permission.SCENE_UNDERSTANDING_COARSE gilt als gefährliche Berechtigung.

(Schutzebene: gefährlich)

Laufzeitunterstützung

Wenn die Laufzeit eine Ebene in eine andere subsumieren kann, muss sie dies angeben, indem sie XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID als unterstützte Komponente für die Funktion XR_SPATIAL_CAPABILITY_PLANE_TRACKING_EXT in xrEnumerateSpatialCapabilityComponentTypesEXT auflistet .

Alle Komponentendaten der angehängten Entität XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID müssen mit der Entität identisch sein, die sie subsumiert.

Subsumierte Komponente

Komponentendaten

XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID verwendet die Struktur XrSpatialEntityIdEXT für ihre Daten, die die ID der subsumierenden Entität darstellt.

Struktur der Komponentenliste zum Abfragen von Daten

Die Struktur XrSpatialComponentSubsumedByListANDROID ist so definiert:

typedef struct XrSpatialComponentSubsumedByListANDROID {
    XrStructureType          type;
    void*                    next;
    uint32_t                 subsumedUniqueIdCount;
    XrSpatialEntityIdEXT*    subsumedUniqueIds;
} XrSpatialComponentSubsumedByListANDROID;

Mitgliederbeschreibungen

  • type ist der XrStructureType dieser Struktur.
  • next ist NULL oder ein Zeiger auf die nächste Struktur in einer Strukturkette.
  • subsumedUniqueIdCount ist ein uint32_t, das die Anzahl der Elemente im Array subsumedUniqueIds beschreibt.
  • subsumedUniqueIds ist ein Array von XrSpatialEntityIdEXT .

Die Anwendung kann die Komponente XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID der räumlichen Entitäten in einem XrSpatialSnapshotEXT abfragen, indem sie XR_TYPE_SPATIAL_COMPONENT_SUBSUMED_BY_LIST_ANDROID zur nächsten Kette von XrSpatialComponentDataQueryResultEXT hinzufügt .

Die Laufzeit muss XR_ERROR_VALIDATION_FAILURE von xrQuerySpatialComponentDataEXT zurückgeben, wenn XR_TYPE_SPATIAL_COMPONENT_SUBSUMED_BY_LIST_ANDROID in der nächsten Kette von XrSpatialComponentDataQueryResultEXT :: next enthalten ist, aber XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID nicht in XrSpatialComponentDataQueryConditionEXT :: componentTypes enthalten ist .

Die Laufzeit muss XR_ERROR_SIZE_INSUFFICIENT von xrQuerySpatialComponentDataEXT zurückgeben, wenn subsumedUniqueIdCount kleiner als XrSpatialComponentDataQueryResultEXT :: entityIdCountOutput ist .

Gültige Verwendung (implizit)

  • Die Erweiterung XR_ANDROID_spatial_component_subsumed_by muss aktiviert sein, bevor XrSpatialComponentSubsumedByListANDROID verwendet wird.
  • type muss sein XR_TYPE_SPATIAL_COMPONENT_SUBSUMED_BY_LIST_ANDROID
  • next muss NULL oder ein gültiger Zeiger auf die nächste Struktur in einer Strukturkette sein.
  • subsumedUniqueIds muss ein Zeiger auf ein Array von subsumedUniqueIdCount XrSpatialEntityIdEXT Werten sein.
  • Der Parameter subsumedUniqueIdCount muss größer als 0 sein.

Konfiguration

Wenn XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID in XrSpatialCapabilityComponentTypesEXT :: componentTypes für die Funktion XR_SPATIAL_CAPABILITY_PLANE_TRACKING_EXT aufgelistet ist, kann die Anwendung sie aktivieren, indem sie die Enumeration in die Liste XrSpatialCapabilityConfigurationBaseHeaderEXT :: enabledComponents der von XrSpatialCapabilityConfigurationBaseHeaderEXT abgeleiteten Struktur der Funktion aufnimmt, die diese Komponente unterstützt.

Subsumierte Entitäten filtern

Die Struktur XrSpatialDiscoveryUniqueEntitiesFilterANDROID ist so definiert:

typedef struct XrSpatialDiscoveryUniqueEntitiesFilterANDROID {
    XrStructureType    type;
    const void*        next;
} XrSpatialDiscoveryUniqueEntitiesFilterANDROID;

Mitgliederbeschreibungen

  • type ist der XrStructureType dieser Struktur.
  • next ist NULL oder ein Zeiger auf die nächste Struktur in einer Strukturkette.

Die Anwendung kann XrSpatialDiscoveryUniqueEntitiesFilterANDROID in die next-Kette von XrSpatialDiscoverySnapshotCreateInfoEXT aufnehmen, um einen Snapshot mit Entitäten zu erhalten, die nicht von einer anderen Entität subsumiert werden.

Wenn Anwendungen XrSpatialDiscoveryUniqueEntitiesFilterANDROID an XrSpatialDiscoverySnapshotCreateInfoEXT anhängen und gleichzeitig die Komponente XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID in XrSpatialDiscoverySnapshotCreateInfoEXT :: componentTypes aufnehmen , muss die Laufzeit XR_ERROR_VALIDATION_FAILURE zurückgeben .

Wenn die Anwendung XrSpatialDiscoveryUniqueEntitiesFilterANDROID an XrSpatialDiscoverySnapshotCreateInfoEXT anhängt, aber keine Komponenten in XrSpatialDiscoverySnapshotCreateInfoEXT :: componentTypes auflistet, muss die Laufzeit alle räumlichen Entitäten in den Snapshot aufnehmen, die die Gruppe von Komponenten haben, die in XrSpatialCapabilityConfigurationBaseHeaderEXT :: enabledComponents für die für spatialContext konfigurierten Funktionen aufgelistet sind, mit Ausnahme von Entitäten, die die Komponente XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID haben.

Gültige Verwendung (implizit)

Beispielcode

Funktion zur Ebenenverfolgung konfigurieren

Im folgenden Beispielcode wird gezeigt, wie Sie einen räumlichen Kontext mit der Funktion XR_SPATIAL_CAPABILITY_PLANE_TRACKING_EXT erstellen, die XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID unterstützt .

// Check runtime supported capabilities
uint32_t capabilityCount = 0;
CHK_XR(xrEnumerateSpatialCapabilitiesEXT(instance, systemId, 0, &capabilityCount, nullptr));
std::vector<XrSpatialCapabilityEXT> capabilities(capabilityCount);
CHK_XR(xrEnumerateSpatialCapabilitiesEXT(instance, systemId, capabilityCount, &capabilityCount, capabilities.data()));

if (std::find(capabilities.begin(), capabilities.end(), XR_SPATIAL_CAPABILITY_PLANE_TRACKING_EXT) == capabilities.end()) {
  return;
}

// Enumerate supported components for plane tracking capability
XrSpatialCapabilityComponentTypesEXT planeComponents{
  .type = XR_TYPE_SPATIAL_CAPABILITY_COMPONENT_TYPES_EXT,
};
CHK_XR(xrEnumerateSpatialCapabilityComponentTypesEXT(instance, systemId, XR_SPATIAL_CAPABILITY_PLANE_TRACKING_EXT, &planeComponents));
std::vector<XrSpatialComponentTypeEXT> planeCapabilityComponents(planeComponents.componentTypeCountOutput);
planeComponents.componentTypeCapacityInput = planeCapabilityComponents.size();
planeComponents.componentTypes = planeCapabilityComponents.data();
CHK_XR(xrEnumerateSpatialCapabilityComponentTypesEXT(instance, systemId, XR_SPATIAL_CAPABILITY_PLANE_TRACKING_EXT, &planeComponents));

const auto supportsComponent = [&planeCapabilityComponents](XrSpatialComponentTypeEXT component) {
  return std::find(planeCapabilityComponents.begin(), planeCapabilityComponents.end(), component) != planeCapabilityComponents.end();
};


std::vector<XrSpatialComponentTypeEXT> planeTrackingComponents {
  XR_SPATIAL_COMPONENT_TYPE_BOUNDED_2D_EXT,
  XR_SPATIAL_COMPONENT_TYPE_PLANE_ALIGNMENT_EXT,
};

if (supportsComponent(XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID)) {
  planeTrackingComponents.push_back(XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID);
}

// Create capability config for plane tracking
XrSpatialCapabilityConfigurationPlaneTrackingEXT planeTrackingConfig {
  .type = XR_TYPE_SPATIAL_CAPABILITY_CONFIGURATION_PLANE_TRACKING_EXT,
  .next = nullptr,
  .capability = XR_SPATIAL_CAPABILITY_PLANE_TRACKING_EXT,
  .enabledComponentCount = (uint32_t)planeTrackingComponents.size(),
  .enabledComponents = planeTrackingComponents.data(),
};

// Create spatial context
std::vector<const XrSpatialCapabilityConfigurationBaseHeaderEXT*> capabilityConfigs;
capabilityConfigs.push_back(reinterpret_cast<const XrSpatialCapabilityConfigurationBaseHeaderEXT*>(&planeTrackingConfig));

XrSpatialContextCreateInfoEXT contextCreateInfo {
  .type = XR_TYPE_SPATIAL_CONTEXT_CREATE_INFO_EXT,
  .next = nullptr,
  .capabilityConfigCount = (uint32_t)capabilityConfigs.size(),
  .capabilityConfigs = capabilityConfigs.data(),
};

CHK_XR(xrCreateSpatialContextAsyncEXT(session, &contextCreateInfo, &future))

// Completes creating spatial context
XrCreateSpatialContextCompletionEXT contextCompletion{
XR_TYPE_CREATE_SPATIAL_CONTEXT_COMPLETION_EXT};

CHK_XR(xrCreateSpatialContextCompleteEXT(session, future, &contextCompletion))

Komponentendaten abfragen

Im folgenden Beispielcode wird gezeigt, wie Sie Komponentendaten von XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID aus einem Kontext abfragen, der mit XR_SPATIAL_CAPABILITY_PLANE_TRACKING_EXT konfiguriert wurde .

// previously created
XrSpatialSnapshotEXT snapshot;

// Query subsumed_by components
std::array<XrSpatialComponentTypeEXT, 1> enabledComponents = {
  XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID
};

XrSpatialComponentDataQueryConditionEXT queryCond {
  .type = XR_TYPE_SPATIAL_COMPONENT_DATA_QUERY_CONDITION_EXT,
  .componentTypeCount = 1,
  .componentTypes     = enabledComponents.data(),
};

XrSpatialComponentDataQueryResultEXT queryResult {
  .type = XR_TYPE_SPATIAL_COMPONENT_DATA_QUERY_RESULT_EXT,
};

CHK_XR(xrQuerySpatialComponentDataEXT(
           snapshot, &queryCond, &queryResult));

// Query again with allocated memory
std::vector<XrSpatialEntityIdEXT> subsumedUniqueIds;
subsumedUniqueIds.resize(queryResult.entityIdCountOutput);
XrSpatialComponentSubsumedByListANDROID subsumedByList {
  .type = XR_TYPE_SPATIAL_COMPONENT_SUBSUMED_BY_LIST_ANDROID,
  .subsumedUniqueIdCount = static_cast<uint32_t>(subsumedUniqueIds.size()),
  .subsumedUniqueIds = subsumedUniqueIds.data(),
};

queryResult.next = &subsumedByList;
CHK_XR(xrQuerySpatialComponentDataEXT(
           snapshot, &queryCond, &queryResult));

for (uint32_t i = 0; i < queryResult.entityIdCountOutput; ++i) {
  // Plane was subsumed, remove it from processing logic
  // removeEntityFromProcessingLogic(queryResult.entityIds[i], /*replaceWith=*/ subsumedByList.subsumedUniqueIds[i]);
}

// Cleanup
xrDestroySpatialSnapshotEXT(snapshot);

Subsumierte Entitäten herausfiltern

Im folgenden Beispielcode wird gezeigt, wie Sie Entitäten mit der angehängten Komponente XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID aus einem Snapshot der Erkennung herausfiltern und die Entitäts-ID der subsumierenden Entitäten abfragen.

// Init filter
XrSpatialDiscoveryUniqueEntitiesFilterANDROID filter {
  .type = XR_TYPE_SPATIAL_DISCOVERY_UNIQUE_ENTITIES_FILTER_ANDROID,
};

// Chain filter to the snapshot create info
// WARNING: Chaining the filter while include subsumed_by component in the
// componentTypes is invalid
XrSpatialDiscoverySnapshotCreateInfoEXT discoverySnapshotCreateInfo {
  .type = XR_TYPE_SPATIAL_DISCOVERY_SNAPSHOT_CREATE_INFO_EXT,
  .next = &filter
};

XrFutureEXT future {XR_NULL_FUTURE_EXT};
CHK_XR(xrCreateSpatialDiscoverySnapshotAsyncEXT(spatialContext, &discoverySnapshotCreateInfo, &future))

waitUntilReady(future);

// Complete async operation.
XrCreateSpatialDiscoverySnapshotCompletionInfoEXT
  createSnapshotCompletionInfo {
    .type   = XR_TYPE_CREATE_SPATIAL_DISCOVERY_SNAPSHOT_COMPLETION_INFO_EXT,
    .baseSpace = space,
    .time      = updateTime,
    .future    = future,
  };

XrCreateSpatialDiscoverySnapshotCompletionEXT completion {
  .type = XR_TYPE_CREATE_SPATIAL_DISCOVERY_SNAPSHOT_COMPLETION_EXT,
};

CHK_XR(xrCreateSpatialDiscoverySnapshotCompleteEXT(
           spatialContext, &createSnapshotCompletionInfo,
           &completion));

if(completion.futureResult != XR_SUCCESS) return;

// Subsumed entities has already been filtered out in this snapshot,
// now query the various components of the entities.

// Cleanup
xrDestroySpatialSnapshotEXT(completion.snapshot);

Neue Strukturen

Neue Enum-Konstanten

  • XR_ANDROID_SPATIAL_COMPONENT_SUBSUMED_BY_EXTENSION_NAME
  • XR_ANDROID_spatial_component_subsumed_by_SPEC_VERSION
  • Erweiterung von XrSpatialComponentTypeEXT :

    • XR_SPATIAL_COMPONENT_TYPE_SUBSUMED_BY_ANDROID
  • Erweiterung von XrStructureType :

    • XR_TYPE_SPATIAL_COMPONENT_SUBSUMED_BY_LIST_ANDROID
    • XR_TYPE_SPATIAL_DISCOVERY_UNIQUE_ENTITIES_FILTER_ANDROID

Probleme

Versionsverlauf

  • Version 1, 19.11.2025 (Brian Chen)

    • Erste Beschreibung der Erweiterung.