mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
opengl 3.3 renderer cascaded shadow maps, minor gfx renderer optimizations
This commit is contained in:
@@ -25,6 +25,12 @@ void gl::framebuffer::attach(const opengl_texture &tex, GLenum location)
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, location, tex.target, tex.id, 0);
|
||||
}
|
||||
|
||||
void gl::framebuffer::attach(const opengl_texture &tex, GLenum location, GLint layer)
|
||||
{
|
||||
bind();
|
||||
glFramebufferTextureLayer(GL_FRAMEBUFFER, location, tex.id, 0, layer);
|
||||
}
|
||||
|
||||
void gl::framebuffer::attach(const cubemap &tex, int face, GLenum location)
|
||||
{
|
||||
bind();
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace gl
|
||||
~framebuffer();
|
||||
|
||||
void attach(const opengl_texture &tex, GLenum location);
|
||||
void attach( const opengl_texture &tex, GLenum location, GLint layer );
|
||||
void attach(const cubemap &tex, int face, GLenum location);
|
||||
void attach(const renderbuffer &rb, GLenum location);
|
||||
void setup_drawing(int attachments);
|
||||
|
||||
@@ -13,6 +13,7 @@ void gl::glsl_common_setup()
|
||||
"#define EXTRAEFFECTS_ENABLED " + std::to_string((int)Global.gfx_extraeffects) + "\n" +
|
||||
"#define USE_GLES " + std::to_string((int)Global.gfx_usegles) + "\n" +
|
||||
"const uint MAX_LIGHTS = " + std::to_string(MAX_LIGHTS) + "U;\n" +
|
||||
"const uint MAX_CASCADES = " + std::to_string(MAX_CASCADES) + "U;\n" +
|
||||
"const uint MAX_PARAMS = " + std::to_string(MAX_PARAMS) + "U;\n" +
|
||||
R"STRING(
|
||||
const uint LIGHT_SPOT = 0U;
|
||||
@@ -64,9 +65,9 @@ void gl::glsl_common_setup()
|
||||
layout (std140) uniform scene_ubo
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 lightview;
|
||||
mat4 inv_view;
|
||||
vec3 scene_extra;
|
||||
mat4 lightview[MAX_CASCADES];
|
||||
vec4 cascade_end;
|
||||
float time;
|
||||
};
|
||||
|
||||
|
||||
7
gl/ubo.h
7
gl/ubo.h
@@ -32,17 +32,18 @@ namespace gl
|
||||
|
||||
const size_t MAX_TEXTURES = 8;
|
||||
const size_t ENVMAP_SIZE = 1024;
|
||||
const size_t MAX_CASCADES = 3;
|
||||
|
||||
struct scene_ubs
|
||||
{
|
||||
glm::mat4 projection;
|
||||
glm::mat4 lightview;
|
||||
glm::mat4 inv_view;
|
||||
glm::vec3 scene_extra;
|
||||
glm::mat4 lightview[MAX_CASCADES];
|
||||
glm::vec4 cascade_end;
|
||||
float time;
|
||||
};
|
||||
|
||||
static_assert(sizeof(scene_ubs) == 208, "bad size of ubs");
|
||||
static_assert(sizeof(scene_ubs) == 340, "bad size of ubs");
|
||||
|
||||
const size_t MAX_PARAMS = 3;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user