NDEVR
API Documentation
XRManager.h
1#pragma once
2#include "XRInterface/Headers/XRInstance.h"
3#include "XRInterface/Headers/XRErrorHandling.h"
4#include "XRInterface/Headers/XRVulkanPipeline.h"
5#include "XRInterface/Headers/XRCameraView.h"
6#include "NDEVR/Headers/QTModelManager.h"
7#include "NDEVR/Headers/WindowManager3D.h"
8#include "Design/Headers/CameraManager.h"
9#include <QObject>
10namespace NDEVR
11{
12 class DistanceMeasureModel;
13 class PointMeasureModel;
14 class XRHand;
15 class XRInputManager;
19 class XRManager
20 {
21 public:
22 XRManager(QTModelManager* manager);
23 void getAvialableBlendModes(XrViewConfigurationType type);
24 void InitializeSession();
25 void setupSession();
26 void createCameras();
27 void renderFrame();
28 bool renderLayer(XrTime predictedDisplayTime, Buffer<XrCompositionLayerProjectionView>& projectionLayerViews, XrCompositionLayerProjection& layer);
29 bool isSessionRunning() const { return m_session_running; }
30 bool isSessionFocused() const { return m_session_state == XR_SESSION_STATE_FOCUSED; }
31 XrEnvironmentBlendMode environmentBlendMode() { return m_current_blend_mode; }
32 void pollActions();
33 // Return event if one is available, otherwise return null.
34 const XrEventDataBaseHeader* tryReadNextEvent();
35 void pollEvents(bool* exitRenderLoop, bool* requestRestart);
36 void start();
37 void renderLoop();
38 void HandleSessionStateChangedEvent(const XrEventDataSessionStateChanged& stateChangedEvent, bool* exitRenderLoop, bool* requestRestart);
39 XrInstance xrInstance() const { return m_device->xrInstance(); }
40 XrSystemId xrSystemID() const { return m_device->xrSystemID(); }
41 XrSession xrSession() const { return m_xr_session; }
42 const XrBaseInStructure* graphicsBinding() const { return reinterpret_cast<const XrBaseInStructure*>(&m_device->graphicsBinding()); }
43 XrViewConfigurationType viewConfigType() const { return XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO; }
44 void setSessionEndFunction(std::function<void()> function) { m_session_end_function = function; }
45 void updateMovement();
46
47 Matrix<fltp08> globalTransform() const;
48 private:
49
50 XRInputManager* m_input_manager;
51
52 Vertex<3, fltp08> m_initial_offset = Constant<Vertex<3, fltp08>>::Invalid;
53 GraphicsUpdater* m_updater = nullptr;
54 DynamicPointer<Camera> m_reference_camera;
55 Buffer<XRCameraView*> m_cameras;
56 QTModelManager* m_manager;
57 Thread* m_thread;
58 std::function<void()> m_session_end_function;
59
61 XrSpace m_appSpace{ XR_NULL_HANDLE };
62
63 Buffer<XrEnvironmentBlendMode> m_available_blend_modes;
64 XrEnvironmentBlendMode m_current_blend_mode;
65
66 XrSession m_xr_session{ XR_NULL_HANDLE };
67 // Application's current lifecycle state according to the runtime
68 XrSessionState m_session_state{ XR_SESSION_STATE_UNKNOWN };
69
70 //Buffer<XrSpace> m_visualizedSpaces;
71 XrEventDataBuffer m_event_data_buffer;
72
73
75 Buffer<XRVulkanPipeline> m_pipelines;
76 Buffer<XrView> m_views;
77 fltp08 m_camera_speed;
78 Log* m_log = nullptr;
79 Time m_last_update_time;
80 bool m_session_running{ false };
81 };
82}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:356
Responsible for updating resources or layouts of data in-between calls to render.
Serves as the primary program interface for processes to report issues and allows any number of LogSt...
Definition Log.h:50
Templated logic for doing matrix multiplication.
Definition Matrix.hpp:182
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
The default thread class for executing concurrent sequences in the NDEVR API.
Definition Thread.h:113
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:62
A point in N-dimensional space, used primarily for spatial location information.
Definition Vertex.hpp:44
Support for a virtual hand, typically mirroring a user hand in the OpenXR space.
Definition XRHand.h:18
Translates input from the OpenXR interface into NDEVR API actions and events.
The primary namespace for the NDEVR SDK.
@ type
The type identifier string for this model node.
Definition Model.h:58
double fltp08
Defines an alias representing an 8 byte floating-point number.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...