API Documentation
Loading...
Searching...
No Matches
QtGraphicsWindow.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
33#include "DLLInfo.h"
37#include <QWidget>
38#include <QWindow>
39class QVulkanInstance;
40struct VkSurfaceKHR_T;
41#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
42#include <QVulkanWindow>
43 typedef QVulkanWindow GraphicsWindowBase;
44#else
45 typedef QWindow GraphicsWindowBase;
46#endif
47namespace NDEVR
48{
49 class Renderer;
50 class BasicThread;
51 class BasicResourceListener;
52 class QTResourceListener;
53 class NDEVR_GRAPHICS_API QTGraphicsWindow : public QWindow, public WindowInstance
54 {
55 Q_OBJECT
56 friend class QTGraphicsWidget;
57 friend class RenderThread;
58 public:
59 //explicit QTGraphicsWindow(QWindow* parent, UUID camera, Log* log, QTModelManager* manager, Qt::WindowFlags flags);
60 explicit QTGraphicsWindow(const DynamicPointer<GraphicsDevice>& device, QWindow* parent, Qt::WindowFlags flags);
62
63 virtual void initialize();
64 void setCamera(const UUID& camera) override;
65 void exposeEvent(QExposeEvent* e) override;
66 void setAnimating(bool animating);
67 virtual bool visible() const override;
68 virtual void setModelManager(QTModelManager* manager, bool auto_add_models);
69 void resizeEvent(QResizeEvent *resize_event) override;
70 void finishFrame(GraphicsUpdateArguments& args) override;
71 void updateSize();
72 virtual bool shouldExit() const override;
73 QImage getImage() const;
74 void setExposed(bool exposed);
75 void flushBackingStore();
76 void pause(const TimeSpan& span);
77 const DynamicPointer<GraphicsDevice>& device() const;
78 public slots:
79 void contextMenu(const QPoint &pos);
80
81 void setSize(const Vector<2, uint04>& size) final override;
82 void addCameraObjectSlot(UUID camera_id, UUID model);
83 void addScene(Buffer<UUID> model);
84 void addModel(Buffer<UUID> model);
85 void clearModels();
86 void onSelectionChanged(Buffer<UUID> selection, bool selected);
87 void onFocusChanged(UUID focus, bool focussed);
88 void removeModel(UUID model);
89 void updateFallbackStore();
90 void setOverrideMaterial(UUID material);
91 signals:
93 void requestContextMenu(const QPoint &pos);
95 void mouseInScreenSignal(bool mouse_in_screen);
96 protected:
97 bool event(QEvent *event) override;
98 Renderer* getRenderer();
99 void createMouseListener();
100 void addRootModels();
101 //void exposeEvent(QExposeEvent *event) override;
102 protected:
104#if NDEVR_SUPPORTS_THREADING
105 Thread* m_render_thread;
106#endif
110 QBackingStore* m_backing_store = nullptr;
118 bool m_instance_valid = false;
121 Q_DISABLE_COPY(QTGraphicsWindow)
122 };
125 {
126 Q_OBJECT
127 public:
128 QTGraphicsWidget(QTGraphicsWindow* window, QWidget* parent = nullptr);
129 virtual ~QTGraphicsWidget();
130 bool eventCallback(QEvent* event);
131 bool eventFilter(QObject* watched, QEvent* e) override;
132 void updateSize() override;
133 void setCamera(UUID camera);
134 void setModelManager(QTModelManager* manager, bool auto_add_models);
135 void updateBackgroundColor();
136 QTGraphicsWindow* graphicsWindow() { return m_window; }
137 signals:
138 void mouseInScreenSignal(bool mouse_in_screen);
139 protected:
142 RGBColor m_background_color = Constant<RGBColor>::NaN;
143#if !NDEVR_SPECIAL_GRAPHICS_WINDOW
145#endif
146 };
147
148}
149
#define NDEVR_GRAPHICS_API
Definition DLLInfo.h:74
QWindow GraphicsWindowBase
Definition QtGraphicsWindow.h:45
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition Pointer.hpp:303
Definition QtGraphicsWindow.cpp:841
Definition GraphicsUpdateArguments.h:40
Definition QtGraphicsWindow.h:125
QTimer * m_check_visibility_timer
Definition QtGraphicsWindow.h:141
GlobalGraphicsWidgetEventFilter * m_filter
Definition QtGraphicsWindow.h:144
QTGraphicsWindow * graphicsWindow()
Definition QtGraphicsWindow.h:136
void mouseInScreenSignal(bool mouse_in_screen)
QTGraphicsWindow * m_window
Definition QtGraphicsWindow.h:140
Definition QtGraphicsWindow.h:54
bool m_animating
Definition QtGraphicsWindow.h:113
bool m_initiation_failure
Definition QtGraphicsWindow.h:116
void mouseInScreenSignal(bool mouse_in_screen)
QTResourceListener * m_mouse_manager_listener
Definition QtGraphicsWindow.h:109
QRect m_last_render_size
Definition QtGraphicsWindow.h:119
bool m_has_valid_khr
Definition QtGraphicsWindow.h:114
DynamicPointer< GraphicsDevice > m_device
Definition QtGraphicsWindow.h:120
Buffer< UUID > m_models_to_add
Definition QtGraphicsWindow.h:108
bool m_is_init
Definition QtGraphicsWindow.h:111
bool m_is_size_valid
Definition QtGraphicsWindow.h:112
void onSelectedSignal(Buffer< UUID > selected)
QTModelManager * m_manager
Definition QtGraphicsWindow.h:107
bool m_is_exposed
Definition QtGraphicsWindow.h:115
bool m_auto_add_models
Definition QtGraphicsWindow.h:117
void requestContextMenu(const QPoint &pos)
Renderer * m_render
Definition QtGraphicsWindow.h:103
Definition QTModelManager.h:94
Definition QTTools.h:183
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:53
Definition Renderer.h:47
Definition TimeSpan.h:40
Definition UUID.h:66
An element of a vector space. An element of the real coordinate space Rn Basis vector,...
Definition Vector.hpp:62
Definition WindowContainer.h:31
Definition ACIColor.h:37
Definition BaseValues.hpp:272