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;
47 {
48 public:
49 Renderer(const DynamicPointer<GraphicsPipeline>& pipeline, const ConstPointer<Camera>& camera, WindowInstance* instance, ProgressInfo* log);
50 virtual ~Renderer();
51 void render(bool wait_until_needed, bool force_render = true);
52 void renderLoop();
53 //void recoverFromDeviceLost(const DynamicPointer<GraphicsDevice>& new_device);
54 void setActive(bool is_active);
55 void setFPS(fltp08 fps) { m_fps = fps; }
56 fltp08 getFPS() const { return m_fps; }
57 uint04 multisample() const;
58 void run();
59 void ensureLastRenderComplete();
61 {
62 return m_args.frame_time;
63 }
64 void cleanup() {
65 m_render_pipeline->cleanup();
66 }
67 void init(DesignObjectLookup* lookup);
69 {
70 return m_log;
71 }
72 void updateSingleThreaded();
73 GraphicsUpdater* updater() const { return m_updater; }
75 void setWindowInstance(WindowInstance* window);
76 void addScene(const UUID& model);
77 const DynamicPointer<GraphicsDevice>& device() const;
78 void addModel(const UUID& model);
79 //void setClearColor(const RGBColor& background);
80 void removeModel(const UUID& model);
81 void clearModels();
82 void setPostRenderFunction(const std::function<void()>& function) { m_post_render_function = function; }
83 void setupSurface();
84 void requestRedraw();
85 void grabImage(Image* image);
86 void updateArgs(bool force_render);
87 void grabImageNextRender(Image* image);
88 DynamicPointer<GraphicsPipeline> pipeline() const { return m_render_pipeline; }
89 virtual void setCamera(const ConstPointer<Camera>& camera);
90 void setOverrideMaterial(UUID material);
91
92 void updatePipeline();
93 void pause(TimeSpan span);
94 bool isActive() { return m_is_active; }
95 private:
96 void _render(bool wait_until_needed, bool force_render);
98 fltp08 m_fps;
99 DynamicPointer<GraphicsPipeline> m_render_pipeline;
100 ConstPointer<Camera> m_camera;
101 GraphicsUpdater* m_updater = nullptr;
102 WindowInstance* m_window = nullptr;
103 UUID render_id;
104 ProgressInfo* m_log;
105 std::function<void()> m_post_render_function;
106 bool m_is_active;
107 bool m_request_redraw;
108 volatile uint08 m_pause_time;
109 };
110}
#define NDEVR_GRAPHICS_API
Definition DLLInfo.h:74
Definition GraphicsPipeline.h:42
Definition DesignObjectLookup.h:61
Definition Pointer.hpp:303
Definition GraphicsUpdateArguments.h:40
Definition GraphicsUpdater.h:46
Definition Image.h:39
Definition ProgressInfo.hpp:43
Definition Renderer.h:47
DynamicPointer< GraphicsPipeline > pipeline() const
Definition Renderer.h:88
void setFPS(fltp08 fps)
Definition Renderer.h:55
Time getFrameStartTime() const
Definition Renderer.h:60
void cleanup()
Definition Renderer.h:64
ProgressInfo * log()
Definition Renderer.h:68
GraphicsUpdateArguments & getArguments()
Definition Renderer.h:74
GraphicsUpdater * updater() const
Definition Renderer.h:73
bool isActive()
Definition Renderer.h:94
fltp08 getFPS() const
Definition Renderer.h:56
void setPostRenderFunction(const std::function< void()> &function)
Definition Renderer.h:82
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Definition TimeSpan.h:40
Definition UUID.h:66
Definition ACIColor.h:37
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer -Can represent exact integer values 0 thro...
Definition BaseValues.hpp:132
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181