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 struct CaptureCache : public CaptureInfo
12 {
14 {}
15 CaptureCache(const CaptureInfo& info, const Time& n_time, const QImage& n_image)
16 : CaptureInfo(info)
17 , time(n_time)
18 , image(n_image)
19 {}
20 bool operator==(const CaptureInfo& info) const
21 {
22 return (snap == info.snap)
23 && (target_object == info.target_object)
24 && (included_objects == info.included_objects)
25 && (orthographic == info.orthographic)
26 && (background == info.background)
27 && (auto_crop == info.auto_crop)
28 && (reference_size == info.reference_size)
29 && (size == info.size);;
30 }
32 QImage image;
33 };
34 class QModelViewCapture : public WindowInstance
35 {
36 public:
38 explicit QModelViewCapture(const DynamicPointer<GraphicsDevice>& device, QTModelManager* manager);
39 virtual ~QModelViewCapture();
40 virtual void initialize();
41 void setCamera(const UUID& camera) override;
42
43 void setSize(const Vector<2, uint04>& size) final override
44 {
45 WindowInstance::setSize(size);
46 }
47 virtual void* getSurface() override { return nullptr; }
48 void update();
49
50 uint04 getGrabImageSize() final override
51 {
52 return 1;
53 }
54 virtual bool shouldExit() const override;
55 void setupMaterialModel();
56 void addRequest(const ConstPointer<CaptureRequest>& request);
59 uint04 requestSize() const { return m_requests.size(); }
60 void setCacheCallback(const std::function<void(const CaptureCache&)>& function) { m_capture_cache_callback = function; }
61 QImage getModelImage(const CaptureInfo& info);
62
64 void finishFrame(GraphicsUpdateArguments& args) override;
66 protected:
67 Renderer* getRenderer() { return m_render; };
68 private:
69 UUID m_material;
72 std::function<void(const CaptureCache&)> m_capture_cache_callback;
73 QCustomImage m_image;
74 QTModelManager* m_model_manager;
75 Renderer* m_render;
76#if NDEVR_SUPPORTS_THREADING
77 Thread* m_render_thead;
78#endif
79 bool m_initiation_failure;
80 bool m_auto_crop;
82 std::function<void(const QImage& image)> m_callback;
83 };
85 {
86 public:
88 virtual ~QCaptureManager() {}
89 virtual void addCaptureRequest(const ConstPointer<CaptureRequest>& request);
90 virtual void removeCaptureRequest(const ConstPointer<CaptureRequest>& request);
91 virtual void runCaptureRequest(const ConstPointer<CaptureRequest>& request);
92 virtual bool isCached(const CaptureInfo& info) const;
93 protected:
94 void addToCache(const CaptureCache& cache);
95 uint04 searchCache(const CaptureInfo& info) const;
98 protected:
104 };
105}
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition GraphicsPipeline.h:42
Definition Dictionary.h:48
Definition Pointer.hpp:303
Definition GraphicsUpdateArguments.h:40
Definition ModelViewCapture.h:85
Dictionary< UUID, uint04 > m_pending_requests
Definition ModelViewCapture.h:102
uint04 searchCache(const CaptureInfo &info) const
Definition ModelViewCapture.cpp:461
virtual void removeCaptureRequest(const ConstPointer< CaptureRequest > &request)
Definition ModelViewCapture.cpp:398
virtual void addCaptureRequest(const ConstPointer< CaptureRequest > &request)
Definition ModelViewCapture.cpp:373
uint04 takeAvailableFrame() const
Definition ModelViewCapture.cpp:423
DynamicPointer< GraphicsDevice > m_device
Definition ModelViewCapture.h:99
QCaptureManager(const DynamicPointer< GraphicsDevice > &device, QTModelManager *manager, uint04 size)
Definition ModelViewCapture.cpp:357
Buffer< CaptureCache > m_capture_cache
Definition ModelViewCapture.h:101
QTModelManager * m_manager
Definition ModelViewCapture.h:103
void addToCache(const CaptureCache &cache)
Definition ModelViewCapture.cpp:433
virtual ~QCaptureManager()
Definition ModelViewCapture.h:88
virtual void runCaptureRequest(const ConstPointer< CaptureRequest > &request)
Definition ModelViewCapture.cpp:406
Buffer< QModelViewCapture * > m_capture_frames
Definition ModelViewCapture.h:100
virtual bool isCached(const CaptureInfo &info) const
Definition ModelViewCapture.cpp:507
uint04 getAvailableFrame() const
Definition ModelViewCapture.cpp:412
Definition QCustomImage.h:38
Definition ModelViewCapture.h:35
void removeRequest(const ConstPointer< CaptureRequest > &request)
Definition ModelViewCapture.cpp:249
virtual void initialize()
Definition ModelViewCapture.cpp:83
void setCamera(const UUID &camera) override
Definition ModelViewCapture.cpp:110
friend class QModelViewCaptureThread
Definition ModelViewCapture.h:37
void setCacheCallback(const std::function< void(const CaptureCache &)> &function)
Definition ModelViewCapture.h:60
uint04 requestSize() const
Definition ModelViewCapture.h:59
void setupMaterialModel()
Definition ModelViewCapture.cpp:264
void addRequest(const ConstPointer< CaptureRequest > &request)
Definition ModelViewCapture.cpp:281
Resource< bool > is_running
Definition ModelViewCapture.h:65
void setSize(const Vector< 2, uint04 > &size) final override
Definition ModelViewCapture.h:43
virtual void * getSurface() override
Definition ModelViewCapture.h:47
void executeRequest(const ConstPointer< CaptureRequest > &request)
Definition ModelViewCapture.cpp:301
void finishFrame(GraphicsUpdateArguments &args) override
Definition ModelViewCapture.cpp:341
QModelViewCapture(const DynamicPointer< GraphicsDevice > &device, QTModelManager *manager)
Definition ModelViewCapture.cpp:56
void update()
Definition ModelViewCapture.cpp:116
uint04 getGrabImageSize() final override
Definition ModelViewCapture.h:50
virtual ~QModelViewCapture()
Definition ModelViewCapture.cpp:75
Renderer * getRenderer()
Definition ModelViewCapture.h:67
QImage getModelImage(const CaptureInfo &info)
Definition ModelViewCapture.cpp:321
virtual bool shouldExit() const override
Definition ModelViewCapture.cpp:259
void requestModelImage(const ConstPointer< CaptureRequest > &request)
Definition ModelViewCapture.cpp:332
Definition QTModelManager.h:94
Definition Renderer.h:47
Definition Toggle.h:41
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
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 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:120
Definition ModelViewCapture.h:12
CaptureCache()
Definition ModelViewCapture.h:13
QImage image
Definition ModelViewCapture.h:32
CaptureCache(const CaptureInfo &info, const Time &n_time, const QImage &n_image)
Definition ModelViewCapture.h:15
bool operator==(const CaptureInfo &info) const
Definition ModelViewCapture.h:20
Time time
Definition ModelViewCapture.h:31