NDEVR
API Documentation
XRCameraView.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Widgets
28File: XRCameraView.h
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include "XRInterface/Headers/XRInstance.h"
35#include "XRInterface/Headers/XRErrorHandling.h"
36#include "XRInterface/Headers/XRVulkanPipeline.h"
37#include "VulkanGraphics/Headers/VulkanRenderPipeline.h"
38#include "VulkanGraphics/Headers/VulkanSession.h"
39#include "NDEVRGraphics/Headers/GraphicsUpdater.h"
40#include "NDEVRGraphics/Headers/Renderer.h"
41#include "NDEVR/Headers/QTModelManager.h"
42//#include "Widgets/Headers/PhysicalCameraView.h"
43#include "Design/Headers/Camera.h"
44#include "Design/Headers/WindowInstance.h"
45#include "Base/Headers/Pointer.hpp"
46#include "Base/Headers/File.h"
47#include "Base/Headers/BasicThread.h"
48#include "Base/Headers/Translator.h"
49#include <QObject>
50namespace NDEVR
51{
55 class XRPose
56 {
57 public:
58 static XrPosef Identity() {
59 XrPosef t{};
60 t.orientation.w = 1;
61 return t;
62 }
63
64 static XrPosef Translation(const XrVector3f& translation) {
65 XrPosef t = Identity();
66 t.position = translation;
67 return t;
68 }
69
70 static XrPosef RotateCCWAboutYAxis(float radians, XrVector3f translation) {
71 XrPosef t = Identity();
72 t.orientation.x = 0.f;
73 t.orientation.y = std::sin(radians * 0.5f);
74 t.orientation.z = 0.f;
75 t.orientation.w = std::cos(radians * 0.5f);
76 t.position = translation;
77 return t;
78 }
79 };
80
83 class XRSide {
84 public:
85 static constexpr const uint01 LEFT = 0;
86 static constexpr const uint01 RIGHT = 1;
87 static constexpr const uint01 COUNT = 2;
88 };
89 class Button;
90 class VlcWindow;
91 class Log;
92 class BasicThread;
96 class XR_INTERFACE_API XRCameraView : public QObject, public WindowInstance
97 {
98 Q_OBJECT
99 public:
100 XRCameraView(const DynamicPointer<Camera>& camera, const DynamicPointer<Camera>& reference_camera, QTModelManager* manager);
101 void setup(const DynamicPointer<VulkanXRDevice>& device, XrSession session, const XrViewConfigurationView& config_view);
102 void updateCamera(const XrCompositionLayerProjectionView& layerView);
103 void render();
104 const Vertex<3, fltp08>& initialOffset() { return m_initial_offset; };
105 void setInitialOffset(const Vertex<3, fltp08>& offset) { m_initial_offset = offset; }
106 XrInstance xrInstance() const { return m_device->xrInstance(); }
107 XrSystemId xrSystemID() const { return m_device->xrSystemID(); }
108 XrSwapchain xrSwapChain() { return m_pipeline->xrSwapChain(); }
109 void setEyePosition(LineSegment<3, fltp08>& eyes, uint01 node);
110
111 void init();
112 void setCurrentBlendMode(XrEnvironmentBlendMode blend_mode) { m_pipeline->setCurrentBlendMode(blend_mode); }
113 virtual void* getSurface() override { return vk_null; }
114 XrSession xrSession() const { return m_pipeline->xrSession(); }
115 virtual XrStructureType GetGraphicsBindingType() const { return XR_TYPE_GRAPHICS_BINDING_VULKAN2_KHR; }
116 virtual XrStructureType GetSwapchainImageType() const { return XR_TYPE_SWAPCHAIN_IMAGE_VULKAN2_KHR; }
117 protected:
118 Vertex<3, fltp08> m_initial_offset = Constant<Vertex<3, fltp08>>::Invalid;
119 DynamicPointer<XRVulkanPipeline> m_pipeline;
120 DynamicPointer<Camera> m_reference_camera;
121 DynamicPointer<Camera> m_camera;
122 QTModelManager* m_manager;
123 XrSession m_session;
124 XrViewConfigurationView m_config_view;
125 DynamicPointer<Renderer> m_renderer;
126 DynamicPointer<VulkanXRDevice> m_device;
127 };
128}
129
A thread that executes a user-provided callback function concurrently.
Definition BasicThread.h:47
A core widget that allows the user to click one of many button types.
Definition Button.h:68
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:356
Class: LineSegment.
Definition Line.hpp:52
Serves as the primary program interface for processes to report issues and allows any number of LogSt...
Definition Log.h:50
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
A point in N-dimensional space, used primarily for spatial location information.
Definition Vertex.hpp:44
virtual ConstPointer< Camera > camera() const
Returns a const pointer to the current camera.
WindowInstance()
Default constructor.
virtual void * getSurface() override
Returns a platform-specific pointer to the rendering surface.
A matrix-like class storing both offset and orientation.
OpenXR uses two viewports, one for the left eye and one for the right eye.
The primary namespace for the NDEVR SDK.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...