Have a working skybox now.

This commit is contained in:
Zed A. Shaw 2026-09-03 16:57:51 -04:00
parent 87c513b9f0
commit 4ee5058e82
13 changed files with 158 additions and 2 deletions

View file

@ -27,6 +27,8 @@ struct Thing {
struct Scene {
Shader shader;
Shader skybox_shader;
std::vector<std::string> skybox_faces;
Screen screen;
FrameBuffer framebuffer;
@ -35,12 +37,16 @@ struct Scene {
components::Lighting light;
std::unordered_map<std::string, Model> models;
std::vector<Thing> things;
float deltaTime = 0.0f;
float lastFrame = 0.0f;
unsigned int skyboxVAO = 0;
unsigned int skyboxVBO = 0;
unsigned int skybox_texture_id = 0;
Scene(components::Scene& config):
shader{config.shader.vertex_path, config.shader.frag_path},
skybox_shader{config.skybox_shader.vertex_path, config.skybox_shader.frag_path},
skybox_faces{config.skybox_faces},
screen{.shader={config.screen_shader.vertex_path, config.screen_shader.frag_path}},
materials{config.materials},
camera{
@ -70,8 +76,12 @@ struct Scene {
shader.setInt("texture1", 0);
shader.apply_lighting(light);
skybox_shader.use();
skybox_shader.setInt("skybox", 0);
framebuffer.init();
screen.init();
init_skybox();
}
void update();
@ -79,4 +89,7 @@ struct Scene {
void render(GLFWwindow* window);
void cleanup();
void spawn(const std::string& name, components::Position& position, components::Rotation& rotation);
void init_skybox();
void load_skybox_textures();
void render_skybox(const glm::mat4& projection);
};