API Documentation
Loading...
Searching...
No Matches
Renderer.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: Graphics
28File: Renderer
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
37#include "Base/Headers/Time.h"
38namespace NDEVR
39{
40 class VulkanSession;
41 class Model;
42 class ModelPipelineManager;
43 class GraphicsUpdater;
44 class Image;
45 class DesignObjectLookup;
46 /**--------------------------------------------------------------------------------------------------
47 \brief An object that renders a specific Camera object, typically run on a different thread than the
48 main UI thread. Rendering takes place between calls to the GraphicsUpdater. If there is more than
49 one QTGraphicsWindow, there may be more than one Renderer running at a time.
50 **/
52 {
53 public:
54 Renderer(const DynamicPointer<GraphicsPipeline>& pipeline, const ConstPointer<Camera>& camera, WindowInstance* instance, ProgressInfo* log);
55 virtual ~Renderer();
56 void render(bool wait_until_needed, bool force_render = true);
57 void renderLoop();
58 //void recoverFromDeviceLost(const DynamicPointer<GraphicsDevice>& new_device);
59 void setActive(bool is_active);
60 void setFPS(fltp08 fps) { m_fps = fps; }
61 fltp08 getFPS() const { return m_fps; }
63 void run();
66 {
67 return m_args.frame_time;
68 }
69 void cleanup() {
70 m_render_pipeline->cleanup();
71 }
72 void init(DesignObjectLookup* lookup);
74 {
75 return m_log;
76 }
78 GraphicsUpdater* updater() const { return m_updater; }
80 void setWindowInstance(WindowInstance* window);
81 void addScene(const UUID& model);
83 void addModel(const UUID& model);
84 //void setClearColor(const RGBColor& background);
85 void removeModel(const UUID& model);
87 void setPostRenderFunction(const std::function<void()>& function) { m_post_render_function = function; }
90 void grabImage(Image* image);
91 void updateArgs(bool force_render);
93 DynamicPointer<GraphicsPipeline> pipeline() const { return m_render_pipeline; }
94 virtual void setCamera(const ConstPointer<Camera>& camera);
95 void setOverrideMaterial(UUID material);
96
98 void pause(TimeSpan span);
99 bool isActive() { return m_is_active; }
100 private:
101 void _render(bool wait_until_needed, bool force_render);
103 fltp08 m_fps;
104 DynamicPointer<GraphicsPipeline> m_render_pipeline;
105 ConstPointer<Camera> m_camera;
106 GraphicsUpdater* m_updater = nullptr;
107 WindowInstance* m_window = nullptr;
108 UUID render_id;
109 ProgressInfo* m_log;
110 std::function<void()> m_post_render_function;
111 bool m_is_active;
112 bool m_request_redraw;
113 volatile uint08 m_pause_time;
114 };
115}
#define NDEVR_GRAPHICS_API
Definition DLLInfo.h:56
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition GraphicsPipeline.h:42
A core class where all Design Objects including models, materials, and geometries are stored....
Definition DesignObjectLookup.h:65
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
Responsible for updating resources or layouts of data in-between calls to render.
Definition GraphicsUpdater.h:49
A root class that stores an an array of pixel data that can be displayed as an Image.
Definition Image.h:40
A light-weight base class for Log that allows processes to update, without the need for additional in...
Definition ProgressInfo.hpp:48
An object that renders a specific Camera object, typically run on a different thread than the main UI...
Definition Renderer.h:52
void updateSingleThreaded()
void ensureLastRenderComplete()
void updateArgs(bool force_render)
virtual void setCamera(const ConstPointer< Camera > &camera)
DynamicPointer< GraphicsPipeline > pipeline() const
Definition Renderer.h:93
void setFPS(fltp08 fps)
Definition Renderer.h:60
void pause(TimeSpan span)
void requestRedraw()
Time getFrameStartTime() const
Definition Renderer.h:65
Renderer(const DynamicPointer< GraphicsPipeline > &pipeline, const ConstPointer< Camera > &camera, WindowInstance *instance, ProgressInfo *log)
void cleanup()
Definition Renderer.h:69
void grabImageNextRender(Image *image)
ProgressInfo * log()
Definition Renderer.h:73
void setActive(bool is_active)
GraphicsUpdateArguments & getArguments()
Definition Renderer.h:79
GraphicsUpdater * updater() const
Definition Renderer.h:78
bool isActive()
Definition Renderer.h:99
uint04 multisample() const
fltp08 getFPS() const
Definition Renderer.h:61
void grabImage(Image *image)
void setPostRenderFunction(const std::function< void()> &function)
Definition Renderer.h:87
void updatePipeline()
void removeModel(const UUID &model)
void setOverrideMaterial(UUID material)
void render(bool wait_until_needed, bool force_render=true)
void init(DesignObjectLookup *lookup)
void setWindowInstance(WindowInstance *window)
void addScene(const UUID &model)
void addModel(const UUID &model)
const DynamicPointer< GraphicsDevice > & device() const
virtual ~Renderer()
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
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
Definition ACIColor.h:37
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer
Definition BaseValues.hpp:106
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149