NDEVR
API Documentation
QModelViewCapture.h
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: QModelViewCapture
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#if NDEVR_VIEWPORT
35#include <NDEVR/SnapLocation.h>
36#include <NDEVR/UUID.h>
37#include <NDEVR/RGBColor.h>
38#include <NDEVR/Angle.h>
39#include <NDEVR/Buffer.h>
40#include <QImage>
41#include <functional>
42namespace NDEVR
43{
44 class Renderer;
45 class GraphicsDevice;
46 class QTModelManager;
47 class BasicThread;
52 {
53 Vector<2, uint04> size = { 128, 128 };
57 UUID target_object = Constant<UUID>::Invalid;
59 RGBColor background = { 255, 255, 255, 0};
60 bool orthographic = false;
61 bool auto_crop = false;
62 bool operator==(const CaptureInfo& info) const
63 {
64 return (snap == info.snap)
65 && (target_object == info.target_object)
67 && (orthographic == info.orthographic)
68 && (background == info.background)
70 && (size == info.size)
71 && (auto_crop == info.auto_crop);
72 }
73 };
74
78 {
84 : m_id(id)
85 {}
86
92 CaptureRequest(UUID id, const CaptureInfo& info, const std::function<void(const QImage& image)>& n_callback)
93 : CaptureInfo(info)
94 , m_id(id)
95 , callback(n_callback)
96 {}
97
101 UUID uuid() const { return m_id; }
102 bool operator==(const CaptureInfo& info) const
103 {
104 return (snap == info.snap)
105 && (target_object == info.target_object)
107 && (orthographic == info.orthographic)
108 && (background == info.background)
109 && (auto_crop == info.auto_crop)
110 && (reference_size == info.reference_size)
111 && (size == info.size);
112 }
114 std::function<void(const QImage& image)> callback = nullptr;
115 };
116
117}
118#endif
A thread that executes a user-provided callback function concurrently.
Definition BasicThread.h:47
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A physical or virtual device used with the NDEVR Rendering Engine.
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:57
An object that renders a specific Camera object, typically run on a different thread than the main UI...
Definition Renderer.h:53
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
Definition Vector.hpp:62
The primary namespace for the NDEVR SDK.
double fltp08
Defines an alias representing an 8 byte floating-point number.
SnapLocation
A list of directions that a view can be pointed relative to an object or scene.
@ e_no_snap
No snap applied; free camera orientation.
Information relating to capturing a 3D view into a 2D raster image.
RGBColor background
The background color for the captured image.
bool auto_crop
Whether to automatically crop empty space from the captured image.
bool orthographic
Whether to use orthographic projection instead of perspective.
SnapLocation snap
The snap location for camera positioning.
UUID target_object
The UUID of the primary object to focus on.
Buffer< UUID > included_objects
Additional objects to include in the capture.
fltp08 reference_size
The reference size used for scaling the view.
Vector< 3, Angle< fltp08 > > angle_offsets
Camera angle offsets around the X, Y, and Z axes.
Vector< 2, uint04 > size
The output image dimensions in pixels.
CaptureRequest(UUID id)
Constructs a capture request with the given UUID.
UUID m_id
The unique identifier for this capture request.
std::function< void(const QImage &image)> callback
Callback invoked with the captured image.
UUID uuid() const
Gets the UUID of this capture request.
CaptureRequest(UUID id, const CaptureInfo &info, const std::function< void(const QImage &image)> &n_callback)
Constructs a capture request with capture info and a completion callback.