sculpto
render_bridge.h
Go to the documentation of this file.
1/*!****************************************************************//*!*
2 * \file render_bridge.h
3 * \brief Render bridge class definition module.
4 * Static class for making calls to low-level render api,
5 * bridge between application high and low level rendering systems.
6 *
7 * \author Sabitov Kirill
8 * \date 01 July 2022
9 *********************************************************************/
10
11#pragma once
12
13#include "render_context.h"
14
15namespace scl
16{
18 class vertex_buffer;
19 class vertex_array;
20
23 {
24 private:
25 static shared<render_context> RenderContext;
26
27 public:
29 inline static const vec4 &GetClearColor() { return RenderContext->GetClearColor(); }
31 inline static bool GetWireframeMode() { return RenderContext->GetWireframeMode(); }
33 inline static render_cull_face_mode GetCullingMode() { return RenderContext->GetCullingMode(); }
35 inline static bool GetVSync() { return RenderContext->GetVSync(); }
36
38 inline static void SetClearColor(const vec4 &ClearColor) { RenderContext->SetClearColor(ClearColor); }
40 inline static void SetWireframeMode(bool IsWireframe) { RenderContext->SetWireframeMode(IsWireframe); }
42 inline static void SetCullingMode(render_cull_face_mode CullingMode) { RenderContext->SetCullingMode(CullingMode); }
44 inline static void SetVSync(bool VSync) { RenderContext->SetVSync(VSync); }
45
46 public:
47 /*!*
48 * Render context initialisation call function.
49 *
50 * \param None.
51 * \return None.
52 */
53 inline static void InitContext() { RenderContext->Init(); }
54
55 /*!*
56 * Render context deinitialisation call function.
57 *
58 * \param None.
59 * \return None.
60 */
61 inline static void CloseContext() { RenderContext->Close(); }
62
63 /*!*
64 * Swap render targets function.
65 *
66 * \param None.
67 * \return None.
68 */
69 inline static void SwapBuffers()
70 {
71 RenderContext->SwapBuffers();
72 }
73
74 /*!*
75 * Draw vertex array (vertex buffer and index buffer) to curent render target.
76 *
77 * \param VertexArray - vertex array to draw verticces from.
78 * \return None.
79 */
80 inline static void DrawIndices(const shared<vertex_array> &VertexArray)
81 {
82 RenderContext->DrawIndices(VertexArray);
83 }
84
85 /*!*
86 * Instanced draw vertex array (vertex buffer and index buffer) to curent render target.
87 *
88 * \param VertexArray - vertex array to draw verticces from.
89 * \parma InstanceCount - instances of drawing vertex array count.
90 * \return None.
91 */
92 inline static void DrawIndicesInstanced(const shared<vertex_array> &VertexArray, int InstanceCount)
93 {
94 RenderContext->DrawIndicesInstanced(VertexArray, InstanceCount);
95 }
96
97 public:
100 {
101 return RenderContext->GetSingleColorMaterialShader();
102 }
103
106 {
107 return RenderContext->GetPhongGeometryShader();
108 }
109
112 {
113 return RenderContext->GetPhongLightingShader();
114 }
115
118 {
119 return RenderContext->GetShadowPassShader();
120 }
121
124 {
125 return RenderContext->GetToneMappingPassShader();
126 }
127
130 {
131 return RenderContext->GetGaussianBlurPassShader();
132 }
133
136 {
137 return RenderContext->GetTextureAddPassShader();
138 }
139 };
140}
static void DrawIndicesInstanced(const shared< vertex_array > &VertexArray, int InstanceCount)
Definition: render_bridge.h:92
static void CloseContext()
Definition: render_bridge.h:61
static shared< shader_program > GetGaussianBlurPassShader()
static shared< shader_program > GetTextureAddPassShader()
static void SetVSync(bool VSync)
Definition: render_bridge.h:44
static void SetClearColor(const vec4 &ClearColor)
Definition: render_bridge.h:38
static void SetWireframeMode(bool IsWireframe)
Definition: render_bridge.h:40
static shared< shader_program > GetPhongLightingShader()
static shared< shader_program > GetShadowPassShader()
static render_cull_face_mode GetCullingMode()
Definition: render_bridge.h:33
static void SwapBuffers()
Definition: render_bridge.h:69
static shared< shader_program > GetToneMappingPassShader()
static const vec4 & GetClearColor()
Definition: render_bridge.h:29
static void DrawIndices(const shared< vertex_array > &VertexArray)
Definition: render_bridge.h:80
static shared< shader_program > GetPhongGeometryShader()
static void SetCullingMode(render_cull_face_mode CullingMode)
Definition: render_bridge.h:42
static shared< shader_program > GetSingleColorMaterialShader()
Definition: render_bridge.h:99
static void InitContext()
Definition: render_bridge.h:53
static bool GetVSync()
Definition: render_bridge.h:35
static bool GetWireframeMode()
Definition: render_bridge.h:31
Definition: base.h:33
std::shared_ptr< T > shared
Definition: smart_ptr.h:15
render_cull_face_mode
Base, abstract, backend render api independent render context class implementation module.