API Documentation
Loading...
Searching...
No Matches
VulkanGraphicsWindow.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: NDEVR
28File: QTGraphicsWindow
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
38#include <QWidget>
39#include <QWindow>
40#include <QAbstractScrollArea>
41class QVulkanInstance;
42struct VkSurfaceKHR_T;
43namespace NDEVR
44{
45 class Renderer;
46 class BasicThread;
47 class BasicResourceListener;
48 class QTResourceListener;
49 /**--------------------------------------------------------------------------------------------------
50 \brief A QTGraphicsWindow for rendering using Vulkan.
51 **/
53 {
54 Q_OBJECT
55 public:
56 explicit VulkanGraphicsWindow(QWindow* parent, Qt::WindowFlags flags);
58 void setModelManager(QTModelManager* manager, bool auto_add_models) override;
59 virtual void initialize() override;
60 void* getSurface() override;
61 void finishFrame(GraphicsUpdateArguments& args) final override;
62 void updateInstance() override;
63 public:
64 static void SetupVulkanInstance(QTModelManager* manager);
65 static QVulkanInstance* DefaultQTVulkanInstance();
66 private:
67#ifdef MAC_OS_X_VERSION_10_0
68 VkSurfaceKHR_T* m_mac_os_surface = nullptr;
69#endif
70 QVulkanInstance* m_qt_instance = nullptr;
71 };
72 /**--------------------------------------------------------------------------------------------------
73 \brief Provides the interface for automatically creating VulkanGraphicsWindow when the request for
74 a VirtualCameraView is sent through
75 **/
77 {
78 public:
79 virtual VirtualCameraView* createView(const DynamicPointer<Camera>& camera, DesignObjectLookup* model_manager, bool auto_add_models = true, QWidget* parent = nullptr) override
80 {
81 QTModelManager* qt_model_manager = dynamic_cast<QTModelManager*>(model_manager);
82 if (qt_model_manager == nullptr)
83 return nullptr;
85 //window->setModelManager(model_manager, auto_add_models);
86 //window->setCamera(camera->uuid());
87 QTGraphicsWidget* widget = new QTGraphicsWidget(window, parent);
88 VirtualCameraView* view = new VirtualCameraView(widget, parent);
89 view->setModelManager(qt_model_manager, auto_add_models);
90 view->setCamera(camera);
91 return view;
92 }
93 virtual bool canCreateView(const DynamicPointer<Camera>& camera, DesignObjectLookup* model_manager) override
94 {
95 if (camera->getProperty<File>(DesignObject::e_file).size() > 0)
96 return false;
97 if (model_manager)
98 {
99 QTModelManager* qt_model_manager = dynamic_cast<QTModelManager*>(model_manager);
100 if (qt_model_manager == nullptr)
101 return false;
102 return qt_model_manager->graphicsManager() != nullptr;
103 }
104 return false;
105 }
106 virtual void resetToDefaults() override
107 {
108 }
109 };
110
111}
112
constexpr t_index_type size() const
Definition Buffer.hpp:823
@ e_file
Definition DesignObject.h:115
A core class where all Design Objects including models, materials, and geometries are stored....
Definition DesignObjectLookup.h:65
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
Logic for reading or writing to a file as well as navigating filesystems.
Definition File.h:48
Options that are used for performing an update on a Graphics Engine call.
Definition GraphicsUpdateArguments.h:43
A Widget wrapper around a QTGraphicsWindow that allows it to be used inside the UI framework.
Definition QtGraphicsWindow.h:132
A Window used to render 3D graphics. This container allows for a different graphics backend to be use...
Definition QtGraphicsWindow.h:58
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Definition QTModelManager.h:105
GraphicsManagerBase * graphicsManager()
A service which can generate Viewports based on Camera data.
Definition ViewportFactory.h:11
A Viewport for rendering 3D objects in the scene with the NDEVR Graphics Engine. Users interact with ...
Definition VirtualCameraView.h:66
void setModelManager(QTModelManager *manager, bool auto_add_models)
void setCamera(const DynamicPointer< Camera > &camera)
Provides the interface for automatically creating VulkanGraphicsWindow when the request for a Virtual...
Definition VulkanGraphicsWindow.h:77
virtual void resetToDefaults() override
Definition VulkanGraphicsWindow.h:106
virtual VirtualCameraView * createView(const DynamicPointer< Camera > &camera, DesignObjectLookup *model_manager, bool auto_add_models=true, QWidget *parent=nullptr) override
Definition VulkanGraphicsWindow.h:79
virtual bool canCreateView(const DynamicPointer< Camera > &camera, DesignObjectLookup *model_manager) override
Definition VulkanGraphicsWindow.h:93
A QTGraphicsWindow for rendering using Vulkan.
Definition VulkanGraphicsWindow.h:53
static QVulkanInstance * DefaultQTVulkanInstance()
VulkanGraphicsWindow(QWindow *parent, Qt::WindowFlags flags)
static void SetupVulkanInstance(QTModelManager *manager)
void setModelManager(QTModelManager *manager, bool auto_add_models) override
virtual void initialize() override
void * getSurface() override
void updateInstance() override
void finishFrame(GraphicsUpdateArguments &args) final override
static Qt::WindowFlags windowFlags()
Definition WindowContainer.h:58
Definition ACIColor.h:37