XRTraits C++ OpenXR Utilities
|
This example shows a typical usage of doTwoCallWithSizeHint(): when locating views. The number of views should in theory be known, but for safety and consistency this function is specified in two-call style.
It also shows a few uses of xrtraits::Initialized - one (viewState
) with no arguments (which sets just the type
and next
), and one (viewLocateInfo
) with some arguments that aren't a chained struct. In this case, type
and next
are initialized like normal, while the subsequent members of XrViewLocateInfo, displayTime
and space
, are initialized from frameTime
and local
respectively.
Because a size hint was provided, this call will initially create a vector of numViews
XrView
structures before attempting to call xrLocateViews. This will generally reduce the number of calls to xrLocateViews to 1, since the initial capacity should be sufficient. The wrapper will make a call like the following as required to retrieve all properties (adjusting the parameters and array between calls):
Note how the several additional arguments were forwarded to the call before the capacity, count, and array args.