MOS
standard_program.hpp
1 #pragma once
2 
3 #include <glad/glad.h>
4 #include <array>
5 #include "../gl/shader.hpp"
6 
7 namespace mos::gl {
8 
10 class Standard_program : public Program {
11  friend class Renderer;
12 public:
14  GLint albedo_sampler;
15  GLint normal_sampler;
16  GLint metallic_sampler;
17  GLint roughness_sampler;
18  GLint emission_sampler;
19  GLint ambient_occlusion_sampler;
20  GLint albedo;
21  GLint roughness;
22  GLint metallic;
23  GLint index_of_refraction;
24  GLint alpha;
25  GLint transmission;
26  GLint emission;
27  GLint ambient_occlusion;
28  };
29 
31  GLint sampler;
32  GLint position;
33  GLint extent;
34  GLint strength;
35  GLint falloff;
36  };
37 
38  struct Light_uniforms {
39  GLint position;
40  GLint color;
41  GLint strength;
42  GLint view;
43  GLint projection;
44  GLint angle;
45  GLint direction;
46  GLint blend;
47  };
48 
50  GLint position;
51  GLint direction;
52  GLint color;
53  GLint strength;
54  };
55 
56  struct Camera_uniforms {
57  GLuint resolution;
58  GLuint position;
59  };
60 
61  struct Fog_uniforms {
62  GLint color_near;
63  GLint color_far;
64  GLint attenuation_factor;
65  GLint min;
66  GLint max;
67  };
68 private:
69  explicit Standard_program(const Shader &functions_shader);
70 
71 public:
72  GLint model_view_projection;
73  GLint model_matrix;
74  GLint normal_matrix;
75 
76  Material_uniforms material{};
77  Fog_uniforms fog{};
78  Camera_uniforms camera{};
79 
80  std::array<Environment_uniforms, 2> environment_maps{};
81 
82  std::array<GLuint, 4> shadow_samplers{};
83  std::array<Light_uniforms, 4> spot_lights{};
84  std::array<GLint, 4> depth_bias_mvps{};
85 
86  Directional_light_uniforms directional_light{};
87  std::array<GLuint, 4> cascaded_shadow_samplers{};
88  std::array<GLint, 4> cascaded_depth_bias_mvps{};
89  GLint cascade_splits;
90 
91  GLint brdf_lut_sampler;
92 };
93 }
Definition: shader.hpp:8
Definition: standard_program.hpp:38
Definition: standard_program.hpp:61
Definition: program.hpp:7
Definition: standard_program.hpp:56
Definition: array_buffers.hpp:5
Uniforms for the standard shader.
Definition: standard_program.hpp:10
Render geometry shapes with OpenGL.
Definition: renderer.hpp:40
Definition: standard_program.hpp:30
Definition: standard_program.hpp:13