XR_EXT_spatial_object_tracking
Name String
XR_EXT_spatial_object_tracking
Erweiterungstyp
Instanzerweiterung
Registrierte Durchwahl
745
Revision
1
Ratification Status
Nicht ratifiziert
Erweiterungs- und Versionsabhängigkeiten
XR_EXT_spatial_entity
IP-Status
Keine bekannten Ansprüche auf geistiges Eigentum.
Mitwirkende
Nihav Jain, Google
Natalie Fleury, Meta
Yuichi Taguchi, Meta
Ron Bessems, Meta
Yin Li, Microsoft
Jimmy Alamparambil, ByteDance
Zhipeng Liu, ByteDance
Jun Yan, ByteDance
Andy Biar, Unity Technologies
Rebecca Nordhauser, Unity Technologies
Übersicht
Diese Erweiterung baut auf XR_EXT_spatial_entity auf und definiert eine räumliche Funktion zum Verfolgen einer Reihe vordefinierter Objekte, ohne dass ein Eingabe-Dataset aus der Anwendung erforderlich ist.
Laufzeitunterstützung
Wenn die Laufzeit die Objektverfolgung unterstützt, muss sie dies durch Aufzählen von XR_SPATIAL_CAPABILITY_OBJECT_TRACKING_EXT in xrEnumerateSpatialCapabilitiesEXT angeben.
Konfiguration
Die Struktur XrSpatialCapabilityConfigurationObjectTrackingEXT ist so definiert:
typedef struct XrSpatialCapabilityConfigurationObjectTrackingEXT {
XrStructureType type;
const void* next;
XrSpatialCapabilityEXT capability;
uint32_t enabledComponentCount;
const XrSpatialComponentTypeEXT* enabledComponents;
} XrSpatialCapabilityConfigurationObjectTrackingEXT;
Mitgliederbeschreibungen
typeist der XrStructureType dieser Struktur.nextistNULLoder ein Zeiger auf die nächste Struktur in einer Strukturkette.capabilityist ein XrSpatialCapabilityEXT und mussXR_SPATIAL_CAPABILITY_OBJECT_TRACKING_EXTsein.enabledComponentCountist einuint32_t, der die Anzahl der Elemente im ArrayenabledComponentsbeschreibt.enabledComponentsist ein Zeiger auf ein Array von XrSpatialComponentTypeEXT .
Anwendungen können die räumliche Funktion XR_SPATIAL_CAPABILITY_OBJECT_TRACKING_EXT aktivieren, indem sie einen Zeiger auf die Struktur XrSpatialCapabilityConfigurationObjectTrackingEXT in XrSpatialContextCreateInfoEXT :: capabilityConfigs hinzufügen.
Die Laufzeit muss XR_ERROR_VALIDATION_FAILURE zurückgeben, wenn capability nicht XR_SPATIAL_CAPABILITY_OBJECT_TRACKING_EXT ist.
Gültige Verwendung (implizit)
- Die Erweiterung
XR_EXT_spatial_object_trackingmuss aktiviert sein, bevor XrSpatialCapabilityConfigurationObjectTrackingEXT verwendet werden kann. -
typemussXR_TYPE_SPATIAL_CAPABILITY_CONFIGURATION_OBJECT_TRACKING_EXTsein -
nextmussNULLoder ein gültiger Zeiger auf die nächste Struktur in einer Strukturkette sein. Siehe auch: XrSpatialFeatureObjectSemanticLabelSubsetEXT -
capabilitymuss ein gültiger XrSpatialCapabilityEXT-Wert sein -
enabledComponentsmuss ein Zeiger auf ein Array mitenabledComponentCountgültigen XrSpatialComponentTypeEXT-Werten sein. - Der Parameter
enabledComponentCountmuss größer als0sein.
Garantierte Komponenten
Eine Laufzeit, die XR_SPATIAL_CAPABILITY_OBJECT_TRACKING_EXT unterstützt, muss die folgenden räumlichen Komponenten als garantierte Komponenten der von dieser Funktion erkannten Entitäten unterstützen und sie in xrEnumerateSpatialCapabilityComponentTypesEXT aufzählen:
XR_SPATIAL_COMPONENT_TYPE_BOUNDED_3D_EXT- Mindestens ein Komponententyp, der eine Reihe semantischer Labels für die erkannten Objekte bereitstellt. Eine Objekt-Tracking-Funktion ist ohne eine semantische Labelkomponente bedeutungslos. In dieser Erweiterung werden
XR_SPATIAL_COMPONENT_TYPE_OBJECT_SEMANTIC_LABEL_EXTundXR_SPATIAL_COMPONENT_TYPE_KEYBOARD_SEMANTIC_LABEL_EXTals mögliche semantische Labelkomponenten für Laufzeiten definiert, die unterstützt werden sollen. In anderen Erweiterungen können neue Komponententypen definiert werden, um verschiedene Klassen von semantischen Labels bereitzustellen, die ein verfolgtes Objekt beschreiben. Weitere Informationen zu den semantischen Labelsets und Komponententypen finden Sie unter [ext_spatial_semantic_labels_guidelines]. Laufzeiten müssen wederXR_SPATIAL_COMPONENT_TYPE_OBJECT_SEMANTIC_LABEL_EXTnochXR_SPATIAL_COMPONENT_TYPE_KEYBOARD_SEMANTIC_LABEL_EXTfür die Objektverfolgungsfunktion unterstützen, müssen aber mindestens einen Komponententyp unterstützen, der ein semantisches Label bereitstellt.
Begrenzte 3D-Komponente
Die begrenzte 3D-Komponente liefert den Mittelpunkt und die Ausdehnung des Objekts, das durch die Entität dargestellt wird, auf der sie sich befindet. Weitere Informationen finden Sie unter Begrenztes 3D.
Optionale Komponenten
Eine Laufzeit, die XR_SPATIAL_CAPABILITY_OBJECT_TRACKING_EXT unterstützt, kann zusätzlich zu den im Abschnitt Garantierte Komponenten aufgeführten Komponenten auch räumliche Komponenten unterstützen. Die Anwendung kann xrEnumerateSpatialCapabilityComponentTypesEXT verwenden, um die vollständige Liste der Komponenten abzurufen, die von einer Laufzeit unterstützt werden, und kann dann die gewünschten Komponenten beim Erstellen des räumlichen Kontexts konfigurieren.
Semantisches Label für Objekte
Komponentendaten
typedef enum XrSpatialObjectSemanticLabelEXT {
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_UNCATEGORIZED_EXT = 1,
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_SOFA_EXT = 2,
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_BED_EXT = 3,
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_CHAIR_EXT = 4,
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_TABLE_EXT = 5,
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_LAMP_EXT = 6,
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_PLANT_EXT = 7,
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_DISPLAY_SCREEN_EXT = 8,
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_WALL_ART_EXT = 9,
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_CABINET_EXT = 10,
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_MAX_ENUM_EXT = 0x7FFFFFFF
} XrSpatialObjectSemanticLabelEXT;
Die Aufzählung XrSpatialObjectSemanticLabelEXT beschreibt eine Reihe semantischer Labels für Objekte.
Bei Entitäten mit dem Label XR_SPATIAL_OBJECT_SEMANTIC_LABEL_DISPLAY_SCREEN_EXT muss die +Z-Achse der Komponente Bounded 3D ungefähr mit der Oberflächennormalen des Bildschirms übereinstimmen.
Bei Entitäten mit dem Label XR_SPATIAL_OBJECT_SEMANTIC_LABEL_WALL_ART_EXT muss die +Z-Achse der Komponente Bounded 3D mit der Oberflächennormalen der Wand übereinstimmen, an der das Kunstwerk erkannt wird.
Bei Entitäten mit dem Label XR_SPATIAL_OBJECT_SEMANTIC_LABEL_TABLE_EXT muss die +Z-Achse der Komponente Bounded 3D mit der Oberflächennormalen der Tabelle übereinstimmen.
Für alle anderen Labels in XrSpatialObjectSemanticLabelEXT darf die Anwendung keine Annahmen darüber treffen, wie die von der Bounded 3D-Komponente auf der Entität bereitgestellte XrBoxf :: center :: orientation mit den physischen Attributen dieses Objekts übereinstimmt.
Die Aufzählungswerte haben die folgenden Bedeutungen:
Enum-Beschreibung
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_UNCATEGORIZED_EXT
Die Laufzeit konnte diese Entität nicht klassifizieren.
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_SOFA_EXT
Die Entität ist ein Sofa.
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_BED_EXT
Die Entität ist ein Bett.
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_CHAIR_EXT
Die Entität ist ein Stuhl.
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_TABLE_EXT
Die Entität ist eine Tabelle.
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_LAMP_EXT
Das Element ist eine Lampe.
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_PLANT_EXT
Die Entität ist eine Pflanze.
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_DISPLAY_SCREEN_EXT
Die Entität ist ein Bildschirm, z. B. ein Monitor oder Fernseher.
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_WALL_ART_EXT
Die Entität ist ein Wandbild.
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_CABINET_EXT
Die Entität ist ein Schrank.
Komponentenlistenstruktur zum Abfragen von Daten
Die Struktur XrSpatialComponentObjectSemanticLabelListEXT ist so definiert:
typedef struct XrSpatialComponentObjectSemanticLabelListEXT {
XrStructureType type;
void* next;
uint32_t semanticLabelCount;
XrSpatialObjectSemanticLabelEXT* semanticLabels;
} XrSpatialComponentObjectSemanticLabelListEXT;
Mitgliederbeschreibungen
typeist der XrStructureType dieser Struktur.nextistNULLoder ein Zeiger auf die nächste Struktur in einer Strukturkette. Solche Strukturen sind weder in OpenXR noch in dieser Erweiterung definiert.semanticLabelCountist einuint32_t, der die Anzahl der Elemente im ArraysemanticLabelsbeschreibt.semanticLabelsist ein Array von XrSpatialObjectSemanticLabelEXT .
Wenn Sie die Komponente für das semantische Label des Objekts der räumlichen Entitäten in einem XrSpatialSnapshotEXT abfragen möchten, fügen Sie XR_SPATIAL_COMPONENT_TYPE_OBJECT_SEMANTIC_LABEL_EXT in XrSpatialComponentDataQueryConditionEXT :: componentTypes ein und fügen Sie XrSpatialComponentObjectSemanticLabelListEXT zur Kette XrSpatialComponentDataQueryResultEXT :: next hinzu.
Die Laufzeit muss XR_ERROR_VALIDATION_FAILURE von xrQuerySpatialComponentDataEXT zurückgeben, wenn XrSpatialComponentObjectSemanticLabelListEXT in der XrSpatialComponentDataQueryResultEXT-Kette :: next enthalten ist, aber XR_SPATIAL_COMPONENT_TYPE_OBJECT_SEMANTIC_LABEL_EXT nicht in XrSpatialComponentDataQueryConditionEXT :: componentTypes enthalten ist.
Die Laufzeit muss XR_ERROR_SIZE_INSUFFICIENT von xrQuerySpatialComponentDataEXT zurückgeben, wenn semanticLabelCount kleiner als XrSpatialComponentDataQueryResultEXT :: entityIdCountOutput ist.
Gültige Verwendung (implizit)
- Die Erweiterung
XR_EXT_spatial_object_trackingmuss aktiviert sein, bevor XrSpatialComponentObjectSemanticLabelListEXT verwendet werden kann. -
typemussXR_TYPE_SPATIAL_COMPONENT_OBJECT_SEMANTIC_LABEL_LIST_EXTsein -
nextmussNULLoder ein gültiger Zeiger auf die nächste Struktur in einer Strukturkette sein. -
semanticLabelsmuss ein Zeiger auf ein Array vonsemanticLabelCountXrSpatialObjectSemanticLabelEXT-Werten sein - Der Parameter
semanticLabelCountmuss größer als0sein.
Konfiguration
Wenn XR_SPATIAL_COMPONENT_TYPE_OBJECT_SEMANTIC_LABEL_EXT in XrSpatialCapabilityComponentTypesEXT :: componentTypes für eine bestimmte Funktion aufgeführt ist, kann eine Anwendung sie aktivieren, indem sie den Enumeranten in die Liste XrSpatialCapabilityConfigurationBaseHeaderEXT :: enabledComponents der abgeleiteten Struktur XrSpatialCapabilityConfigurationBaseHeaderEXT der Funktion aufnimmt, die diese Komponente unterstützt.
Diese Komponente erfordert keine spezielle Konfiguration, um in die XrSpatialCapabilityConfigurationBaseHeaderEXT-:: next-Kette aufgenommen zu werden, bietet aber eine optionale Konfiguration für Anwendungen.
Die Struktur XrSpatialFeatureObjectSemanticLabelSubsetEXT ist so definiert:
typedef struct XrSpatialFeatureObjectSemanticLabelSubsetEXT {
XrStructureType type;
const void* next;
uint32_t semanticLabelCount;
const XrSpatialObjectSemanticLabelEXT* semanticLabels;
} XrSpatialFeatureObjectSemanticLabelSubsetEXT;
Mitgliederbeschreibungen
typeist der XrStructureType dieser Struktur.nextistNULLoder ein Zeiger auf die nächste Struktur in einer Strukturkette.semanticLabelCountist einuint32_t, der die Anzahl der Elemente im ArraysemanticLabelsbeschreibt.semanticLabelsist ein Array von XrSpatialObjectSemanticLabelEXT .
Wenn die Laufzeit XR_SPATIAL_COMPONENT_TYPE_OBJECT_SEMANTIC_LABEL_EXT aus xrEnumerateSpatialCapabilityComponentTypesEXT für eine bestimmte Funktion aufzählt, muss sie auch XR_SPATIAL_CAPABILITY_FEATURE_OBJECT_SEMANTIC_LABEL_SUBSET_EXT aus xrEnumerateSpatialCapabilityFeaturesEXT für dieselbe Funktion aufzählen. Wenn eine Anwendung beim Konfigurieren dieser Funktion XR_SPATIAL_COMPONENT_TYPE_OBJECT_SEMANTIC_LABEL_EXT aktiviert, kann sie XrSpatialFeatureObjectSemanticLabelSubsetEXT mit der entsprechenden Konfigurationsstruktur dieser Funktion verketten, um der Laufzeit eine Teilmenge der in XrSpatialObjectSemanticLabelEXT definierten Labels bereitzustellen. Die Laufzeit kann diese Teilmenge von Labels verwenden, um ihre Tracking-Pipelines zu optimieren.
Die Laufzeit muss XR_ERROR_VALIDATION_FAILURE von xrCreateSpatialContextAsyncEXT zurückgeben, wenn semanticLabels ein Label enthält, das nicht in XrSpatialObjectSemanticLabelEXT definiert ist, oder wenn semanticLabels XR_SPATIAL_OBJECT_SEMANTIC_LABEL_UNCATEGORIZED_EXT enthält.
Die Laufzeit muss XR_ERROR_SPATIAL_COMPONENT_NOT_ENABLED_EXT von xrCreateSpatialContextAsyncEXT zurückgeben, wenn die Anwendung eine gültige Liste von Labels in semanticLabels bereitstellt, aber XR_SPATIAL_COMPONENT_TYPE_OBJECT_SEMANTIC_LABEL_EXT nicht im Array XrSpatialCapabilityConfigurationBaseHeaderEXT :: enabledComponents der Konfigurationsstruktur enthalten ist, mit der XrSpatialFeatureObjectSemanticLabelSubsetEXT verkettet ist.
Wenn die Anwendung eine Funktion mit einem gültigen XrSpatialFeatureObjectSemanticLabelSubsetEXT konfiguriert, darf die Laufzeit keine Entitäten mit semantischen Labels enthalten, die nicht in semanticLabels in einem Erkennungs-Snapshot aufgeführt sind, der für den konfigurierten räumlichen Kontext erstellt wurde.
Gültige Verwendung (implizit)
- Die Erweiterung
XR_EXT_spatial_object_trackingmuss aktiviert sein, bevor XrSpatialFeatureObjectSemanticLabelSubsetEXT verwendet werden kann. -
typemussXR_TYPE_SPATIAL_FEATURE_OBJECT_SEMANTIC_LABEL_SUBSET_EXTsein -
nextmussNULLoder ein gültiger Zeiger auf die nächste Struktur in einer Strukturkette sein. -
semanticLabelsmuss ein Zeiger auf ein Array mitsemanticLabelCountgültigen XrSpatialObjectSemanticLabelEXT-Werten sein - Der Parameter
semanticLabelCountmuss größer als0sein.
Semantisches Label für Tastatur
Komponentendaten
typedef enum XrSpatialKeyboardSemanticLabelEXT {
XR_SPATIAL_KEYBOARD_SEMANTIC_LABEL_UNCATEGORIZED_EXT = 1,
XR_SPATIAL_KEYBOARD_SEMANTIC_LABEL_KEYBOARD_EXT = 2,
XR_SPATIAL_KEYBOARD_SEMANTIC_LABEL_MAX_ENUM_EXT = 0x7FFFFFFF
} XrSpatialKeyboardSemanticLabelEXT;
Die Aufzählung XrSpatialKeyboardSemanticLabelEXT beschreibt ein semantisches Label für eine Tastatur.
Die Ausdehnung und Ausrichtung von XR_SPATIAL_KEYBOARD_SEMANTIC_LABEL_KEYBOARD_EXT, dargestellt durch die Komponente Bounded 3D für dieselbe Entität, ist in der folgenden Abbildung zu sehen (mit xyz = rgb), ausgehend vom Mittelpunkt des Objekts.
Abbildung 30: Tastaturausrichtung.
Enum-Beschreibung
XR_SPATIAL_KEYBOARD_SEMANTIC_LABEL_UNCATEGORIZED_EXT
Die Laufzeit konnte diese Entität nicht klassifizieren.
XR_SPATIAL_KEYBOARD_SEMANTIC_LABEL_KEYBOARD_EXT
Das Gerät ist eine Tastatur.
Komponentenlistenstruktur zum Abfragen von Daten
Die Struktur XrSpatialComponentKeyboardSemanticLabelListEXT ist so definiert:
typedef struct XrSpatialComponentKeyboardSemanticLabelListEXT {
XrStructureType type;
void* next;
uint32_t semanticLabelCount;
XrSpatialKeyboardSemanticLabelEXT* semanticLabels;
} XrSpatialComponentKeyboardSemanticLabelListEXT;
Mitgliederbeschreibungen
typeist der XrStructureType dieser Struktur.nextistNULLoder ein Zeiger auf die nächste Struktur in einer Strukturkette. Solche Strukturen sind weder in OpenXR noch in dieser Erweiterung definiert.semanticLabelCountist einuint32_t, der die Anzahl der Elemente im ArraysemanticLabelsbeschreibt.semanticLabelsist ein Array von XrSpatialKeyboardSemanticLabelEXT .
Wenn Sie die Komponente für das semantische Label der Tastatur der räumlichen Entitäten in einem XrSpatialSnapshotEXT abfragen möchten, fügen Sie XR_SPATIAL_COMPONENT_TYPE_KEYBOARD_SEMANTIC_LABEL_EXT in XrSpatialComponentDataQueryConditionEXT :: componentTypes ein und fügen Sie XrSpatialComponentKeyboardSemanticLabelListEXT zur Kette XrSpatialComponentDataQueryResultEXT :: next hinzu.
Die Laufzeit muss XR_ERROR_VALIDATION_FAILURE von xrQuerySpatialComponentDataEXT zurückgeben, wenn XrSpatialComponentKeyboardSemanticLabelListEXT in der XrSpatialComponentDataQueryResultEXT :: next-Kette enthalten ist, aber XR_SPATIAL_COMPONENT_TYPE_KEYBOARD_SEMANTIC_LABEL_EXT nicht in XrSpatialComponentDataQueryConditionEXT :: componentTypes enthalten ist.
Die Laufzeit muss XR_ERROR_SIZE_INSUFFICIENT von xrQuerySpatialComponentDataEXT zurückgeben, wenn semanticLabelCount kleiner als XrSpatialComponentDataQueryResultEXT :: entityIdCountOutput ist.
Gültige Verwendung (implizit)
- Die Erweiterung
XR_EXT_spatial_object_trackingmuss aktiviert sein, bevor XrSpatialComponentKeyboardSemanticLabelListEXT verwendet werden kann. -
typemussXR_TYPE_SPATIAL_COMPONENT_KEYBOARD_SEMANTIC_LABEL_LIST_EXTsein -
nextmussNULLoder ein gültiger Zeiger auf die nächste Struktur in einer Strukturkette sein. -
semanticLabelsmuss ein Zeiger auf ein Array vonsemanticLabelCountXrSpatialKeyboardSemanticLabelEXT-Werten sein. - Der Parameter
semanticLabelCountmuss größer als0sein.
Konfiguration
Wenn XR_SPATIAL_COMPONENT_TYPE_KEYBOARD_SEMANTIC_LABEL_EXT in XrSpatialCapabilityComponentTypesEXT :: componentTypes für eine bestimmte Funktion aufgeführt ist, kann eine Anwendung sie aktivieren, indem sie den Enumeranten in die Liste XrSpatialCapabilityConfigurationBaseHeaderEXT :: enabledComponents der abgeleiteten Struktur XrSpatialCapabilityConfigurationBaseHeaderEXT der Funktion aufnimmt, die diese Komponente unterstützt.
Für diese Komponente ist keine spezielle Konfiguration erforderlich, um sie in die XrSpatialCapabilityConfigurationBaseHeaderEXT-Kette (next) aufzunehmen.
Semantisches Label für Maus
Komponentendaten
typedef enum XrSpatialMouseSemanticLabelEXT {
XR_SPATIAL_MOUSE_SEMANTIC_LABEL_UNCATEGORIZED_EXT = 1,
XR_SPATIAL_MOUSE_SEMANTIC_LABEL_MOUSE_EXT = 2,
XR_SPATIAL_MOUSE_SEMANTIC_LABEL_MAX_ENUM_EXT = 0x7FFFFFFF
} XrSpatialMouseSemanticLabelEXT;
Die Aufzählung XrSpatialMouseSemanticLabelEXT beschreibt ein semantisches Label für eine Maus.
Enum-Beschreibung
XR_SPATIAL_MOUSE_SEMANTIC_LABEL_UNCATEGORIZED_EXT
Die Laufzeit konnte diese Entität nicht klassifizieren.
XR_SPATIAL_MOUSE_SEMANTIC_LABEL_MOUSE_EXT
Die Entität ist eine Maus.
Komponentenlistenstruktur zum Abfragen von Daten
Die Struktur XrSpatialComponentMouseSemanticLabelListEXT ist so definiert:
typedef struct XrSpatialComponentMouseSemanticLabelListEXT {
XrStructureType type;
void* next;
uint32_t semanticLabelCount;
XrSpatialMouseSemanticLabelEXT* semanticLabels;
} XrSpatialComponentMouseSemanticLabelListEXT;
Mitgliederbeschreibungen
typeist der XrStructureType dieser Struktur.nextistNULLoder ein Zeiger auf die nächste Struktur in einer Strukturkette. Solche Strukturen sind weder in OpenXR noch in dieser Erweiterung definiert.semanticLabelCountist einuint32_t, der die Anzahl der Elemente im ArraysemanticLabelsbeschreibt.semanticLabelsist ein Array von XrSpatialMouseSemanticLabelEXT .
Wenn Sie die Komponente für das semantische Label der Maus der räumlichen Entitäten in einem XrSpatialSnapshotEXT abfragen möchten, fügen Sie XR_SPATIAL_COMPONENT_TYPE_MOUSE_SEMANTIC_LABEL_EXT in XrSpatialComponentDataQueryConditionEXT :: componentTypes ein und fügen Sie XrSpatialComponentMouseSemanticLabelListEXT zur Kette XrSpatialComponentDataQueryResultEXT :: next hinzu.
Die Laufzeit muss XR_ERROR_VALIDATION_FAILURE von xrQuerySpatialComponentDataEXT zurückgeben, wenn XrSpatialComponentMouseSemanticLabelListEXT in der XrSpatialComponentDataQueryResultEXT :: next-Kette enthalten ist, aber XR_SPATIAL_COMPONENT_TYPE_MOUSE_SEMANTIC_LABEL_EXT nicht in XrSpatialComponentDataQueryConditionEXT :: componentTypes enthalten ist.
Die Laufzeit muss XR_ERROR_SIZE_INSUFFICIENT von xrQuerySpatialComponentDataEXT zurückgeben, wenn semanticLabelCount kleiner als XrSpatialComponentDataQueryResultEXT :: entityIdCountOutput ist.
Gültige Verwendung (implizit)
- Die Erweiterung
XR_EXT_spatial_object_trackingmuss aktiviert sein, bevor XrSpatialComponentMouseSemanticLabelListEXT verwendet werden kann. -
typemussXR_TYPE_SPATIAL_COMPONENT_MOUSE_SEMANTIC_LABEL_LIST_EXTsein -
nextmussNULLoder ein gültiger Zeiger auf die nächste Struktur in einer Strukturkette sein. -
semanticLabelsmuss ein Zeiger auf ein Array vonsemanticLabelCountXrSpatialMouseSemanticLabelEXT-Werten sein - Der Parameter
semanticLabelCountmuss größer als0sein.
Konfiguration
Wenn XR_SPATIAL_COMPONENT_TYPE_MOUSE_SEMANTIC_LABEL_EXT in XrSpatialCapabilityComponentTypesEXT :: componentTypes für eine bestimmte Funktion aufgeführt ist, kann eine Anwendung sie aktivieren, indem sie den Enumeranten in die Liste XrSpatialCapabilityConfigurationBaseHeaderEXT :: enabledComponents der abgeleiteten Struktur XrSpatialCapabilityConfigurationBaseHeaderEXT der Funktion aufnimmt, die diese Komponente unterstützt.
Für diese Komponente ist keine spezielle Konfiguration erforderlich, um sie in die XrSpatialCapabilityConfigurationBaseHeaderEXT-Kette (next) aufzunehmen.
Beispielcode
Objekt-Tracking-Funktion konfigurieren
Im folgenden Beispielcode wird gezeigt, wie Sie die Objekt-Tracking-Funktion beim Erstellen eines räumlichen Kontexts konfigurieren.
// Check if object tracking capability is supported
uint32_t capabilityCount;
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_OBJECT_TRACKING_EXT) == capabilities.end()) {
return;
}
// Enumerate supported components for object tracking capability
XrSpatialCapabilityComponentTypesEXT objectComponents{XR_TYPE_SPATIAL_CAPABILITY_COMPONENT_TYPES_EXT};
CHK_XR(xrEnumerateSpatialCapabilityComponentTypesEXT(instance, systemId, XR_SPATIAL_CAPABILITY_OBJECT_TRACKING_EXT, &objectComponents));
std::vector<XrSpatialComponentTypeEXT> objectCapabilityComponents(objectComponents.componentTypeCountOutput);
objectComponents.componentTypeCapacityInput = objectCapabilityComponents.size();
objectComponents.componentTypes = objectCapabilityComponents.data();
CHK_XR(xrEnumerateSpatialCapabilityComponentTypesEXT(instance, systemId, XR_SPATIAL_CAPABILITY_OBJECT_TRACKING_EXT, &objectComponents));
// Check if the object & keyboard semantic labels component is supported
const auto supportsComponent = [&objectCapabilityComponents](XrSpatialComponentTypeEXT component) {
return std::find(objectCapabilityComponents.begin(), objectCapabilityComponents.end(), component) != objectCapabilityComponents.end();
};
const bool supportsObjectSemanticLabel = supportsComponent(XR_SPATIAL_COMPONENT_TYPE_OBJECT_SEMANTIC_LABEL_EXT);
const bool supportsKeyboardSemanticLabel = supportsComponent(XR_SPATIAL_COMPONENT_TYPE_KEYBOARD_SEMANTIC_LABEL_EXT);
// Enumerate supported features for object tracking capability
uint32_t featureCount;
CHK_XR(xrEnumerateSpatialCapabilityFeaturesEXT(instance, systemId, XR_SPATIAL_CAPABILITY_OBJECT_TRACKING_EXT, 0, &featureCount, nullptr));
std::vector<XrSpatialCapabilityFeatureEXT> features(featureCount);
CHK_XR(xrEnumerateSpatialCapabilityFeaturesEXT(instance, systemId, XR_SPATIAL_CAPABILITY_OBJECT_TRACKING_EXT, featureCount, &featureCount, features.data()));
const bool supportsObjectSemanticLabelSubsetFeature = std::find(features.begin(), features.end(), XR_SPATIAL_CAPABILITY_FEATURE_OBJECT_SEMANTIC_LABEL_SUBSET_EXT) != features.end();
// Create a spatial context
XrSpatialContextEXT spatialContext{};
// Enable the guaranteed components of the object tracking capability
std::vector<XrSpatialComponentTypeEXT> enabledComponents = {
XR_SPATIAL_COMPONENT_TYPE_BOUNDED_3D_EXT,
};
// Optionally enable the supported semantic labels
if (supportsObjectSemanticLabel) {
enabledComponents.push_back(XR_SPATIAL_COMPONENT_TYPE_OBJECT_SEMANTIC_LABEL_EXT);
}
if (supportsKeyboardSemanticLabel) {
enabledComponents.push_back(XR_SPATIAL_COMPONENT_TYPE_KEYBOARD_SEMANTIC_LABEL_EXT);
}
// We only want to track sofa and table.
std::vector<XrSpatialObjectSemanticLabelEXT> objectSemanticLabelSubset = {
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_SOFA_EXT,
XR_SPATIAL_OBJECT_SEMANTIC_LABEL_TABLE_EXT
};
XrSpatialFeatureObjectSemanticLabelSubsetEXT subsetFeature{XR_TYPE_SPATIAL_FEATURE_OBJECT_SEMANTIC_LABEL_SUBSET_EXT};
subsetFeature.semanticLabelCount = objectSemanticLabelSubset.size();
subsetFeature.semanticLabels = objectSemanticLabelSubset.data();
XrSpatialCapabilityConfigurationObjectTrackingEXT objectTrackingConfig{XR_TYPE_SPATIAL_CAPABILITY_CONFIGURATION_OBJECT_TRACKING_EXT};
objectTrackingConfig.capability = XR_SPATIAL_CAPABILITY_OBJECT_TRACKING_EXT;
objectTrackingConfig.enabledComponentCount = enabledComponents.size();
objectTrackingConfig.enabledComponents = enabledComponents.data();
if (supportsObjectSemanticLabelSubsetFeature) {
objectTrackingConfig.next = &subsetFeature;
}
std::array<XrSpatialCapabilityConfigurationBaseHeaderEXT*, 1> capabilityConfigs = {
reinterpret_cast<XrSpatialCapabilityConfigurationBaseHeaderEXT*>(&objectTrackingConfig),
};
XrSpatialContextCreateInfoEXT spatialContextCreateInfo{XR_TYPE_SPATIAL_CONTEXT_CREATE_INFO_EXT};
spatialContextCreateInfo.capabilityConfigCount = capabilityConfigs.size();
spatialContextCreateInfo.capabilityConfigs = capabilityConfigs.data();
XrFutureEXT createContextFuture;
CHK_XR(xrCreateSpatialContextAsyncEXT(session, &spatialContextCreateInfo, &createContextFuture));
waitUntilReady(createContextFuture);
XrCreateSpatialContextCompletionEXT completion{XR_TYPE_CREATE_SPATIAL_CONTEXT_COMPLETION_EXT};
CHK_XR(xrCreateSpatialContextCompleteEXT(session, createContextFuture, &completion));
if (completion.futureResult != XR_SUCCESS) {
return;
}
spatialContext = completion.spatialContext;
// ...
// Discovery entities with the spatial context
// ...
CHK_XR(xrDestroySpatialContextEXT(spatialContext));
Räumliche Entitäten entdecken und Komponentendaten abfragen
Im folgenden Beispielcode wird gezeigt, wie Sie räumliche Entitäten für einen mit XR_SPATIAL_CAPABILITY_OBJECT_TRACKING_EXT konfigurierten Kontext ermitteln und die zugehörigen Komponentendaten abfragen.
XrFutureEXT future = XR_NULL_FUTURE_EXT;
// We want to look for entities that have the following components.
std::vector<XrSpatialComponentTypeEXT> snapshotComponents = {
XR_SPATIAL_COMPONENT_TYPE_BOUNDED_3D_EXT,
};
if (supportsKeyboardSemanticLabel) {
snapshotComponents.push_back(XR_SPATIAL_COMPONENT_TYPE_KEYBOARD_SEMANTIC_LABEL_EXT);
}
auto discoverSpatialEntities = [&](XrSpatialContextEXT spatialContext, XrTime time) {
XrSpatialDiscoverySnapshotCreateInfoEXT snapshotCreateInfo{XR_TYPE_SPATIAL_DISCOVERY_SNAPSHOT_CREATE_INFO_EXT};
snapshotCreateInfo.componentTypeCount = snapshotComponents.size();
snapshotCreateInfo.componentTypes = snapshotComponents.data();
CHK_XR(xrCreateSpatialDiscoverySnapshotAsyncEXT(spatialContext, &snapshotCreateInfo, &future));
waitUntilReady(future);
XrCreateSpatialDiscoverySnapshotCompletionInfoEXT completionInfo{XR_TYPE_CREATE_SPATIAL_DISCOVERY_SNAPSHOT_COMPLETION_INFO_EXT};
completionInfo.baseSpace = localSpace;
completionInfo.time = time;
completionInfo.future = future;
XrCreateSpatialDiscoverySnapshotCompletionEXT completion{XR_TYPE_CREATE_SPATIAL_DISCOVERY_SNAPSHOT_COMPLETION_EXT};
CHK_XR(xrCreateSpatialDiscoverySnapshotCompleteEXT(spatialContext, &completionInfo, &completion));
if (completion.futureResult == XR_SUCCESS) {
// Query for the semantic label component data
XrSpatialComponentDataQueryConditionEXT queryCond{XR_TYPE_SPATIAL_COMPONENT_DATA_QUERY_CONDITION_EXT};
queryCond.componentTypeCount = snapshotComponents.size();
queryCond.componentTypes = snapshotComponents.data();
XrSpatialComponentDataQueryResultEXT queryResult{XR_TYPE_SPATIAL_COMPONENT_DATA_QUERY_RESULT_EXT};
CHK_XR(xrQuerySpatialComponentDataEXT(completion.snapshot, &queryCond, &queryResult));
std::vector<XrSpatialEntityIdEXT> entityIds(queryResult.entityIdCountOutput);
std::vector<XrSpatialEntityTrackingStateEXT> entityStates(queryResult.entityIdCountOutput);
queryResult.entityIdCapacityInput = entityIds.size();
queryResult.entityIds = entityIds.data();
queryResult.entityStateCapacityInput = entityStates.size();
queryResult.entityStates = entityStates.data();
std::vector<XrBoxf> bounded3D(queryResult.entityIdCountOutput);
XrSpatialComponentBounded3DListEXT bounded3DList{XR_TYPE_SPATIAL_COMPONENT_BOUNDED_3D_LIST_EXT};
bounded3DList.boundCount = bounded3D.size();
bounded3DList.bounds = bounded3D.data();
queryResult.next = &bounded3DList;
std::vector<XrSpatialKeyboardSemanticLabelEXT> semanticLabels;
XrSpatialComponentKeyboardSemanticLabelListEXT semanticLabelsList{XR_TYPE_SPATIAL_COMPONENT_KEYBOARD_SEMANTIC_LABEL_LIST_EXT};
if (supportsKeyboardSemanticLabel) {
semanticLabels.resize(queryResult.entityIdCountOutput);
semanticLabelsList.semanticLabelCount = semanticLabels.size();
semanticLabelsList.semanticLabels = semanticLabels.data();
semanticLabelsList.next = queryResult.next;
queryResult.next = &semanticLabelsList;
}
CHK_XR(xrQuerySpatialComponentDataEXT(completion.snapshot, &queryCond, &queryResult));
for (int32_t i = 0; i < queryResult.entityIdCountOutput; ++i) {
if (entityStates[i] != XR_SPATIAL_ENTITY_TRACKING_STATE_TRACKING_EXT) {
continue;
}
// 3D bounds for entity entityIds[i] is bounded3D[i].extents centered on bounded3D[i].center.
if (supportsKeyboardSemanticLabel) {
// semantic label for entity entityIds[i] is semanticLabels[i].
}
}
CHK_XR(xrDestroySpatialSnapshotEXT(completion.snapshot));
}
};
while (1) {
// ...
// For every frame in frame loop
// ...
XrFrameState frameState; // previously returned from xrWaitFrame
const XrTime time = frameState.predictedDisplayTime;
// Poll for the XR_TYPE_EVENT_DATA_SPATIAL_DISCOVERY_RECOMMENDED_EXT event
XrEventDataBuffer event = {XR_TYPE_EVENT_DATA_BUFFER};
XrResult result = xrPollEvent(instance, &event);
if (result == XR_SUCCESS) {
switch (event.type) {
case XR_TYPE_EVENT_DATA_SPATIAL_DISCOVERY_RECOMMENDED_EXT: {
const XrEventDataSpatialDiscoveryRecommendedEXT& eventdata =
*reinterpret_cast<XrEventDataSpatialDiscoveryRecommendedEXT*>(&event);
// Discover spatial entities for the context that we received the "discovery
// recommended" event for.
discoverSpatialEntities(eventdata.spatialContext, time);
break;
}
}
}
// ...
// Finish frame loop
// ...
}
Neue Gebäude
- XrSpatialCapabilityConfigurationObjectTrackingEXT
Erweiterung von XrSpatialCapabilityConfigurationObjectTrackingEXT :
Erweiterung von XrSpatialComponentDataQueryResultEXT :
Neue Enums
Neue Enum-Konstanten
XR_EXT_SPATIAL_OBJECT_TRACKING_EXTENSION_NAMEXR_EXT_spatial_object_tracking_SPEC_VERSIONErweiterung von XrSpatialCapabilityEXT :
XR_SPATIAL_CAPABILITY_OBJECT_TRACKING_EXT
Erweiterung von XrSpatialCapabilityFeatureEXT :
XR_SPATIAL_CAPABILITY_FEATURE_OBJECT_SEMANTIC_LABEL_SUBSET_EXT
Erweiterung von XrSpatialComponentTypeEXT :
XR_SPATIAL_COMPONENT_TYPE_KEYBOARD_SEMANTIC_LABEL_EXTXR_SPATIAL_COMPONENT_TYPE_MOUSE_SEMANTIC_LABEL_EXTXR_SPATIAL_COMPONENT_TYPE_OBJECT_SEMANTIC_LABEL_EXT
Erweiterung von XrStructureType :
XR_TYPE_SPATIAL_CAPABILITY_CONFIGURATION_OBJECT_TRACKING_EXTXR_TYPE_SPATIAL_COMPONENT_KEYBOARD_SEMANTIC_LABEL_LIST_EXTXR_TYPE_SPATIAL_COMPONENT_MOUSE_SEMANTIC_LABEL_LIST_EXTXR_TYPE_SPATIAL_COMPONENT_OBJECT_SEMANTIC_LABEL_LIST_EXTXR_TYPE_SPATIAL_FEATURE_OBJECT_SEMANTIC_LABEL_SUBSET_EXT
Probleme
Versionsverlauf
Version 1, 03.06.2025 (Nihav Jain, Google)
- Anfängliche Beschreibung der Erweiterung