API Documentation
Loading...
Searching...
No Matches
XRCameraView.h
Go to the documentation of this file.
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: PhysicalCameraView
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
42//#include "Widgets/Headers/PhysicalCameraView.h"
46#include "Base/Headers/File.h"
49#include <QObject>
50namespace NDEVR
51{
52 /**--------------------------------------------------------------------------------------------------
53 \brief A matrix-like class storing both offset and orientation
54 **/
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 /**--------------------------------------------------------------------------------------------------
81 \brief OpenXR uses two viewports, one for the left eye and one for the right eye.
82 **/
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;
93 /**--------------------------------------------------------------------------------------------------
94 \brief A view that allows interfacing with OpenXR for Augmented and virtual reality.
95 **/
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(); }
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 slots:
118 void addSceneObject(UUID camera_id, UUID model);
119 void addScene(Buffer<UUID> scenes);
120 void addModel(Buffer<UUID> models);
121 protected:
122 Vertex<3, fltp08> m_initial_offset = Constant<Vertex<3, fltp08>>::Invalid;
127 XrSession m_session;
128 XrViewConfigurationView m_config_view;
131 };
132}
133
#define vk_null
Definition VulkanDefines.h:11
#define XR_INTERFACE_API
Definition DLLInfo.h:59
A class that allows user to use a function inline to execute something.
Definition BasicThread.h:45
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
A core widget that allows the user to click one of many button types.
Definition Button.h:66
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
A line segment represented by two vertices, a start and end.
Definition Line.hpp:49
Serves as the primary program interface for processes to report issues and allows any number of LogSt...
Definition Log.h:48
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Definition QTModelManager.h:105
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
A vertex or point. A specific type of Vector used primarily for spacial location information.
Definition Vertex.hpp:48
A view that allows interfacing with OpenXR for Augmented and virtual reality.
Definition XRCameraView.h:97
void setCurrentBlendMode(XrEnvironmentBlendMode blend_mode)
Definition XRCameraView.h:112
DynamicPointer< VulkanXRDevice > m_device
Definition XRCameraView.h:130
XrSwapchain xrSwapChain()
Definition XRCameraView.h:108
XrViewConfigurationView m_config_view
Definition XRCameraView.h:128
XrSession xrSession() const
Definition XRCameraView.h:114
DynamicPointer< Renderer > m_renderer
Definition XRCameraView.h:129
XrSystemId xrSystemID() const
Definition XRCameraView.h:107
virtual XrStructureType GetGraphicsBindingType() const
Definition XRCameraView.h:115
XRCameraView(const DynamicPointer< Camera > &camera, const DynamicPointer< Camera > &reference_camera, QTModelManager *manager)
void updateCamera(const XrCompositionLayerProjectionView &layerView)
DynamicPointer< Camera > m_reference_camera
Definition XRCameraView.h:124
virtual XrStructureType GetSwapchainImageType() const
Definition XRCameraView.h:116
DynamicPointer< Camera > m_camera
Definition XRCameraView.h:125
DynamicPointer< XRVulkanPipeline > m_pipeline
Definition XRCameraView.h:123
void setInitialOffset(const Vertex< 3, fltp08 > &offset)
Definition XRCameraView.h:105
virtual void * getSurface() override
Definition XRCameraView.h:113
void addSceneObject(UUID camera_id, UUID model)
XrInstance xrInstance() const
Definition XRCameraView.h:106
QTModelManager * m_manager
Definition XRCameraView.h:126
void addScene(Buffer< UUID > scenes)
void setup(const DynamicPointer< VulkanXRDevice > &device, XrSession session, const XrViewConfigurationView &config_view)
XrSession m_session
Definition XRCameraView.h:127
void addModel(Buffer< UUID > models)
const Vertex< 3, fltp08 > & initialOffset()
Definition XRCameraView.h:104
void setEyePosition(LineSegment< 3, fltp08 > &eyes, uint01 node)
A matrix-like class storing both offset and orientation.
Definition XRCameraView.h:56
static XrPosef RotateCCWAboutYAxis(float radians, XrVector3f translation)
Definition XRCameraView.h:70
static XrPosef Translation(const XrVector3f &translation)
Definition XRCameraView.h:64
static XrPosef Identity()
Definition XRCameraView.h:58
OpenXR uses two viewports, one for the left eye and one for the right eye.
Definition XRCameraView.h:83
static constexpr const uint01 LEFT
Definition XRCameraView.h:85
static constexpr const uint01 COUNT
Definition XRCameraView.h:87
static constexpr const uint01 RIGHT
Definition XRCameraView.h:86
Definition ACIColor.h:37
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233