16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 03:09:18 +02:00
This commit is contained in:
milek7
2018-07-15 00:46:01 +02:00
parent 4566375faa
commit 794093dad4
17 changed files with 346 additions and 184 deletions

View File

@@ -12,7 +12,7 @@ gl::postfx::postfx(const std::string &s) : postfx(shader("postfx_" + s + ".frag"
gl::postfx::postfx(const shader &s)
{
if (!vertex)
vertex = std::make_shared<gl::shader>("postfx.vert");
vertex = std::make_shared<gl::shader>("quad.vert");
if (!vao)
vao = std::make_shared<gl::vao>();

View File

@@ -105,7 +105,10 @@ void gl::program::init()
i++;
}
glUniform1i(glGetUniformLocation(*this, "shadowmap"), 10); //m7t: do something better
//tbd: do something better
glUniform1i(glGetUniformLocation(*this, "shadowmap"), MAX_TEXTURES + 0);
glUniform1i(glGetUniformLocation(*this, "envmap"), MAX_TEXTURES + 1);
GLuint index;

View File

@@ -31,14 +31,17 @@ namespace gl
#pragma pack(push, 1)
const size_t MAX_TEXTURES = 4;
struct scene_ubs
{
glm::mat4 projection;
glm::mat4 lightview;
float time;
UBS_PAD(12)
};
static_assert(sizeof(scene_ubs) == 132, "bad size of ubs");
static_assert(sizeof(scene_ubs) == 144, "bad size of ubs");
const size_t MAX_PARAMS = 3;
@@ -51,6 +54,7 @@ namespace gl
glm::vec3 velocity;
float opacity;
float emission;
UBS_PAD(12)
void set_modelview(const glm::mat4 &mv)
{
@@ -59,7 +63,7 @@ namespace gl
}
};
static_assert(sizeof(model_ubs) == 156 + 8 * MAX_PARAMS, "bad size of ubs");
static_assert(sizeof(model_ubs) == 144 + 16 * MAX_PARAMS, "bad size of ubs");
struct light_element_ubs
{