Euphoria
shader_resource.h
Go to the documentation of this file.
1#pragma once
2
3#include "eu/render/uniform.h"
6
7namespace eu::core
8{
9 struct CompiledGeomVertexAttributes;
10}
11
12namespace eu::render
13{
14struct FullScreenGeom;
15struct RenderSettings;
16struct ShaderProgram;
17struct CompiledCamera;
18struct ShadowContext;
19struct Assets;
20
27{
29 Uniform,
30
33};
34
47
48
61
65{
67 TransformSource model_source,
68 std::shared_ptr<ShaderProgram> p, core::CompiledGeomVertexAttributes l, const CameraUniformBuffer& desc
69 );
70
71 std::shared_ptr<ShaderProgram> program;
73
74 std::optional<Uniform> world_from_local_uni;
75};
76
88
92{
93 std::shared_ptr<ShaderProgram> program;
94
95 explicit LoadedShader_Unlit(TransformSource model_source, std::shared_ptr<ShaderProgram> p, const CameraUniformBuffer& desc);
96
99
100 std::optional<Uniform> world_from_local_uni;
101};
102
113
125
139
142{
143 none = 0,
144 factor = 1 << 1,
145 resolution = 1 << 2,
146 time = 1 << 3
147};
149
152{
153 std::shared_ptr<ShaderProgram> program;
155 std::optional<Uniform> factor_uni;
156 std::optional<Uniform> resolution_uni;
157 std::optional<Uniform> time_uni;
158
159 explicit LoadedPostProcShader(std::shared_ptr<ShaderProgram> s, PostProcSetup setup);
160};
161
192
195{
196 yes,
197 no
198};
199
215
226
238
241
244
245// todo(Gustav): Rename this to composing shader
259
262{
263 explicit ExtractShader(std::shared_ptr<LoadedPostProcShader>&& sh);
264
265 std::shared_ptr<LoadedPostProcShader> shader;
268};
269
271{
272 explicit PingPongBlurShader(std::shared_ptr<LoadedPostProcShader>&& sh);
273
274 std::shared_ptr<LoadedPostProcShader> shader;
276};
277
278
298
300
305} // namespace eu::render
PostProcSetup
Bitmask for what features each postproc shader wants.
PostProcSetup operator|(PostProcSetup lhs, PostProcSetup rhs)
TransformSource
Enum describing on how the model transform is provided.
ShaderResource load_shaders(const Assets &assets, const CameraUniformBuffer &desc, const RenderSettings &settings, const FullScreenGeom &full_screen)
UseTransparency
A "named boolean".
const LoadedShader_Unlit & shader_from_container(const LoadedShader_Unlit_Container &container, const RenderContext &rc)
Select the correct sub shader from a container.
@ Instanced_mat4
the model source is provided as a (instanced) mat4 attribute
Definition ui.h:4
A (inclusive) range between two values.
Definition range.h:19
A list of CompiledVertexLayoutNoNameList (for geom)
A compiled uniform buffer property that can be used in a shader.
"Global state" for the shaders describing the state of the camera.
core::UniformBufferSetup setup
std::unique_ptr< UniformBuffer > buffer
core::CompiledUniformProp view_from_world_uni
core::CompiledUniformProp clip_from_view_uni
void set_props(const CompiledCamera &cc)
A "compiled" camera for use in rendering.
Definition camera.h:41
Uniform for a directional light.
DirectionalLightUniforms(const ShaderProgram *program, const std::string &base)
Extracts data for a bloom.
std::shared_ptr< LoadedPostProcShader > shader
ExtractShader(std::shared_ptr< LoadedPostProcShader > &&sh)
Uniforms for a frustum light.
FrustumLightUniforms(const ShaderProgram *program, const std::string &base)
Store the information for how to render a full screen quad.
Definition fullscreen.h:15
The "base class" for a loaded postproc shader.
std::optional< Uniform > resolution_uni
std::shared_ptr< ShaderProgram > program
std::optional< Uniform > factor_uni
std::optional< Uniform > time_uni
LoadedPostProcShader(std::shared_ptr< ShaderProgram > s, PostProcSetup setup)
core::CompiledGeomVertexAttributes geom_layout
Part of a loaded "default" shader.
std::shared_ptr< ShaderProgram > program
LoadedShader_Default(TransformSource model_source, std::shared_ptr< ShaderProgram > p, const RenderSettings &settings, const CameraUniformBuffer &desc)
std::vector< PointLightUniforms > point_lights
std::vector< DirectionalLightUniforms > directional_lights
std::vector< FrustumLightUniforms > frustum_lights
std::optional< Uniform > world_from_local_uni
std::optional< Uniform > world_from_local_uni
core::CompiledGeomVertexAttributes geom_layout
LoadedShader_OnlyDepth(TransformSource model_source, std::shared_ptr< ShaderProgram > p, core::CompiledGeomVertexAttributes l, const CameraUniformBuffer &desc)
std::shared_ptr< ShaderProgram > program
LoadedShader_SingleColor(std::shared_ptr< ShaderProgram > p, core::CompiledGeomVertexAttributes l, const CameraUniformBuffer &desc)
std::shared_ptr< ShaderProgram > program
core::CompiledGeomVertexAttributes geom_layout
std::shared_ptr< ShaderProgram > program
LoadedShader_Skybox(std::shared_ptr< ShaderProgram > p, core::CompiledGeomVertexAttributes l, const CameraUniformBuffer &desc)
core::CompiledGeomVertexAttributes geom_layout
core::CompiledGeomVertexAttributes geom_layout
Parts of a loaded unlit shader.
std::optional< Uniform > world_from_local_uni
std::shared_ptr< ShaderProgram > program
LoadedShader_Unlit(TransformSource model_source, std::shared_ptr< ShaderProgram > p, const CameraUniformBuffer &desc)
std::shared_ptr< LoadedPostProcShader > shader
PingPongBlurShader(std::shared_ptr< LoadedPostProcShader > &&sh)
Uniforms for a point light.
PointLightUniforms(const ShaderProgram *program, const std::string &base)
The shader data for composing a rendered image.
RealizeShader(std::shared_ptr< ShaderProgram > s)
std::shared_ptr< ShaderProgram > program
Stores information that is useful when selecting a shader part from a shader container.
ShadowContext const * shadow_context
float gamma
gamma from the rendering settings
constexpr RenderContext(TransformSource s, UseTransparency t, float g, const ShadowContext *sc)
UseTransparency use_transparency
Startup settings for the renderer.
RAII representation of a open gl shader program.
Definition shader.h:28
RealizeShader pp_realize
the realization shader that is always run
LoadedShader_SingleColor single_color_shader
LoadedShader_Skybox skybox_shader
LoadedShader_OnlyDepth depth_transform_uniform
bool is_loaded() const
verify that the shaders are loaded
LoadedShader_Unlit_Container unlit_shader_container
LoadedShader_Default_Container default_shader_container
LoadedShader_OnlyDepth depth_transform_instanced_mat4
Represents a found shader uniform and created via ShaderProgram::GetUniform()
Definition uniform.h:9