-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathOpenXrProgram.h
More file actions
57 lines (47 loc) · 2.43 KB
/
OpenXrProgram.h
File metadata and controls
57 lines (47 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//*********************************************************
// Copyright (c) Microsoft. All rights reserved.
//
// Apache 2.0 License
//
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
//*********************************************************
#pragma once
namespace sample {
struct Cube {
xr::SpaceHandle Space{};
std::optional<XrPosef> PoseInSpace{}; // Cube pose in above Space. Default to identity.
XrVector3f Scale{0.1f, 0.1f, 0.1f};
XrPosef PoseInScene = xr::math::Pose::Identity(); // Cube pose in the scene. Got updated every frame
};
struct IOpenXrProgram {
virtual ~IOpenXrProgram() = default;
virtual void Run() = 0;
};
struct IGraphicsPluginD3D11 {
virtual ~IGraphicsPluginD3D11() = default;
// Create an instance of this graphics api for the provided instance and systemId.
virtual ID3D11Device* InitializeDevice(LUID adapterLuid, const std::vector<D3D_FEATURE_LEVEL>& featureLevels) = 0;
// List of color pixel formats supported by this app.
virtual const std::vector<DXGI_FORMAT>& SupportedColorFormats() const = 0;
virtual const std::vector<DXGI_FORMAT>& SupportedDepthFormats() const = 0;
// Render to swapchain images using stereo image array
virtual void RenderView(const XrRect2Di& imageRect,
const float renderTargetClearColor[4],
const std::vector<xr::math::ViewProjection>& viewProjections,
DXGI_FORMAT colorSwapchainFormat,
ID3D11Texture2D* colorTexture,
DXGI_FORMAT depthSwapchainFormat,
ID3D11Texture2D* depthTexture,
const std::vector<const sample::Cube*>& cubes) = 0;
};
std::unique_ptr<IGraphicsPluginD3D11> CreateCubeGraphics();
std::unique_ptr<IOpenXrProgram> CreateOpenXrProgram(std::string applicationName, std::unique_ptr<IGraphicsPluginD3D11> graphicsPlugin);
} // namespace sample