Update preview runtime sample and fixed a minor bug in preview runtime reflection header. (#46)
This commit is contained in:
Родитель
a65e8ac77b
Коммит
829b4ebfec
25
README.md
25
README.md
|
@ -39,35 +39,42 @@ over the coming months.
|
|||
|
||||
# OpenXR samples and extension usages
|
||||
|
||||
- The core OpenXR API usage patterns can be found in the [BasicXrApp/OpenXRProgram.cpp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/samples/BasicXrApp/OpenXrProgram.cpp) file. <br/>
|
||||
- **The core OpenXR API usage patterns** <br/>
|
||||
can be found in the [BasicXrApp/OpenXRProgram.cpp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/samples/BasicXrApp/OpenXrProgram.cpp) file.
|
||||
The [Run() function](https://github.com/microsoft/OpenXR-MixedReality/blob/master/samples/BasicXrApp/OpenXrProgram.cpp#L28)
|
||||
captures a typical OpenXR app code flow for session initialization, event handling, the frame loop and input actions.
|
||||
|
||||
* The [Scene_HandTracking.cpp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/samples/SampleSceneUwp/Scene_HandTracking.cpp)
|
||||
- **Hand tracking** <br/>
|
||||
The [Scene_HandTracking.cpp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/samples/SampleSceneUwp/Scene_HandTracking.cpp)
|
||||
demos the usage of [XR_EXT_hand_tracking](https://microsoft.github.io/OpenXR-MixedReality/openxr_preview/specs/openxr.html#XR_EXT_hand_tracking)
|
||||
and [XR_MSFT_hand_tracking_mesh](https://microsoft.github.io/OpenXR-MixedReality/openxr_preview/specs/openxr.html#XR_MSFT_hand_tracking_mesh) extensions.
|
||||
|
||||
* Search "secondary" in [XrApp.cpp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/shared/XrSceneLib/XrApp.cpp) file
|
||||
- **Eye tracking** <br/>
|
||||
The [Scene_EyeGazeInteraction.cpp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/samples/EyeGazeInteractionUwp/Scene_EyeGazeInteraction.cpp) file
|
||||
demos the usage of [XR_EXT_eye_gaze_interaction](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_EXT_eye_gaze_interaction) extension.
|
||||
|
||||
- **Mixed reality capture support** <br/>
|
||||
Search "secondary" in [XrApp.cpp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/shared/XrSceneLib/XrApp.cpp) file
|
||||
to understand the usage of [XR_MSFT_secondary_view_configuration](https://microsoft.github.io/OpenXR-MixedReality/openxr_preview/specs/openxr.html#XR_MSFT_secondary_view_configuration)
|
||||
and [XR_MSFT_first_person_observer](https://microsoft.github.io/OpenXR-MixedReality/openxr_preview/specs/openxr.html#XR_MSFT_first_person_observer) extensions.
|
||||
|
||||
* The [ControllerObject.cpp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/shared/XrSceneLib/ControllerObject.cpp) and
|
||||
- **Render the motion controller model** <br/>
|
||||
The [ControllerObject.cpp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/shared/XrSceneLib/ControllerObject.cpp) and
|
||||
[Scene_ControllerModel.cpp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/samples/SampleSceneWin32/Scene_ControllerModel.cpp) files
|
||||
demos the usage of [XR_MSFT_controller_model_preview](https://microsoft.github.io/OpenXR-MixedReality/openxr_preview/specs/openxr.html#XR_MSFT_controller_model_preview) extension.
|
||||
|
||||
* The [SampleSceneUwp/Main.cpp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/samples/SampleSceneUwp/Main.cpp) file demos protocol activation for XR apps,
|
||||
- **Holographic window attachment** <br/>
|
||||
The [SampleSceneUwp/Main.cpp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/samples/SampleSceneUwp/Main.cpp) file demos protocol activation for XR apps,
|
||||
and using [XR_MSFT_holographic_window_attachment_preview](https://microsoft.github.io/OpenXR-MixedReality/openxr_preview/specs/openxr.html#XR_MSFT_holographic_window_attachment_preview) extension
|
||||
to interop with CoreWindow in order to support [keyboard inputs](https://docs.microsoft.com/en-us/windows/mixed-reality/keyboard-mouse-and-controller-input-in-directx#subscribe-for-corewindow-input-events)
|
||||
and [TextEditingContext](https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Text.Core.CoreTextEditContext?view=winrt-19041).
|
||||
|
||||
* The [ThreeSpacesUwp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/samples/ThreeSpacesUwp/Scene_ThreeSpaces.cpp) project
|
||||
- **Understand the local, unbounded and anchor spaces**<br/>
|
||||
The [ThreeSpacesUwp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/samples/ThreeSpacesUwp/Scene_ThreeSpaces.cpp) project
|
||||
demos the usage and differences of [LOCAL](https://microsoft.github.io/OpenXR-MixedReality/openxr_preview/specs/openxr.html#reference-spaces),
|
||||
[UNBOUNDED](https://microsoft.github.io/OpenXR-MixedReality/openxr_preview/specs/openxr.html#XR_MSFT_unbounded_reference_space) reference spaces
|
||||
and [spatial anchors](https://microsoft.github.io/OpenXR-MixedReality/openxr_preview/specs/openxr.html#XR_MSFT_spatial_anchor).
|
||||
|
||||
* The [Scene_EyeGazeInteraction.cpp](https://github.com/microsoft/OpenXR-MixedReality/blob/master/samples/EyeGazeInteractionUwp/Scene_EyeGazeInteraction.cpp) file
|
||||
demos the usage of [XR_EXT_eye_gaze_interaction](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_EXT_eye_gaze_interaction) extension.
|
||||
|
||||
* The sample code for [XR_MSFT_spatial_graph_bridge](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_MSFT_spatial_graph_bridge) is coming soon ...
|
||||
|
||||
|
||||
|
|
|
@ -2059,9 +2059,9 @@ typedef struct XrControllerModelStateMSFT {
|
|||
} XrControllerModelStateMSFT;
|
||||
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetControllerModelKeyMSFT)(XrSession session, XrPath topLevelUserPath, XrControllerModelKeyStateMSFT* controllerModelKeyState);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrLoadControllerModelMSFT)(XrSession session, XrControllerModelKeyMSFT modelKey, uint32_t sizeInput, uint32_t*sizeOutput, uint8_t*buffer);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetControllerModelPropertiesMSFT)(XrSession session, XrControllerModelKeyMSFT modelKey, XrControllerModelPropertiesMSFT*properties);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetControllerModelStateMSFT)(XrSession session, XrControllerModelKeyMSFT modelKey, XrControllerModelStateMSFT*state);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrLoadControllerModelMSFT)(XrSession session, XrControllerModelKeyMSFT modelKey, uint32_t sizeInput, uint32_t* sizeOutput, uint8_t* buffer);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetControllerModelPropertiesMSFT)(XrSession session, XrControllerModelKeyMSFT modelKey, XrControllerModelPropertiesMSFT* properties);
|
||||
typedef XrResult (XRAPI_PTR *PFN_xrGetControllerModelStateMSFT)(XrSession session, XrControllerModelKeyMSFT modelKey, XrControllerModelStateMSFT* state);
|
||||
|
||||
#ifndef XR_NO_PROTOTYPES
|
||||
XRAPI_ATTR XrResult XRAPI_CALL xrGetControllerModelKeyMSFT(
|
||||
|
@ -2094,12 +2094,12 @@ XRAPI_ATTR XrResult XRAPI_CALL xrGetControllerModelStateMSFT(
|
|||
|
||||
|
||||
#define XR_EPIC_view_configuration_fov 1
|
||||
#define XR_EPIC_view_configuration_fov_SPEC_VERSION 1
|
||||
#define XR_EPIC_view_configuration_fov_SPEC_VERSION 2
|
||||
#define XR_EPIC_VIEW_CONFIGURATION_FOV_EXTENSION_NAME "XR_EPIC_view_configuration_fov"
|
||||
typedef struct XrViewConfigurationViewFovEPIC {
|
||||
XrStructureType type;
|
||||
const void* XR_MAY_ALIAS next;
|
||||
XrFovf recommendedMutableFov;
|
||||
XrFovf recommendedFov;
|
||||
XrFovf maxMutableFov;
|
||||
} XrViewConfigurationViewFovEPIC;
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -444,8 +444,8 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
|
|||
<div class="details">
|
||||
<span id="author" class="author">Copyright (c) 2017-2020 The Khronos Group Inc.</span><br>
|
||||
<span id="revnumber">version 1.0.9,</span>
|
||||
<span id="revdate">Thu, 11 Jun 2020 00:43:50 +0000</span>
|
||||
<br><span id="revremark">from git branch: master commit: bb979543693369d3fe357c24a7e3be1e12175207</span>
|
||||
<span id="revdate">Mon, 22 Jun 2020 18:45:31 +0000</span>
|
||||
<br><span id="revremark">from git branch: master commit: 3ad53cba1e21504eedd74b88a286277bdcb10898</span>
|
||||
</div>
|
||||
<div id="toc" class="toc2">
|
||||
<div id="toctitle">Table of Contents</div>
|
||||
|
@ -15135,7 +15135,7 @@ do not collide are not affected and are processed as normal.</p>
|
|||
the runtime <strong class="purple">must</strong> return <code>XR_ERROR_NAME_INVALID</code> or
|
||||
<code>XR_ERROR_LOCALIZED_NAME_INVALID</code> respectively.
|
||||
If <code>actionSetName</code> or <code>localizedActionSetName</code> are duplicates of the
|
||||
corresponding field for any existing action set in the specified session,
|
||||
corresponding field for any existing action set in the specified instance,
|
||||
the runtime <strong class="purple">must</strong> return <code>XR_ERROR_NAME_DUPLICATED</code> or
|
||||
<code>XR_ERROR_LOCALIZED_NAME_DUPLICATED</code> respectively.
|
||||
If the conflicting action set is destroyed, the conflicting field is no
|
||||
|
@ -20270,7 +20270,7 @@ i.e. <a href="#XrCompositionLayerProjection">XrCompositionLayerProjection</a>.</
|
|||
</div>
|
||||
<div class="paragraph">
|
||||
<p>The XR runtime <strong class="purple">may</strong> use this information to perform more accurate
|
||||
reprojections taking depth into account.</p>
|
||||
reprojections taking depth into account. Use of this extension does not affect the order of layer composition as described in <a href="#compositing">Compositing</a>.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p><strong>New Object Types</strong></p>
|
||||
|
@ -21418,11 +21418,12 @@ output structure.</p>
|
|||
<p>The <a href="#xrGetD3D11GraphicsRequirementsKHR">xrGetD3D11GraphicsRequirementsKHR</a> function identifies to the
|
||||
application what graphics device (Windows LUID) needs to be used and the
|
||||
minimum feature level to use.
|
||||
<a href="#xrGetD3D11GraphicsRequirementsKHR">xrGetD3D11GraphicsRequirementsKHR</a> <strong class="purple">must</strong> be called prior to calling
|
||||
<a href="#xrCreateSession">xrCreateSession</a>, and the LUID and feature level that
|
||||
<a href="#xrGetD3D11GraphicsRequirementsKHR">xrGetD3D11GraphicsRequirementsKHR</a> returns should be used to create the
|
||||
<code>ID3D11Device</code> that the application passes to <a href="#xrCreateSession">xrCreateSession</a> in
|
||||
the <a href="#XrGraphicsBindingD3D11KHR">XrGraphicsBindingD3D11KHR</a>.</p>
|
||||
The runtime <strong class="purple">must</strong> return <code>XR_ERROR_VALIDATION_FAILURE</code> on calls to
|
||||
<a href="#xrCreateSession">xrCreateSession</a> if <a href="#xrGetD3D11GraphicsRequirementsKHR">xrGetD3D11GraphicsRequirementsKHR</a> has not
|
||||
been called for the same <code>instance</code> and <code>systemId</code>.
|
||||
The LUID and feature level that <a href="#xrGetD3D11GraphicsRequirementsKHR">xrGetD3D11GraphicsRequirementsKHR</a>
|
||||
returns should be used to create the <code>ID3D11Device</code> that the application
|
||||
passes to <a href="#xrCreateSession">xrCreateSession</a> in the <a href="#XrGraphicsBindingD3D11KHR">XrGraphicsBindingD3D11KHR</a>.</p>
|
||||
</div>
|
||||
<div class="sidebarblock">
|
||||
<div class="content">
|
||||
|
@ -21985,11 +21986,12 @@ output structure.</p>
|
|||
<p>The <a href="#xrGetD3D12GraphicsRequirementsKHR">xrGetD3D12GraphicsRequirementsKHR</a> function identifies to the
|
||||
application what graphics device (Windows LUID) needs to be used and the
|
||||
minimum feature level to use.
|
||||
<a href="#xrGetD3D12GraphicsRequirementsKHR">xrGetD3D12GraphicsRequirementsKHR</a> <strong class="purple">must</strong> be called prior to calling
|
||||
<a href="#xrCreateSession">xrCreateSession</a>, and the LUID and feature level that
|
||||
<a href="#xrGetD3D12GraphicsRequirementsKHR">xrGetD3D12GraphicsRequirementsKHR</a> returns should be used to create the
|
||||
<code>ID3D12Device</code> that the application passes to <a href="#xrCreateSession">xrCreateSession</a> in
|
||||
the <a href="#XrGraphicsBindingD3D12KHR">XrGraphicsBindingD3D12KHR</a>.</p>
|
||||
The runtime <strong class="purple">must</strong> return <code>XR_ERROR_VALIDATION_FAILURE</code> on calls to
|
||||
<a href="#xrCreateSession">xrCreateSession</a> if <a href="#xrGetD3D12GraphicsRequirementsKHR">xrGetD3D12GraphicsRequirementsKHR</a> has not
|
||||
been called for the same <code>instance</code> and <code>systemId</code>.
|
||||
The LUID and feature level that <a href="#xrGetD3D12GraphicsRequirementsKHR">xrGetD3D12GraphicsRequirementsKHR</a>
|
||||
returns should be used to create the <code>ID3D12Device</code> that the application
|
||||
passes to <a href="#xrCreateSession">xrCreateSession</a> in the <a href="#XrGraphicsBindingD3D12KHR">XrGraphicsBindingD3D12KHR</a>.</p>
|
||||
</div>
|
||||
<div class="sidebarblock">
|
||||
<div class="content">
|
||||
|
@ -22833,8 +22835,9 @@ output structure.</p>
|
|||
<p>The <a href="#xrGetOpenGLGraphicsRequirementsKHR">xrGetOpenGLGraphicsRequirementsKHR</a> function identifies to the
|
||||
application the minimum OpenGL version requirement and the highest known
|
||||
tested OpenGL version.
|
||||
<a href="#xrGetOpenGLGraphicsRequirementsKHR">xrGetOpenGLGraphicsRequirementsKHR</a> <strong class="purple">must</strong> be called prior to calling
|
||||
<a href="#xrCreateSession">xrCreateSession</a>.</p>
|
||||
The runtime <strong class="purple">must</strong> return <code>XR_ERROR_VALIDATION_FAILURE</code> on calls to
|
||||
<a href="#xrCreateSession">xrCreateSession</a> if <a href="#xrGetOpenGLGraphicsRequirementsKHR">xrGetOpenGLGraphicsRequirementsKHR</a> has not
|
||||
been called for the same <code>instance</code> and <code>systemId</code>.</p>
|
||||
</div>
|
||||
<div class="sidebarblock">
|
||||
<div class="content">
|
||||
|
@ -23404,8 +23407,9 @@ output structure.</p>
|
|||
<p>The <a href="#xrGetOpenGLESGraphicsRequirementsKHR">xrGetOpenGLESGraphicsRequirementsKHR</a> function identifies to the
|
||||
application the minimum OpenGL ES version requirement and the highest known
|
||||
tested OpenGL ES version.
|
||||
<a href="#xrGetOpenGLESGraphicsRequirementsKHR">xrGetOpenGLESGraphicsRequirementsKHR</a> <strong class="purple">must</strong> be called prior to calling
|
||||
<a href="#xrCreateSession">xrCreateSession</a>.</p>
|
||||
The runtime <strong class="purple">must</strong> return <code>XR_ERROR_VALIDATION_FAILURE</code> on calls to
|
||||
<a href="#xrCreateSession">xrCreateSession</a> if <a href="#xrGetOpenGLESGraphicsRequirementsKHR">xrGetOpenGLESGraphicsRequirementsKHR</a> has not
|
||||
been called for the same <code>instance</code> and <code>systemId</code>.</p>
|
||||
</div>
|
||||
<div class="sidebarblock">
|
||||
<div class="content">
|
||||
|
@ -24563,8 +24567,9 @@ output structure.</p>
|
|||
<p>The <a href="#xrGetVulkanGraphicsRequirementsKHR">xrGetVulkanGraphicsRequirementsKHR</a> function identifies to the
|
||||
application the minimum Vulkan version requirement and the highest known
|
||||
tested Vulkan version.
|
||||
<a href="#xrGetVulkanGraphicsRequirementsKHR">xrGetVulkanGraphicsRequirementsKHR</a> <strong class="purple">must</strong> be called prior to calling
|
||||
<a href="#xrCreateSession">xrCreateSession</a>.</p>
|
||||
The runtime <strong class="purple">must</strong> return <code>XR_ERROR_VALIDATION_FAILURE</code> on calls to
|
||||
<a href="#xrCreateSession">xrCreateSession</a> if <a href="#xrGetVulkanGraphicsRequirementsKHR">xrGetVulkanGraphicsRequirementsKHR</a> has not
|
||||
been called for the same <code>instance</code> and <code>systemId</code>.</p>
|
||||
</div>
|
||||
<div class="sidebarblock">
|
||||
<div class="content">
|
||||
|
@ -31569,7 +31574,7 @@ properly in the AppContainer execution environment.</p>
|
|||
</dd>
|
||||
<dt class="hdlist1"><strong>Revision</strong></dt>
|
||||
<dd>
|
||||
<p>1</p>
|
||||
<p>2</p>
|
||||
</dd>
|
||||
<dt class="hdlist1"><strong>Extension and Version Dependencies</strong></dt>
|
||||
<dd>
|
||||
|
@ -31644,7 +31649,7 @@ the field-of-view for that view.</p>
|
|||
<pre class="prettyprint highlight"><code data-lang="c++">typedef struct XrViewConfigurationViewFovEPIC {
|
||||
XrStructureType type;
|
||||
const void* next;
|
||||
XrFovf recommendedMutableFov;
|
||||
XrFovf recommendedFov;
|
||||
XrFovf maxMutableFov;
|
||||
} XrViewConfigurationViewFovEPIC;</code></pre>
|
||||
</div>
|
||||
|
@ -31704,6 +31709,16 @@ display.</p>
|
|||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p>Revision 2, 2020-06-04 (Jules Blok)</p>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p>Fixed incorrect member name.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<p>Revision 1, 2020-03-05 (Jules Blok)</p>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
|
@ -32675,10 +32690,10 @@ that doesn’t match any gltTF nodes in the corresponding controller model.<
|
|||
<p><a id="VUID-XrControllerModelNodePropertiesMSFT-next-next" href="#VUID-XrControllerModelNodePropertiesMSFT-next-next"></a> <code>next</code> <strong class="purple">must</strong> be <code>NULL</code> or a valid pointer to the <a href="#valid-usage-for-structure-pointer-chains">next structure in a structure chain</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>[[VUID-XrControllerModelNodePropertiesMSFT-parentNodeName[XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT]-parameter]] <code>parentNodeName</code>[XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT] <strong class="purple">must</strong> be a valid</p>
|
||||
<p><a id="VUID-XrControllerModelNodePropertiesMSFT-parentNodeName-parameter" href="#VUID-XrControllerModelNodePropertiesMSFT-parentNodeName-parameter"></a> <code>parentNodeName</code> <strong class="purple">must</strong> be a null-terminated UTF-8 string whose length is less than or equal to XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>[[VUID-XrControllerModelNodePropertiesMSFT-nodeName[XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT]-parameter]] <code>nodeName</code>[XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT] <strong class="purple">must</strong> be a valid</p>
|
||||
<p><a id="VUID-XrControllerModelNodePropertiesMSFT-nodeName-parameter" href="#VUID-XrControllerModelNodePropertiesMSFT-nodeName-parameter"></a> <code>nodeName</code> <strong class="purple">must</strong> be a null-terminated UTF-8 string whose length is less than or equal to XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -34871,7 +34886,7 @@ applications on the HoloLens.</p>
|
|||
<div class="paragraph">
|
||||
<p>The session state of a holographic window-backed <a href="#XrSession">XrSession</a> will only reach
|
||||
<code>XR_SESSION_STATE_VISIBLE</code> when the provided CoreWindow is made visible.
|
||||
If the CoreWindow is for a secondary app view, the application must programatically request to make
|
||||
If the CoreWindow is for a secondary app view, the application must programmatically request to make
|
||||
the CoreWindow visible (e.g. with ApplicationViewSwitcher.TryShowAsStandaloneAsync or
|
||||
ApplicationViewSwitcher.SwitchAsync).</p>
|
||||
</div>
|
||||
|
@ -34907,21 +34922,27 @@ otherwise the call <strong class="purple">may</strong> deadlock.</p>
|
|||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_sample_code_2"><a class="anchor" href="#_sample_code_2"></a>12.32.1. Sample code</h4>
|
||||
<div class="paragraph">
|
||||
<p>Following example demos the usage of holographic window attachment and
|
||||
use the attached CoreWindow to receive keyboard input,
|
||||
use CoreTextEditContext to hand text typing experience,
|
||||
and use IActivatedEventArgs to handle protocol launching arguments.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="prettyprint highlight linenums"><code data-lang="c++">// [...]
|
||||
|
||||
struct AppView : implements<AppView, IFrameworkViewSource, IFrameworkView> {
|
||||
IFrameworkView CreateView() {
|
||||
return *this;
|
||||
}
|
||||
|
||||
<pre class="prettyprint highlight linenums"><code data-lang="c++">struct AppView : implements<AppView, IFrameworkView> {
|
||||
void Initialize(CoreApplicationView const& applicationView) {
|
||||
applicationView.Activated({this, &AppView::OnActivated});
|
||||
}
|
||||
|
||||
void Load(winrt::hstring const& entryPoint) {
|
||||
}
|
||||
|
||||
void Uninitialize() {
|
||||
}
|
||||
|
||||
void Run() {
|
||||
// The HolographicSpace must be created before the window is activated.
|
||||
// Creating a HolographicSpace before activating the CoreWindow to make it a holographic window
|
||||
CoreWindow window = CoreWindow::GetForCurrentThread();
|
||||
HolographicSpace holographicSpace = Windows::Graphics::Holographic::HolographicSpace::CreateForCoreWindow(window);
|
||||
window.Activate();
|
||||
|
@ -34940,10 +34961,8 @@ struct AppView : implements<AppView, IFrameworkViewSource, IFrameworkView>
|
|||
XrSession session;
|
||||
CHECK_XRCMD(xrCreateSession(instance, &sessionCreateInfo, &session));
|
||||
|
||||
CoreDispatcher dispatcher = window.Dispatcher();
|
||||
|
||||
while (!m_windowClosed) {
|
||||
dispatcher.ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
|
||||
window.Dispatcher().ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
|
||||
|
||||
// [OpenXR calls: Poll events, sync actions, render, and submit frames].
|
||||
}
|
||||
|
@ -34952,8 +34971,12 @@ struct AppView : implements<AppView, IFrameworkViewSource, IFrameworkView>
|
|||
void SetWindow(CoreWindow const& window) {
|
||||
window.Closed({this, &AppView::OnWindowClosed});
|
||||
window.KeyDown({this, &AppView::OnKeyDown});
|
||||
window.KeyUp({this, &AppView::OnKeyUp});
|
||||
window.Dispatcher().AcceleratorKeyActivated({this, &AppView::OnAcceleratorKey});
|
||||
|
||||
// This sample customizes the text input pane with manual display policy and email address scope.
|
||||
windows::CoreTextServicesManager manager = windows::CoreTextServicesManager::GetForCurrentView();
|
||||
windows::CoreTextEditContext editingContext = manager.CreateEditContext();
|
||||
editingContext.InputPaneDisplayPolicy(windows::CoreTextInputPaneDisplayPolicy::Manual);
|
||||
editingContext.InputScope(windows::CoreTextInputScope::EmailAddress);
|
||||
}
|
||||
|
||||
void OnWindowClosed(CoreWindow const& sender, CoreWindowEventArgs const& args) {
|
||||
|
@ -34964,23 +34987,17 @@ struct AppView : implements<AppView, IFrameworkViewSource, IFrameworkView>
|
|||
// [Process key down]
|
||||
}
|
||||
|
||||
void OnKeyUp(CoreWindow const& sender, KeyEventArgs const& args) {
|
||||
// [Process key up]
|
||||
}
|
||||
|
||||
void OnAcceleratorKey(CoreDispatcher const& sender, AcceleratorKeyEventArgs const& args) {
|
||||
// [Process accelerator keys]
|
||||
}
|
||||
|
||||
void OnActivated(CoreApplicationView const&, IActivatedEventArgs const& args) {
|
||||
// Example handling file activation.
|
||||
if (FileActivatedEventArgs fileActivationArgs = args.try_as<FileActivatedEventArgs>()) {
|
||||
// [Process file activation]
|
||||
if (args.Kind() == windows::ActivationKind::Protocol) {
|
||||
auto eventArgs{args.as<windows::ProtocolActivatedEventArgs>()};
|
||||
// Use the protocol activation parameters in eventArgs.Uri();
|
||||
}
|
||||
|
||||
// Example of inspecting
|
||||
if (!HolographicApplicationPreview::IsHolographicActivation(args)) {
|
||||
// [Handle activation differently. For example, show a 2D XAML UI instead of starting an OpenXR session]
|
||||
// Inspecting whether the application is launched from within holographic shell or from desktop.
|
||||
if (windows::HolographicApplicationPreview::IsHolographicActivation(args)) {
|
||||
// App activation is targeted at the holographic shell.
|
||||
} else {
|
||||
// App activation is targeted at the desktop.
|
||||
}
|
||||
|
||||
// NOTE: CoreWindow is activated later after the HolographicSpace has been created.
|
||||
|
@ -34989,8 +35006,14 @@ struct AppView : implements<AppView, IFrameworkViewSource, IFrameworkView>
|
|||
bool m_windowClosed{false};
|
||||
};
|
||||
|
||||
struct AppViewSource : winrt::implements<AppViewSource, IFrameworkViewSource> {
|
||||
windows::IFrameworkView CreateView() {
|
||||
return winrt::make<AppView>();
|
||||
}
|
||||
};
|
||||
|
||||
int __stdcall wWinMain(HINSTANCE, HINSTANCE, PWSTR, int) {
|
||||
CoreApplication::Run(make<AppView>());
|
||||
CoreApplication::Run(make<AppViewSource>());
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace {
|
|||
|
||||
void OnActivated(windows::CoreApplicationView const&, windows::IActivatedEventArgs const& args) {
|
||||
if (args.Kind() == windows::ActivationKind::Protocol) {
|
||||
auto eventArgs{args.as<windows::ProtocolActivatedEventArgs>()};
|
||||
windows::ProtocolActivatedEventArgs eventArgs{args.as<windows::ProtocolActivatedEventArgs>()};
|
||||
sample::Trace("Protocol uri : {}", winrt::to_string(eventArgs.Uri().RawUri()).c_str());
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ namespace {
|
|||
|
||||
// Creating a HolographicSpace before activating the CoreWindow to make it a holographic window
|
||||
windows::CoreWindow window = windows::CoreWindow::GetForCurrentThread();
|
||||
auto holographicSpace = windows::HolographicSpace::CreateForCoreWindow(window);
|
||||
windows::HolographicSpace holographicSpace = windows::HolographicSpace::CreateForCoreWindow(window);
|
||||
window.Activate();
|
||||
|
||||
XrHolographicWindowAttachmentMSFT holographicWindowAttachment{XR_TYPE_HOLOGRAPHIC_WINDOW_ATTACHMENT_MSFT};
|
||||
|
@ -118,8 +118,8 @@ namespace {
|
|||
|
||||
void InitializeTextEditingContext() {
|
||||
// This sample customizes the text input pane with manual display policy and email address scope.
|
||||
auto manager = windows::CoreTextServicesManager::GetForCurrentView();
|
||||
auto editingContext = manager.CreateEditContext();
|
||||
windows::CoreTextServicesManager manager = windows::CoreTextServicesManager::GetForCurrentView();
|
||||
windows::CoreTextEditContext editingContext = manager.CreateEditContext();
|
||||
editingContext.InputPaneDisplayPolicy(windows::CoreTextInputPaneDisplayPolicy::Manual);
|
||||
editingContext.InputScope(windows::CoreTextInputScope::EmailAddress);
|
||||
}
|
||||
|
|
|
@ -222,9 +222,7 @@ bool ProjectionLayer::Render(SceneContext& sceneContext,
|
|||
projectionViews[viewIndex].subImage.imageRect = viewConfigComponent.LayerColorImageRect[viewIndex];
|
||||
|
||||
D3D11_VIEWPORT viewport = viewports[viewIndex];
|
||||
if (!currentConfig.SubmitDepthInfo) {
|
||||
projectionViews[viewIndex].next = nullptr;
|
||||
} else {
|
||||
if (currentConfig.SubmitDepthInfo && sceneContext.Extensions.SupportsDepthInfo) {
|
||||
depthInfo[viewIndex] = {XR_TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR};
|
||||
depthInfo[viewIndex].minDepth = viewport.MinDepth = normalizedViewportMinDepth;
|
||||
depthInfo[viewIndex].maxDepth = viewport.MaxDepth = normalizedViewportMaxDepth;
|
||||
|
@ -235,6 +233,8 @@ bool ProjectionLayer::Render(SceneContext& sceneContext,
|
|||
depthInfo[viewIndex].subImage.imageRect = viewConfigComponent.LayerDepthImageRect[viewIndex];
|
||||
|
||||
projectionViews[viewIndex].next = &depthInfo[viewIndex];
|
||||
} else {
|
||||
projectionViews[viewIndex].next = nullptr;
|
||||
}
|
||||
|
||||
// Render for this view pose.
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace {
|
|||
std::vector<std::unique_ptr<Scene>> m_scenes;
|
||||
|
||||
std::atomic<bool> m_sessionRunning{false};
|
||||
std::atomic<bool> m_appForceStop{false};
|
||||
std::atomic<bool> m_abortFrameLoop{false};
|
||||
bool m_actionBindingsFinalized{false};
|
||||
|
||||
std::thread m_renderThread;
|
||||
|
@ -269,14 +269,14 @@ namespace {
|
|||
void ImplementXrApp::Run() {
|
||||
::SetThreadDescription(::GetCurrentThread(), L"App Thread");
|
||||
|
||||
m_appForceStop = false;
|
||||
m_abortFrameLoop = false;
|
||||
while (Step()) {
|
||||
}
|
||||
}
|
||||
|
||||
bool ImplementXrApp::Step() {
|
||||
if (!ProcessEvents()) {
|
||||
return false;
|
||||
if (m_abortFrameLoop || !ProcessEvents()) {
|
||||
return false; // quit frame loop
|
||||
}
|
||||
|
||||
// Defer action bindings until the first game step.
|
||||
|
@ -298,7 +298,7 @@ namespace {
|
|||
std::this_thread::sleep_for(0.1s);
|
||||
}
|
||||
|
||||
return !m_appForceStop;
|
||||
return true; // continue frame loop
|
||||
}
|
||||
|
||||
void ImplementXrApp::NotifyFrameRenderThread() {
|
||||
|
@ -335,20 +335,28 @@ namespace {
|
|||
if (m_renderThreadRunning.compare_exchange_strong(alreadyRunning, true)) {
|
||||
m_frameReadyToRender = false; // Always wait for xrWaitFrame before begin rendering frames.
|
||||
m_renderThread = std::thread([this]() {
|
||||
::SetThreadDescription(::GetCurrentThread(), L"Render Thread");
|
||||
try {
|
||||
::SetThreadDescription(::GetCurrentThread(), L"Render Thread");
|
||||
|
||||
while (m_renderThreadRunning && m_sessionRunning) {
|
||||
{
|
||||
std::unique_lock lock(m_frameReadyToRenderMutex);
|
||||
m_frameReadyToRenderNotify.wait(lock, [this] { return m_frameReadyToRender; });
|
||||
m_frameReadyToRender = false;
|
||||
while (m_renderThreadRunning && m_sessionRunning) {
|
||||
{
|
||||
std::unique_lock lock(m_frameReadyToRenderMutex);
|
||||
m_frameReadyToRenderNotify.wait(lock, [this] { return m_frameReadyToRender; });
|
||||
m_frameReadyToRender = false;
|
||||
}
|
||||
|
||||
if (!m_renderThreadRunning || !m_sessionRunning) {
|
||||
break; // check again after waiting
|
||||
}
|
||||
|
||||
RenderFrame();
|
||||
}
|
||||
|
||||
if (!m_renderThreadRunning || !m_sessionRunning) {
|
||||
break; // check again after waiting
|
||||
}
|
||||
|
||||
RenderFrame();
|
||||
} catch (const std::exception& ex) {
|
||||
sample::Trace("Render thread exception: {}", ex.what());
|
||||
m_abortFrameLoop = true;
|
||||
} catch (...) {
|
||||
sample::Trace(L"Render thread exception");
|
||||
m_abortFrameLoop = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -373,7 +381,7 @@ namespace {
|
|||
if (m_sessionRunning) {
|
||||
CHECK_XRCMD(xrRequestExitSession(SceneContext().Session.Handle));
|
||||
} else {
|
||||
m_appForceStop = true; // quit app message loop
|
||||
m_abortFrameLoop = true; // quit app frame loop
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace xr {
|
|||
}
|
||||
}
|
||||
|
||||
auto isExtensionEnabled = [& list = extensions.EnabledExtensions](const char* extensionName) -> bool {
|
||||
auto isExtensionEnabled = [&list = extensions.EnabledExtensions](const char* extensionName) -> bool {
|
||||
return list.end() !=
|
||||
std::find_if(list.begin(), list.end(), [&extensionName](auto&& i) { return 0 == strcmp(i, extensionName); });
|
||||
};
|
||||
|
|
|
@ -80,7 +80,8 @@ namespace xr {
|
|||
|
||||
// WideCharToMultiByte returns number of chars of the input buffer, regardless of null terminitor
|
||||
narrowText.resize(narrowLength, 0);
|
||||
const int length = ::WideCharToMultiByte(CP_UTF8, 0, wideText.data(), (int)wideText.size(), narrowText.data(), narrowLength, nullptr, nullptr);
|
||||
const int length =
|
||||
::WideCharToMultiByte(CP_UTF8, 0, wideText.data(), (int)wideText.size(), narrowText.data(), narrowLength, nullptr, nullptr);
|
||||
if (length != narrowLength) {
|
||||
DEBUG_PRINT("wide_to_utf8 convert string error: {}", ::GetLastError());
|
||||
return {};
|
||||
|
|
|
@ -63,3 +63,4 @@ namespace xr {
|
|||
MAKE_TO_CSTRING_FUNC(XrHandJointEXT);
|
||||
MAKE_TO_STRING_FUNCS(XrVisibilityMaskTypeKHR);
|
||||
} // namespace xr
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче