Hymn to Beauty
C++ 3D Engine
StaticRenderProgram.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <glm/glm.hpp>
4#include "RenderProgram.hpp"
5#include "../Lighting/ZBinning.hpp"
6
7namespace Video {
8class LowLevelRenderer;
9class Texture2D;
10class Shader;
11class ShaderProgram;
12class GraphicsPipeline;
13class Buffer;
14class CommandBuffer;
15class Texture;
16class Sampler;
17class VertexDescription;
18namespace Geometry {
19class Geometry3D;
20}
21
24 public:
26
29 explicit StaticRenderProgram(LowLevelRenderer* lowLevelRenderer);
30
33
35
40 void PreDepthRender(CommandBuffer& commandBuffer, const glm::mat4& viewMatrix, const glm::mat4& projectionMatrix);
41
43
48 void DepthRender(CommandBuffer& commandBuffer, Geometry::Geometry3D* geometry, const glm::mat4& modelMatrix) const;
49
51
57 void PreRender(CommandBuffer& commandBuffer, const glm::mat4& viewMatrix, const glm::mat4& projectionMatrix, const ZBinning::LightInfo& lightInfo);
58
60
68 void Render(CommandBuffer& commandBuffer, Geometry::Geometry3D* geometry, Video::Texture2D* textureAlbedo, Video::Texture2D* textureNormal, Video::Texture2D* textureRoughnessMetallic, const glm::mat4& modelMatrix) const;
69
70 private:
71 StaticRenderProgram(const StaticRenderProgram& other) = delete;
72
73 LowLevelRenderer* lowLevelRenderer;
74 VertexDescription* vertexDescription;
75
76 Shader* depthVertexShader;
77 Shader* depthFragmentShader;
78 ShaderProgram* depthShaderProgram;
79 GraphicsPipeline* depthGraphicsPipeline;
80
81 Shader* vertexShader;
82 Shader* fragmentShader;
83 ShaderProgram* shaderProgram;
84 GraphicsPipeline* graphicsPipeline;
85
86 const Sampler* sampler;
87
88 struct MatricesValues {
89 glm::mat4 viewProjectionMatrix;
90 glm::mat4 viewMatrix;
91 };
92
93 struct FragmentUniforms {
94 uint32_t directionalLightCount;
95 uint32_t lightCount;
96 uint32_t maskCount;
97 uint32_t zBins;
98 uint32_t tileSize;
99 uint32_t tilesX;
100 float gamma;
101 float zNear;
102 float zFar;
103 };
104
105 glm::mat4 viewMatrix;
106 glm::mat4 projectionMatrix;
107 glm::mat4 viewProjectionMatrix;
108};
109} // namespace Video
A buffer into which rendering commands are recorded.
Definition: CommandBuffer.hpp:24
Renderable 3D geometry.
Definition: Geometry3D.hpp:15
A graphics pipeline.
Definition: GraphicsPipeline.hpp:11
Low level renderer abstracting the underlaying graphics API (OpenGL or Vulkan).
Definition: LowLevelRenderer.hpp:27
Super class render program.
Definition: RenderProgram.hpp:14
float gamma
Definition: RenderProgram.hpp:35
Determines how a texture should be sampled.
Definition: Sampler.hpp:6
Compiles and handles a shader. Shaders should be linked together into a ShaderProgram.
Definition: Shader.hpp:8
A shader program.
Definition: ShaderProgram.hpp:11
Render program to render an entity using default shader program.
Definition: StaticRenderProgram.hpp:23
~StaticRenderProgram()
Destructor.
Definition: StaticRenderProgram.cpp:53
void DepthRender(CommandBuffer &commandBuffer, Geometry::Geometry3D *geometry, const glm::mat4 &modelMatrix) const
Render depth pass.
Definition: StaticRenderProgram.cpp:80
void Render(CommandBuffer &commandBuffer, Geometry::Geometry3D *geometry, Video::Texture2D *textureAlbedo, Video::Texture2D *textureNormal, Video::Texture2D *textureRoughnessMetallic, const glm::mat4 &modelMatrix) const
Render mesh.
Definition: StaticRenderProgram.cpp:119
StaticRenderProgram(LowLevelRenderer *lowLevelRenderer)
Create new static render program.
Definition: StaticRenderProgram.cpp:21
void PreRender(CommandBuffer &commandBuffer, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix, const ZBinning::LightInfo &lightInfo)
Bind render program.
Definition: StaticRenderProgram.cpp:86
void PreDepthRender(CommandBuffer &commandBuffer, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix)
Bind depth render program.
Definition: StaticRenderProgram.cpp:68
A two-dimensional texture.
Definition: Texture2D.hpp:10
Describes how a vertex buffer is accessed by a shader.
Definition: VertexDescription.hpp:8
Definition: AssetEditor.hpp:5
Definition: Editor.hpp:18
Information about the lights in a scene.
Definition: ZBinning.hpp:23