Class MSFTControllerModel
This extension provides a mechanism to load a GLTF model for controllers. An application can render the controller model using the real time pose input from controller’s grip action pose and animate controller parts representing the user’s interactions, such as pressing a button, or pulling a trigger.
This extension supports any controller interaction profile that supports subpathname:/grip/pose. The returned controller model represents the physical controller held in the user’s hands, and it may be different from the current interaction profile.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intExtendsXrResult.static final intXR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFTstatic final StringThe extension name.static final intThe extension specification version.static final longAPI Constantsstatic final intExtendsXrStructureType.static final intExtendsXrStructureType.static final intExtendsXrStructureType.static final intExtendsXrStructureType.static final intExtendsXrStructureType. -
Method Summary
Modifier and TypeMethodDescriptionstatic intnxrGetControllerModelKeyMSFT(XrSession session, long topLevelUserPath, long controllerModelKeyState) Unsafe version of:GetControllerModelKeyMSFTstatic intnxrGetControllerModelPropertiesMSFT(XrSession session, long modelKey, long properties) Unsafe version of:GetControllerModelPropertiesMSFTstatic intnxrGetControllerModelStateMSFT(XrSession session, long modelKey, long state) Unsafe version of:GetControllerModelStateMSFTstatic intnxrLoadControllerModelMSFT(XrSession session, long modelKey, int bufferCapacityInput, long bufferCountOutput, long buffer) Unsafe version of:LoadControllerModelMSFTstatic intxrGetControllerModelKeyMSFT(XrSession session, long topLevelUserPath, XrControllerModelKeyStateMSFT controllerModelKeyState) Retrieve the model key for the controller.static intxrGetControllerModelPropertiesMSFT(XrSession session, long modelKey, XrControllerModelPropertiesMSFT properties) Get controller model properties.static intxrGetControllerModelStateMSFT(XrSession session, long modelKey, XrControllerModelStateMSFT state) Get controller model state.static intxrLoadControllerModelMSFT(XrSession session, long modelKey, IntBuffer bufferCountOutput, @Nullable ByteBuffer buffer) Load controller render model.
-
Field Details
-
XR_MSFT_controller_model_SPEC_VERSION
public static final int XR_MSFT_controller_model_SPEC_VERSIONThe extension specification version.- See Also:
-
XR_MSFT_CONTROLLER_MODEL_EXTENSION_NAME
The extension name.- See Also:
-
XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT
public static final int XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFTXR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT- See Also:
-
XR_TYPE_CONTROLLER_MODEL_KEY_STATE_MSFT
public static final int XR_TYPE_CONTROLLER_MODEL_KEY_STATE_MSFTExtendsXrStructureType.Enum values:
- See Also:
-
XR_TYPE_CONTROLLER_MODEL_NODE_PROPERTIES_MSFT
public static final int XR_TYPE_CONTROLLER_MODEL_NODE_PROPERTIES_MSFTExtendsXrStructureType.Enum values:
- See Also:
-
XR_TYPE_CONTROLLER_MODEL_PROPERTIES_MSFT
public static final int XR_TYPE_CONTROLLER_MODEL_PROPERTIES_MSFTExtendsXrStructureType.Enum values:
- See Also:
-
XR_TYPE_CONTROLLER_MODEL_NODE_STATE_MSFT
public static final int XR_TYPE_CONTROLLER_MODEL_NODE_STATE_MSFTExtendsXrStructureType.Enum values:
- See Also:
-
XR_TYPE_CONTROLLER_MODEL_STATE_MSFT
public static final int XR_TYPE_CONTROLLER_MODEL_STATE_MSFTExtendsXrStructureType.Enum values:
- See Also:
-
XR_ERROR_CONTROLLER_MODEL_KEY_INVALID_MSFT
public static final int XR_ERROR_CONTROLLER_MODEL_KEY_INVALID_MSFTExtendsXrResult.- See Also:
-
XR_NULL_CONTROLLER_MODEL_KEY_MSFT
public static final long XR_NULL_CONTROLLER_MODEL_KEY_MSFTAPI Constants- See Also:
-
-
Method Details
-
nxrGetControllerModelKeyMSFT
public static int nxrGetControllerModelKeyMSFT(XrSession session, long topLevelUserPath, long controllerModelKeyState) Unsafe version of:GetControllerModelKeyMSFT -
xrGetControllerModelKeyMSFT
public static int xrGetControllerModelKeyMSFT(XrSession session, long topLevelUserPath, XrControllerModelKeyStateMSFT controllerModelKeyState) Retrieve the model key for the controller.C Specification
GetControllerModelKeyMSFTretrieves theXrControllerModelKeyMSFTfor a controller. This model key may later be used to retrieve the model data.The
GetControllerModelKeyMSFTfunction is defined as:XrResult xrGetControllerModelKeyMSFT( XrSession session, XrPath topLevelUserPath, XrControllerModelKeyStateMSFT* controllerModelKeyState);Valid Usage (Implicit)
- The
XR_MSFT_controller_modelextension must be enabled prior to callingGetControllerModelKeyMSFT sessionmust be a validXrSessionhandlecontrollerModelKeyStatemust be a pointer to anXrControllerModelKeyStateMSFTstructure
Return Codes
- On success, this command returns
- On failure, this command returns
See Also
- Parameters:
session- the specifiedXrSession.topLevelUserPath- the top level user path corresponding to the controller render model being queried (e.g. pathname:/user/hand/left or pathname:/user/hand/right).controllerModelKeyState- a pointer to theXrControllerModelKeyStateMSFTto write the model key state to.
- The
-
nxrLoadControllerModelMSFT
public static int nxrLoadControllerModelMSFT(XrSession session, long modelKey, int bufferCapacityInput, long bufferCountOutput, long buffer) Unsafe version of:LoadControllerModelMSFT- Parameters:
bufferCapacityInput- the capacity of thebufferarray, or 0 to indicate a request to retrieve the required capacity.
-
xrLoadControllerModelMSFT
public static int xrLoadControllerModelMSFT(XrSession session, long modelKey, IntBuffer bufferCountOutput, @Nullable ByteBuffer buffer) Load controller render model.C Specification
The
LoadControllerModelMSFTfunction loads the controller model as a byte buffer containing a binary form of glTF (a.k.a GLB file format) for the controller. The binary glTF data must conform to glTF 2.0 format defined at https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html.XrResult xrLoadControllerModelMSFT( XrSession session, XrControllerModelKeyMSFT modelKey, uint32_t bufferCapacityInput, uint32_t* bufferCountOutput, uint8_t* buffer);Description
The
LoadControllerModelMSFTfunction may be a slow operation and therefore should be invoked from a non-timing critical thread.If the input
modelKeyis invalid, i.e. it isNULL_CONTROLLER_MODEL_KEY_MSFTor not a key returned fromXrControllerModelKeyStateMSFT, the runtime must returnERROR_CONTROLLER_MODEL_KEY_INVALID_MSFT.Valid Usage (Implicit)
- The
XR_MSFT_controller_modelextension must be enabled prior to callingLoadControllerModelMSFT sessionmust be a validXrSessionhandlebufferCountOutputmust be a pointer to auint32_tvalue- If
bufferCapacityInputis not 0,buffermust be a pointer to an array ofbufferCapacityInputuint8_tvalues
Return Codes
- On success, this command returns
- On failure, this command returns
- Parameters:
session- the specifiedXrSession.modelKey- the model key corresponding to the controller render model being queried.bufferCountOutput- filled in by the runtime with the count of elements inbufferarray, or returns the required capacity in the case thatbufferCapacityInputis insufficient.buffer- a pointer to an application-allocated array of the model for the device that will be filled with theuint8_tvalues by the runtime. It can beNULLifbufferCapacityInputis 0.
- The
-
nxrGetControllerModelPropertiesMSFT
public static int nxrGetControllerModelPropertiesMSFT(XrSession session, long modelKey, long properties) Unsafe version of:GetControllerModelPropertiesMSFT -
xrGetControllerModelPropertiesMSFT
public static int xrGetControllerModelPropertiesMSFT(XrSession session, long modelKey, XrControllerModelPropertiesMSFT properties) Get controller model properties.C Specification
The
GetControllerModelPropertiesMSFTfunction returns the controller model properties for a givenmodelKey.XrResult xrGetControllerModelPropertiesMSFT( XrSession session, XrControllerModelKeyMSFT modelKey, XrControllerModelPropertiesMSFT* properties);Description
The runtime must return the same data in
XrControllerModelPropertiesMSFTfor a validmodelKey. Therefore, the application can cache the returnedXrControllerModelPropertiesMSFTusingmodelKeyand reuse the data for each frame.If the input
modelKeyis invalid, i.e. it isNULL_CONTROLLER_MODEL_KEY_MSFTor not a key returned fromXrControllerModelKeyStateMSFT, the runtime must returnERROR_CONTROLLER_MODEL_KEY_INVALID_MSFT.Valid Usage (Implicit)
- The
XR_MSFT_controller_modelextension must be enabled prior to callingGetControllerModelPropertiesMSFT sessionmust be a validXrSessionhandlepropertiesmust be a pointer to anXrControllerModelPropertiesMSFTstructure
Return Codes
- On success, this command returns
- On failure, this command returns
See Also
- Parameters:
session- the specifiedXrSession.modelKey- a valid model key obtained fromXrControllerModelKeyStateMSFTproperties- anXrControllerModelPropertiesMSFTreturning the properties of the controller model
- The
-
nxrGetControllerModelStateMSFT
Unsafe version of:GetControllerModelStateMSFT -
xrGetControllerModelStateMSFT
public static int xrGetControllerModelStateMSFT(XrSession session, long modelKey, XrControllerModelStateMSFT state) Get controller model state.C Specification
The
GetControllerModelStateMSFTfunction returns the current state of the controller model representing user’s interaction to the controller, such as pressing a button or pulling a trigger.XrResult xrGetControllerModelStateMSFT( XrSession session, XrControllerModelKeyMSFT modelKey, XrControllerModelStateMSFT* state);Description
The runtime may return different state for a model key after each call to
SyncActions, which represents the latest state of the user interactions.If the input
modelKeyis invalid, i.e. it isNULL_CONTROLLER_MODEL_KEY_MSFTor not a key returned fromXrControllerModelKeyStateMSFT, the runtime must returnERROR_CONTROLLER_MODEL_KEY_INVALID_MSFT.Valid Usage (Implicit)
- The
XR_MSFT_controller_modelextension must be enabled prior to callingGetControllerModelStateMSFT sessionmust be a validXrSessionhandlestatemust be a pointer to anXrControllerModelStateMSFTstructure
Return Codes
- On success, this command returns
- On failure, this command returns
See Also
- Parameters:
session- the specifiedXrSession.modelKey- the model key corresponding to the controller model being queried.state- a pointer toXrControllerModelNodeStateMSFTreturns the current controller model state.
- The
-