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 /**--------------------------------------------------------------------------------------------------
54 \brief A Window used to render 3D graphics. This container allows for a different graphics backend to
55 be used than the rest of the UI.
56 **/
57 class NDEVR_GRAPHICS_API QTGraphicsWindow : public QWindow, public WindowInstance
58 {
59 Q_OBJECT
60 friend class QTGraphicsWidget;
61 friend class RenderThread;
62 public:
63 //explicit QTGraphicsWindow(QWindow* parent, UUID camera, Log* log, QTModelManager* manager, Qt::WindowFlags flags);
64 explicit QTGraphicsWindow(const DynamicPointer<GraphicsDevice>& device, QWindow* parent, Qt::WindowFlags flags);
66
67 virtual void initialize();
68 void setCamera(const UUID& camera) override;
69 void exposeEvent(QExposeEvent* e) override;
70 void setAnimating(bool animating);
71 virtual bool visible() const override;
72 virtual void setModelManager(QTModelManager* manager, bool auto_add_models);
73 void resizeEvent(QResizeEvent *resize_event) override;
75 void updateSize();
76 virtual bool shouldExit() const override;
77 QImage getImage() const;
78 void setExposed(bool exposed);
80 void pause(const TimeSpan& span);
82 public slots:
83 void contextMenu(const QPoint &pos);
84
85 void setSize(const Vector<2, uint04>& size) final override;
86 void addCameraObjectSlot(UUID camera_id, UUID model);
90 void onSelectionChanged(Buffer<UUID> selection, bool selected);
91 void onFocusChanged(UUID focus, bool focussed);
92 void removeModel(UUID model);
94 void setOverrideMaterial(UUID material);
95 signals:
97 void requestContextMenu(const QPoint &pos);
99 void mouseInScreenSignal(bool mouse_in_screen);
100 protected:
101 bool event(QEvent *event) override;
105 //void exposeEvent(QExposeEvent *event) override;
106 protected:
108#if NDEVR_SUPPORTS_THREADING
110#endif
114 QBackingStore* m_backing_store = nullptr;
122 bool m_instance_valid = false;
125 Q_DISABLE_COPY(QTGraphicsWindow)
126 };
127 class GlobalGraphicsWidgetEventFilter;
128 /**--------------------------------------------------------------------------------------------------
129 \brief A Widget wrapper around a QTGraphicsWindow that allows it to be used inside the UI framework.
130 **/
132 {
133 Q_OBJECT
134 public:
135 QTGraphicsWidget(QTGraphicsWindow* window, QWidget* parent = nullptr);
137 bool eventCallback(QEvent* event);
138 bool eventFilter(QObject* watched, QEvent* e) override;
139 void updateSize() override;
140 void setCamera(UUID camera);
141 void setModelManager(QTModelManager* manager, bool auto_add_models);
143 QTGraphicsWindow* graphicsWindow() { return m_window; }
144 signals:
145 void mouseInScreenSignal(bool mouse_in_screen);
146 protected:
150#if !NDEVR_SPECIAL_GRAPHICS_WINDOW
151 GlobalGraphicsWidgetEventFilter* m_filter;
152#endif
153 };
154
155}
156
#define NDEVR_GRAPHICS_API
Definition DLLInfo.h:56
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:56
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
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
QTimer * m_check_visibility_timer
Definition QtGraphicsWindow.h:148
GlobalGraphicsWidgetEventFilter * m_filter
Definition QtGraphicsWindow.h:151
void setModelManager(QTModelManager *manager, bool auto_add_models)
QTGraphicsWindow * graphicsWindow()
Definition QtGraphicsWindow.h:143
void mouseInScreenSignal(bool mouse_in_screen)
bool eventCallback(QEvent *event)
QTGraphicsWidget(QTGraphicsWindow *window, QWidget *parent=nullptr)
void updateSize() override
bool eventFilter(QObject *watched, QEvent *e) override
QTGraphicsWindow * m_window
Definition QtGraphicsWindow.h:147
void setCamera(UUID camera)
A Window used to render 3D graphics. This container allows for a different graphics backend to be use...
Definition QtGraphicsWindow.h:58
bool m_animating
Definition QtGraphicsWindow.h:117
QTGraphicsWindow(const DynamicPointer< GraphicsDevice > &device, QWindow *parent, Qt::WindowFlags flags)
bool m_initiation_failure
Definition QtGraphicsWindow.h:120
void onSelectionChanged(Buffer< UUID > selection, bool selected)
void contextMenu(const QPoint &pos)
virtual void setModelManager(QTModelManager *manager, bool auto_add_models)
void setExposed(bool exposed)
void removeModel(UUID model)
void setCamera(const UUID &camera) override
void mouseInScreenSignal(bool mouse_in_screen)
bool event(QEvent *event) override
QTResourceListener * m_mouse_manager_listener
Definition QtGraphicsWindow.h:113
void addScene(Buffer< UUID > model)
void addCameraObjectSlot(UUID camera_id, UUID model)
QRect m_last_render_size
Definition QtGraphicsWindow.h:123
virtual void initialize()
bool m_has_valid_khr
Definition QtGraphicsWindow.h:118
void addModel(Buffer< UUID > model)
DynamicPointer< GraphicsDevice > m_device
Definition QtGraphicsWindow.h:124
QImage getImage() const
Buffer< UUID > m_models_to_add
Definition QtGraphicsWindow.h:112
bool m_is_init
Definition QtGraphicsWindow.h:115
void setSize(const Vector< 2, uint04 > &size) final override
void finishFrame(GraphicsUpdateArguments &args) override
bool m_is_size_valid
Definition QtGraphicsWindow.h:116
void onSelectedSignal(Buffer< UUID > selected)
Thread * m_render_thread
Definition QtGraphicsWindow.h:109
QTModelManager * m_manager
Definition QtGraphicsWindow.h:111
void setOverrideMaterial(UUID material)
void setAnimating(bool animating)
void resizeEvent(QResizeEvent *resize_event) override
bool m_is_exposed
Definition QtGraphicsWindow.h:119
bool m_auto_add_models
Definition QtGraphicsWindow.h:121
void pause(const TimeSpan &span)
void requestContextMenu(const QPoint &pos)
Renderer * getRenderer()
virtual bool visible() const override
void onFocusChanged(UUID focus, bool focussed)
virtual bool shouldExit() const override
void exposeEvent(QExposeEvent *e) override
Renderer * m_render
Definition QtGraphicsWindow.h:107
const DynamicPointer< GraphicsDevice > & device() const
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Definition QTModelManager.h:105
Definition QTTools.h:168
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:54
An object that renders a specific Camera object, typically run on a different thread than the main UI...
Definition Renderer.h:52
A thread is a single sequence stream within the software.
Definition Thread.h:67
Stores a time span, or difference between two times, with an optional start time.
Definition TimeSpan.h:46
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
A (hacky) class for storing a window into a container. This is used if the rendering engine for a par...
Definition WindowContainer.h:37
Definition ACIColor.h:37
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233