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;
50 {
51 Q_OBJECT
52 public:
53 explicit VulkanGraphicsWindow(QWindow* parent, Qt::WindowFlags flags);
55 void setModelManager(QTModelManager* manager, bool auto_add_models) override;
56 virtual void initialize() override;
57 void* getSurface() override;
58 void finishFrame(GraphicsUpdateArguments& args) final override;
59 void updateInstance() override;
60 public:
61 static void SetupVulkanInstance(QTModelManager* manager);
62 static QVulkanInstance* DefaultQTVulkanInstance();
63 private:
64#ifdef MAC_OS_X_VERSION_10_0
65 VkSurfaceKHR_T* m_mac_os_surface = nullptr;
66#endif
67 QVulkanInstance* m_qt_instance = nullptr;
68 };
69
71 {
72 public:
73 virtual VirtualCameraView* createView(const DynamicPointer<Camera>& camera, DesignObjectLookup* model_manager, bool auto_add_models = true, QWidget* parent = nullptr) override
74 {
75 QTModelManager* qt_model_manager = dynamic_cast<QTModelManager*>(model_manager);
76 if (qt_model_manager == nullptr)
77 return nullptr;
79 //window->setModelManager(model_manager, auto_add_models);
80 //window->setCamera(camera->uuid());
81 QTGraphicsWidget* widget = new QTGraphicsWidget(window, parent);
82 VirtualCameraView* view = new VirtualCameraView(widget, parent);
83 view->setModelManager(qt_model_manager, auto_add_models);
84 view->setCamera(camera);
85 return view;
86 }
87 virtual bool canCreateView(const DynamicPointer<Camera>& camera, DesignObjectLookup* model_manager) override
88 {
89 if (camera->getProperty<File>(DesignObject::e_file).size() > 0)
90 return false;
91 if (model_manager)
92 {
93 QTModelManager* qt_model_manager = dynamic_cast<QTModelManager*>(model_manager);
94 if (qt_model_manager == nullptr)
95 return false;
96 return qt_model_manager->graphicsManager() != nullptr;
97 }
98 return false;
99 }
100 virtual void resetToDefaults() override
101 {
102 }
103 };
104
105}
106
constexpr t_index_type size() const
Definition Buffer.hpp:1461
@ e_file
Definition DesignObject.h:116
Definition DesignObjectLookup.h:61
Definition Pointer.hpp:303
Definition File.h:47
Definition GraphicsUpdateArguments.h:40
Definition QtGraphicsWindow.h:125
Definition QtGraphicsWindow.h:54
Definition QTModelManager.h:94
GraphicsManagerBase * graphicsManager()
Definition QTModelManager.cpp:847
Definition ViewportFactory.h:8
Definition VirtualCameraView.h:62
void setModelManager(QTModelManager *manager, bool auto_add_models)
Definition VirtualCameraView.cpp:612
void setCamera(const DynamicPointer< Camera > &camera)
Definition VirtualCameraView.cpp:577
Definition VulkanGraphicsWindow.h:71
virtual void resetToDefaults() override
Definition VulkanGraphicsWindow.h:100
virtual VirtualCameraView * createView(const DynamicPointer< Camera > &camera, DesignObjectLookup *model_manager, bool auto_add_models=true, QWidget *parent=nullptr) override
Definition VulkanGraphicsWindow.h:73
virtual bool canCreateView(const DynamicPointer< Camera > &camera, DesignObjectLookup *model_manager) override
Definition VulkanGraphicsWindow.h:87
Definition VulkanGraphicsWindow.h:50
VulkanGraphicsWindow(QWindow *parent, Qt::WindowFlags flags)
Definition VulkanGraphicsWindow.cpp:40
static QVulkanInstance * DefaultQTVulkanInstance()
Definition VulkanGraphicsWindow.cpp:200
void setModelManager(QTModelManager *manager, bool auto_add_models) override
Definition VulkanGraphicsWindow.cpp:66
virtual void initialize() override
Definition VulkanGraphicsWindow.cpp:52
~VulkanGraphicsWindow()
Definition VulkanGraphicsWindow.cpp:50
static void SetupVulkanInstance(QTModelManager *manager)
Definition VulkanGraphicsWindow.cpp:74
void * getSurface() override
Definition VulkanGraphicsWindow.cpp:119
void updateInstance() override
Definition VulkanGraphicsWindow.cpp:155
void finishFrame(GraphicsUpdateArguments &args) final override
Definition VulkanGraphicsWindow.cpp:111
static Qt::WindowFlags windowFlags()
Definition WindowContainer.h:52
Definition ACIColor.h:37