Shadows working but look dumb. The issue so far was that framebuffer.cpp interferes with the framebuffer used to create the shadow map.
This commit is contained in:
parent
a29494325b
commit
482ec07fb3
19 changed files with 261 additions and 206 deletions
|
|
@ -15,7 +15,6 @@
|
|||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include "config.hpp"
|
||||
#include "text.hpp"
|
||||
|
||||
struct Thing {
|
||||
std::string name;
|
||||
|
|
@ -45,8 +44,36 @@ struct Scene {
|
|||
unsigned int skyboxVAO = UINT_MAX;
|
||||
unsigned int skyboxVBO = UINT_MAX;
|
||||
unsigned int skybox_texture_id = UINT_MAX;
|
||||
glm::mat4 projection = glm::mat4(1.0f);
|
||||
bool reflect_on = false;
|
||||
|
||||
// shadow stuff
|
||||
Shader depth_shader{{"shaders/33-depth.vert.glsl", "shaders/33-depth.frag.glsl", ""}};
|
||||
Shader depth_dbg_shader{{"shaders/33-shadow_dbg.vert.glsl", "shaders/33-shadow_dbg.frag.glsl", ""}};
|
||||
unsigned int depth_FBO = UINT_MAX;
|
||||
unsigned int depth_map = UINT_MAX;
|
||||
const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;
|
||||
float near_plane = 1.0f;
|
||||
float far_plane = 100.0f;
|
||||
|
||||
float depth_near_plane = 1.0f;
|
||||
float depth_far_plane = 7.5f;
|
||||
|
||||
glm::mat4 light_space;
|
||||
bool debug_on = false;
|
||||
|
||||
float quadVertices[20] = {
|
||||
// positions // texture Coords
|
||||
-1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
|
||||
-1.0f, -1.0f, 0.0f, 0.0f, 0.0f,
|
||||
1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
|
||||
1.0f, -1.0f, 0.0f, 1.0f, 0.0f,
|
||||
};
|
||||
|
||||
|
||||
unsigned int quadVAO = UINT_MAX;
|
||||
unsigned int quadVBO = UINT_MAX;
|
||||
|
||||
Scene(components::Scene& config):
|
||||
shader{config.shader},
|
||||
reflect_shader{config.reflect_shader},
|
||||
|
|
@ -90,7 +117,9 @@ struct Scene {
|
|||
|
||||
framebuffer.init();
|
||||
screen.init();
|
||||
init_skybox();
|
||||
// init_skybox();
|
||||
init_shadows();
|
||||
init_debug();
|
||||
}
|
||||
|
||||
void update();
|
||||
|
|
@ -98,7 +127,12 @@ struct Scene {
|
|||
void render(GLFWwindow* window);
|
||||
void cleanup();
|
||||
void init_skybox();
|
||||
void init_shadows();
|
||||
void init_debug();
|
||||
void load_skybox_textures();
|
||||
void render_skybox(const glm::mat4& projection);
|
||||
void render_skybox();
|
||||
void spawn(const std::string& name);
|
||||
void render_scene(GLFWwindow* window, Shader& with_shader);
|
||||
void render_shadows(GLFWwindow* window);
|
||||
void render_debug(GLFWwindow* window);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue