API Documentation
Loading...
Searching...
No Matches
ModelViewCapture.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/GraphicsDevice.h>
4#include <NDEVR/QModelViewCapture.h>
5#include <NDEVR/QCustomImage.h>
6#include <NDEVR/CaptureInfo.h>
7#include <NDEVR/WindowInstance.h>
8namespace NDEVR
9{
10 class Thread;
11 /**--------------------------------------------------------------------------------------------------
12 \brief Stores information about a screenshot.
13 **/
14 struct CaptureCache : public CaptureInfo
15 {
17 {}
18 CaptureCache(const CaptureInfo& info, const Time& n_time, const QImage& n_image)
19 : CaptureInfo(info)
20 , time(n_time)
21 , image(n_image)
22 {}
23 bool operator==(const CaptureInfo& info) const
24 {
25 return (snap == info.snap)
26 && (target_object == info.target_object)
27 && (included_objects == info.included_objects)
28 && (orthographic == info.orthographic)
29 && (background == info.background)
30 && (auto_crop == info.auto_crop)
31 && (reference_size == info.reference_size)
32 && (size == info.size);;
33 }
35 QImage image;
36 };
37 /**--------------------------------------------------------------------------------------------------
38 \brief Used to capture a 2D image of a DesignObjectLookup from a specific perspective.
39 **/
40 class QModelViewCapture : public WindowInstance
41 {
42 public:
46 virtual void initialize();
47 void setCamera(const UUID& camera) override;
48
49 void setSize(const Vector<2, uint04>& size) final override
50 {
51 WindowInstance::setSize(size);
52 }
53 virtual void* getSurface() override { return nullptr; }
54 void update();
55
56 uint04 getGrabImageSize() final override
57 {
58 return 1;
59 }
60 virtual bool shouldExit() const override;
65 uint04 requestSize() const { return m_requests.size(); }
66 void setCacheCallback(const std::function<void(const CaptureCache&)>& function) { m_capture_cache_callback = function; }
67 QImage getModelImage(const CaptureInfo& info);
68
72 protected:
73 Renderer* getRenderer() { return m_render; };
74 private:
75 UUID m_material;
78 std::function<void(const CaptureCache&)> m_capture_cache_callback;
79 QCustomImage m_image;
80 QTModelManager* m_model_manager;
81 Renderer* m_render;
82#if NDEVR_SUPPORTS_THREADING
83 Thread* m_render_thead;
84#endif
85 bool m_initiation_failure;
86 bool m_auto_crop;
88 std::function<void(const QImage& image)> m_callback;
89 };
90 /**--------------------------------------------------------------------------------------------------
91 \brief An interface used to manage multiple CaptureRequests and scedule their completion.
92 **/
114}
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition GraphicsPipeline.h:42
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
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
An interface used to manage multiple CaptureRequests and scedule their completion.
Definition ModelViewCapture.h:94
Dictionary< UUID, uint04 > m_pending_requests
Definition ModelViewCapture.h:111
uint04 searchCache(const CaptureInfo &info) const
virtual void runCaptureRequest(const ConstPointer< CaptureRequest > &request)
uint04 takeAvailableFrame() const
DynamicPointer< GraphicsDevice > m_device
Definition ModelViewCapture.h:108
QCaptureManager(const DynamicPointer< GraphicsDevice > &device, QTModelManager *manager, uint04 size)
virtual bool isCached(const CaptureInfo &info) const
Buffer< CaptureCache > m_capture_cache
Definition ModelViewCapture.h:110
QTModelManager * m_manager
Definition ModelViewCapture.h:112
virtual void addCaptureRequest(const ConstPointer< CaptureRequest > &request)
void addToCache(const CaptureCache &cache)
virtual ~QCaptureManager()
Definition ModelViewCapture.h:97
virtual void removeCaptureRequest(const ConstPointer< CaptureRequest > &request)
Buffer< QModelViewCapture * > m_capture_frames
Definition ModelViewCapture.h:109
uint04 getAvailableFrame() const
Definition QCustomImage.h:38
Used to capture a 2D image of a DesignObjectLookup from a specific perspective.
Definition ModelViewCapture.h:41
void removeRequest(const ConstPointer< CaptureRequest > &request)
void setCamera(const UUID &camera) override
friend class QModelViewCaptureThread
Definition ModelViewCapture.h:43
void setCacheCallback(const std::function< void(const CaptureCache &)> &function)
Definition ModelViewCapture.h:66
uint04 requestSize() const
Definition ModelViewCapture.h:65
void addRequest(const ConstPointer< CaptureRequest > &request)
virtual void initialize()
Resource< bool > is_running
Definition ModelViewCapture.h:71
void setSize(const Vector< 2, uint04 > &size) final override
Definition ModelViewCapture.h:49
virtual void * getSurface() override
Definition ModelViewCapture.h:53
void executeRequest(const ConstPointer< CaptureRequest > &request)
void finishFrame(GraphicsUpdateArguments &args) override
QModelViewCapture(const DynamicPointer< GraphicsDevice > &device, QTModelManager *manager)
uint04 getGrabImageSize() final override
Definition ModelViewCapture.h:56
Renderer * getRenderer()
Definition ModelViewCapture.h:73
QImage getModelImage(const CaptureInfo &info)
virtual bool shouldExit() const override
void requestModelImage(const ConstPointer< CaptureRequest > &request)
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Definition QTModelManager.h:105
An object that renders a specific Camera object, typically run on a different thread than the main UI...
Definition Renderer.h:52
A core part of the engine, stores variables that can be listened to with ResourceListener which will ...
Definition Toggle.h:41
A thread is a single sequence stream within the software.
Definition Thread.h:67
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
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
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
Stores information about a screenshot.
Definition ModelViewCapture.h:15
CaptureCache()
Definition ModelViewCapture.h:16
QImage image
Definition ModelViewCapture.h:35
CaptureCache(const CaptureInfo &info, const Time &n_time, const QImage &n_image)
Definition ModelViewCapture.h:18
bool operator==(const CaptureInfo &info) const
Definition ModelViewCapture.h:23
Time time
Definition ModelViewCapture.h:34