Euphoria
shader_resource.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
5#include "eu/render/uniform.h"
8
9namespace eu::core
10{
12}
13
14namespace eu::render
15{
16struct FullScreenGeom;
17struct RenderSettings;
18struct ShaderProgram;
19struct CompiledCamera;
20struct ShadowContext;
21struct Assets;
22
26
36
49
50
63
67{
69 TransformSource model_source,
70 std::shared_ptr<ShaderProgram> p, core::CompiledGeomVertexAttributes l, const CameraUniformBuffer& desc
71 );
72
73 std::shared_ptr<ShaderProgram> program;
75
76 std::optional<Uniform> world_from_local_uni;
77};
78
90
94{
95 std::shared_ptr<ShaderProgram> program;
96
97 explicit LoadedShader_Unlit(TransformSource model_source, std::shared_ptr<ShaderProgram> p, const CameraUniformBuffer& desc);
98
101
102 std::optional<Uniform> world_from_local_uni;
103};
104
115
127
141
144{
145 none = 0,
146 factor = 1 << 1,
147 resolution = 1 << 2,
148 time = 1 << 3
149};
151
154{
155 std::shared_ptr<ShaderProgram> program;
157 std::optional<Uniform> factor_uni;
158 std::optional<Uniform> resolution_uni;
159 std::optional<Uniform> time_uni;
160
161 explicit LoadedPostProcShader(std::shared_ptr<ShaderProgram> s, PostProcSetup setup);
162};
163
194
197{
200};
201
217
228
240
243
246
247// todo(Gustav): Rename this to composing shader
261
264{
265 explicit ExtractShader(std::shared_ptr<LoadedPostProcShader>&& sh);
266
267 std::shared_ptr<LoadedPostProcShader> shader;
270};
271
273{
274 explicit PingPongBlurShader(std::shared_ptr<LoadedPostProcShader>&& sh);
275
276 std::shared_ptr<LoadedPostProcShader> shader;
278};
279
280
300
301ShaderResource load_shaders(const Assets& assets, const CameraUniformBuffer& desc, const RenderSettings& settings, const FullScreenGeom& full_screen);
302
306
307} // 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.
@ uniform
the model source is provided as a mat4 uniform.
@ instanced_mat4
the model source is provided as a (instanced) mat4 attribute
Definition ui.h:4
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:51
DirectionalLightUniforms(const ShaderProgram *program, const std::string &base)
Extracts data for a bloom.
std::shared_ptr< LoadedPostProcShader > shader
ExtractShader(std::shared_ptr< LoadedPostProcShader > &&sh)
FrustumLightUniforms(const ShaderProgram *program, const std::string &base)
Store the information for how to render a full screen quad.
Definition fullscreen.h:17
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)
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