Skip to content

Commit ce1b91e

Browse files
authored
Add "engine" namespace to XrSceneLib, rename SceneObject to … (#51)
* Add "engine" namespace to XrSceneLib, rename SceneObject to engine::Object and SceneContext to engine::Context. * Fixed crash in an rare condition in controller object. * Hand result from xrLoadControllerModelMSFT properly * Update openxr loader nuget to latest
1 parent f049f97 commit ce1b91e

59 files changed

Lines changed: 1053 additions & 982 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

openxr_preview/specs/openxr.html

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ <h1>The OpenXR Specification</h1>
444444
<div class="details">
445445
<span id="author" class="author">Copyright (c) 2017-2020 The Khronos Group Inc.</span><br>
446446
<span id="revnumber">version 1.0.9,</span>
447-
<span id="revdate">Mon, 22 Jun 2020 18:45:31 +0000</span>
448-
<br><span id="revremark">from git branch: master commit: 3ad53cba1e21504eedd74b88a286277bdcb10898</span>
447+
<span id="revdate">Wed, 22 Jul 2020 06:49:16 +0000</span>
448+
<br><span id="revremark">from git branch: commit: 3b9357a606759084d369450d3278824e5f738472</span>
449449
</div>
450450
<div id="toc" class="toc2">
451451
<div id="toctitle">Table of Contents</div>
@@ -29917,7 +29917,7 @@ <h3 id="XR_EXT_hand_tracking"><a class="anchor" href="#XR_EXT_hand_tracking"></a
2991729917
XrHandJointLocationEXT jointLocations[XR_HAND_JOINT_COUNT_EXT];
2991829918
XrHandJointVelocityEXT jointVelocities[XR_HAND_JOINT_COUNT_EXT];
2991929919

29920-
XrHandJointVelocitiesEXT velocities{XR_TYPE_HAND_JOINT_LOCATIONS_EXT};
29920+
XrHandJointVelocitiesEXT velocities{XR_TYPE_HAND_JOINT_VELOCITIES_EXT};
2992129921
velocities.jointCount = XR_HAND_JOINT_COUNT_EXT;
2992229922
velocities.jointVelocities = jointVelocities;
2992329923

@@ -35266,10 +35266,9 @@ <h4 id="_secondary_view_configuration_properties"><a class="anchor" href="#_seco
3526635266
<h4 id="_enable_secondary_view_configuration"><a class="anchor" href="#_enable_secondary_view_configuration"></a>12.33.4. Enable secondary view configuration</h4>
3526735267
<div class="paragraph">
3526835268
<p>The application indicates to the runtime which secondary view configurations
35269-
it can support by enabling them during the call to <a href="#xrBeginSession">xrBeginSession</a> by
35270-
attaching the extension structure
35271-
<a href="#XrSecondaryViewConfigurationSessionBeginInfoMSFT">XrSecondaryViewConfigurationSessionBeginInfoMSFT</a> to the
35272-
<a href="#XrSessionBeginInfo">XrSessionBeginInfo</a>::<code>next</code> pointer.</p>
35269+
it can support by chaining an
35270+
<a href="#XrSecondaryViewConfigurationSessionBeginInfoMSFT">XrSecondaryViewConfigurationSessionBeginInfoMSFT</a> structure to the
35271+
<a href="#XrSessionBeginInfo">XrSessionBeginInfo</a>::<code>next</code> pointer when calling <a href="#xrBeginSession">xrBeginSession</a>.</p>
3527335272
</div>
3527435273
<div class="openblock">
3527535274
<div class="content">
@@ -40460,7 +40459,7 @@ <h4 id="_contributors_to_openxr_1_0"><a class="anchor" href="#_contributors_to_o
4046040459
<div id="footer">
4046140460
<div id="footer-text">
4046240461
Version 1.0.9<br>
40463-
Last updated 2020-05-29 13:03:07 -0700
40462+
Last updated 2020-07-20 12:29:21 -0700
4046440463
</div>
4046540464
</div>
4046640465
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css">

samples/BasicXrApp/BasicXrApp_uwp.vcxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.props" Condition="Exists('..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.props')" />
3+
<Import Project="..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.props" Condition="Exists('..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.props')" />
44
<ItemGroup Label="ProjectConfigurations">
55
<ProjectConfiguration Include="Debug|ARM">
66
<Configuration>Debug</Configuration>
@@ -161,13 +161,13 @@
161161
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.targets" />
162162
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.targets" />
163163
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ShaderGraphContentTask.targets" />
164-
<Import Project="..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.targets" Condition="Exists('..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.targets')" />
164+
<Import Project="..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.targets" Condition="Exists('..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.targets')" />
165165
</ImportGroup>
166166
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
167167
<PropertyGroup>
168168
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
169169
</PropertyGroup>
170-
<Error Condition="!Exists('..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.props'))" />
171-
<Error Condition="!Exists('..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.targets'))" />
170+
<Error Condition="!Exists('..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.props'))" />
171+
<Error Condition="!Exists('..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.targets'))" />
172172
</Target>
173173
</Project>

samples/BasicXrApp/BasicXrApp_win32.vcxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.props" Condition="Exists('..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.props')" />
3+
<Import Project="..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.props" Condition="Exists('..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.props')" />
44
<ItemGroup Label="ProjectConfigurations">
55
<ProjectConfiguration Include="Debug|Win32">
66
<Configuration>Debug</Configuration>
@@ -113,13 +113,13 @@
113113
</ItemGroup>
114114
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
115115
<ImportGroup Label="ExtensionTargets">
116-
<Import Project="..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.targets" Condition="Exists('..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.targets')" />
116+
<Import Project="..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.targets" Condition="Exists('..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.targets')" />
117117
</ImportGroup>
118118
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
119119
<PropertyGroup>
120120
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
121121
</PropertyGroup>
122-
<Error Condition="!Exists('..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.props'))" />
123-
<Error Condition="!Exists('..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.targets'))" />
122+
<Error Condition="!Exists('..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.props'))" />
123+
<Error Condition="!Exists('..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.targets'))" />
124124
</Target>
125125
</Project>

samples/BasicXrApp/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="OpenXR.Loader" version="1.0.6.2" targetFramework="native" />
3+
<package id="OpenXR.Loader" version="1.0.10" targetFramework="native" />
44
</packages>

samples/EyeGazeInteractionUwp/EyeGazeInteractionUwp.vcxproj

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.props" Condition="Exists('..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.props')" />
3+
<Import Project="..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.props" Condition="Exists('..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.props')" />
44
<ItemGroup Label="ProjectConfigurations">
55
<ProjectConfiguration Include="Debug|ARM">
66
<Configuration>Debug</Configuration>
@@ -137,11 +137,9 @@
137137
<PrecompiledHeader>Create</PrecompiledHeader>
138138
</ClCompile>
139139
</ItemGroup>
140-
<ItemGroup>
141-
<None Include="TemporaryKey.pfx" />
142-
</ItemGroup>
143140
<ItemGroup>
144141
<None Include="packages.config" />
142+
<None Include="TemporaryKey.pfx" />
145143
</ItemGroup>
146144
<ItemGroup>
147145
<AppxManifest Include="Package.appxmanifest" Condition="'$(LinkCompiled)'!='false'">
@@ -155,13 +153,13 @@
155153
</ItemGroup>
156154
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
157155
<ImportGroup Label="ExtensionTargets">
158-
<Import Project="..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.targets" Condition="Exists('..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.targets')" />
156+
<Import Project="..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.targets" Condition="Exists('..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.targets')" />
159157
</ImportGroup>
160158
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
161159
<PropertyGroup>
162160
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
163161
</PropertyGroup>
164-
<Error Condition="!Exists('..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.props'))" />
165-
<Error Condition="!Exists('..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\OpenXR.Loader.1.0.6.2\build\native\OpenXR.Loader.targets'))" />
162+
<Error Condition="!Exists('..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.props'))" />
163+
<Error Condition="!Exists('..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\OpenXR.Loader.1.0.10\build\native\OpenXR.Loader.targets'))" />
166164
</Target>
167165
</Project>

samples/EyeGazeInteractionUwp/EyeGazeInteractionUwp.vcxproj.filters

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<ClInclude Include="pch.h" />
1010
</ItemGroup>
1111
<ItemGroup>
12-
<None Include="packages.config" />
1312
<None Include="TemporaryKey.pfx" />
1413
<None Include="$(OpenXRLoaderBinaryRoot)\bin\openxr_loader.dll" />
14+
<None Include="packages.config" />
1515
</ItemGroup>
1616
<ItemGroup>
1717
<Filter Include="DeploymentContent">

samples/EyeGazeInteractionUwp/Main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@
1616
#include "pch.h"
1717
#include <XrSceneLib/XrApp.h>
1818

19-
std::unique_ptr<Scene> TryCreateTitleScene(SceneContext& sceneContext);
20-
std::unique_ptr<Scene> TryCreateEyeGazeInteractionScene(SceneContext& sceneContext);
19+
std::unique_ptr<engine::Scene> TryCreateTitleScene(engine::Context& context);
20+
std::unique_ptr<engine::Scene> TryCreateEyeGazeInteractionScene(engine::Context& context);
2121

2222
int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) {
2323
try {
2424
CHECK_HRCMD(::CoInitializeEx(nullptr, COINIT_MULTITHREADED));
2525
auto on_exit = MakeScopeGuard([] { ::CoUninitialize(); });
2626

27-
XrAppConfiguration appConfig({"EyeGazeInteractionUwp", 1});
27+
engine::XrAppConfiguration appConfig({"EyeGazeInteractionUwp", 1});
2828
appConfig.RequestedExtensions.push_back(XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME);
2929

3030
auto app = CreateXrApp(appConfig);
31-
app->AddScene(TryCreateTitleScene(app->SceneContext()));
32-
app->AddScene(TryCreateEyeGazeInteractionScene(app->SceneContext()));
31+
app->AddScene(TryCreateTitleScene(app->Context()));
32+
app->AddScene(TryCreateEyeGazeInteractionScene(app->Context()));
3333
app->Run();
3434
} catch (const std::exception& ex) {
3535
sample::Trace("Unhandled Exception: {}", ex.what());

samples/EyeGazeInteractionUwp/Scene_EyeGazeInteraction.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ namespace {
4040
return projectionOnZ < -std::cos(angleTolerance);
4141
}
4242

43-
struct EyeGazeInteractionScene : public Scene {
44-
EyeGazeInteractionScene(SceneContext& sceneContext)
45-
: Scene(sceneContext) {
46-
const bool supportsEyeGazeAction = sceneContext.Extensions.SupportsEyeGazeInteraction &&
47-
sceneContext.System.EyeGazeInteractionProperties.supportsEyeGazeInteraction;
43+
struct EyeGazeInteractionScene : public engine::Scene {
44+
EyeGazeInteractionScene(engine::Context& context)
45+
: Scene(context) {
46+
const bool supportsEyeGazeAction = context.Extensions.SupportsEyeGazeInteraction &&
47+
context.System.EyeGazeInteractionProperties.supportsEyeGazeInteraction;
4848
if (supportsEyeGazeAction) {
4949
xr::ActionSet& actionSet =
5050
ActionContext().CreateActionSet("eye_gaze_interaction_scene_actions", "Eye Gaze Interaction Scene Actions");
@@ -59,19 +59,19 @@ namespace {
5959
XrActionSpaceCreateInfo createInfo{XR_TYPE_ACTION_SPACE_CREATE_INFO};
6060
createInfo.action = gazeAction;
6161
createInfo.poseInActionSpace = Pose::Identity();
62-
CHECK_XRCMD(xrCreateActionSpace(m_sceneContext.Session.Handle, &createInfo, m_gazeSpace.Put()));
62+
CHECK_XRCMD(xrCreateActionSpace(m_context.Session.Handle, &createInfo, m_gazeSpace.Put()));
6363
} else {
6464
// Use VIEW reference space to simulate eye gaze when the system doesn't support
6565
XrReferenceSpaceCreateInfo createInfo{XR_TYPE_REFERENCE_SPACE_CREATE_INFO};
6666
createInfo.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_VIEW;
6767
createInfo.poseInReferenceSpace = Pose::Identity();
68-
CHECK_XRCMD(xrCreateReferenceSpace(m_sceneContext.Session.Handle, &createInfo, m_gazeSpace.Put()));
68+
CHECK_XRCMD(xrCreateReferenceSpace(m_context.Session.Handle, &createInfo, m_gazeSpace.Put()));
6969
}
7070

71-
m_gazeObject = AddSceneObject(CreateSceneObject());
71+
m_gazeObject = AddObject(engine::CreateObject());
7272

7373
// Draw a small axis object 2 meters in front to visualize the orientation of gaze
74-
m_gazeLookAtAxis = AddSceneObject(CreateAxis(m_sceneContext.PbrResources, 0.05f));
74+
m_gazeLookAtAxis = AddObject(engine::CreateAxis(m_context.PbrResources, 0.05f));
7575
m_gazeLookAtAxis->Pose() = Pose::Translation({0, 0, -2});
7676
m_gazeLookAtAxis->SetParent(m_gazeObject);
7777

@@ -83,17 +83,17 @@ namespace {
8383
// Draw a circle of objects around the user, and they will rotate when user is looking at them.
8484
const float angleDistance = XM_2PI / numberOfObjects;
8585
for (int i = 0; i < numberOfObjects; i++) {
86-
auto object = AddSceneObject(CreateSphere(m_sceneContext.PbrResources, objectDiameter, 3, randomColor()));
86+
auto object = AddObject(engine::CreateSphere(m_context.PbrResources, objectDiameter, 3, randomColor()));
8787
object->Pose().position.x = layoutRadius * std::sin(i * angleDistance);
8888
object->Pose().position.z = layoutRadius * std::cos(i * angleDistance);
8989
object->Motion.SetRotation({0, 0, 1}, XM_2PI); // Rotate around per second
9090
m_lookAtObjects.emplace_back(std::move(object));
9191
}
9292
}
9393

94-
void OnUpdate(const FrameTime& frameTime) override {
94+
void OnUpdate(const engine::FrameTime& frameTime) override {
9595
XrSpaceLocation location{XR_TYPE_SPACE_LOCATION};
96-
CHECK_XRCMD(xrLocateSpace(m_gazeSpace.Get(), m_sceneContext.SceneSpace, frameTime.PredictedDisplayTime, &location));
96+
CHECK_XRCMD(xrLocateSpace(m_gazeSpace.Get(), m_context.SceneSpace, frameTime.PredictedDisplayTime, &location));
9797

9898
if (Pose::IsPoseValid(location)) {
9999
m_gazeObject->SetVisible(true);
@@ -113,12 +113,12 @@ namespace {
113113

114114
private:
115115
xr::SpaceHandle m_gazeSpace;
116-
std::shared_ptr<SceneObject> m_gazeObject;
117-
std::shared_ptr<SceneObject> m_gazeLookAtAxis;
118-
std::vector<std::shared_ptr<SceneObject>> m_lookAtObjects;
116+
std::shared_ptr<engine::Object> m_gazeObject;
117+
std::shared_ptr<engine::Object> m_gazeLookAtAxis;
118+
std::vector<std::shared_ptr<engine::Object>> m_lookAtObjects;
119119
};
120120
} // namespace
121121

122-
std::unique_ptr<Scene> TryCreateEyeGazeInteractionScene(SceneContext& sceneContext) {
123-
return std::make_unique<EyeGazeInteractionScene>(sceneContext);
122+
std::unique_ptr<engine::Scene> TryCreateEyeGazeInteractionScene(engine::Context& context) {
123+
return std::make_unique<EyeGazeInteractionScene>(context);
124124
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="OpenXR.Loader" version="1.0.6.2" targetFramework="native" />
3+
<package id="OpenXR.Loader" version="1.0.10" targetFramework="native" />
44
</packages>

0 commit comments

Comments
 (0)