#pragma once #include #include #include #include #include #include "shader.hpp" #include "model.hpp" #include "shader.hpp" #include "model.hpp" #include "camera.hpp" #include "components.hpp" #include struct Thing { Model& model; components::Position position; Material& material; }; struct Scene { Shader shader; Shader light_shader; std::map materials; Camera camera; components::Lighting light; std::map models; std::vector things; float deltaTime = 0.0f; float lastFrame = 0.0f; Scene(components::Scene& config): shader{config.shader.vertex_path, config.shader.frag_path}, light_shader{config.light_shader.vertex_path, config.shader.frag_path}, materials{config.materials}, camera{ .position=config.camera.position, .front=config.camera.front, .up=config.camera.up, .direction=config.camera.direction, .movement_speed=config.camera.movement_speed, }, light{config.light} { for(auto& [name, model] : config.models) { models.try_emplace(name, model.directory, model.model_path); } for(auto& thing : config.things) { things.emplace_back( models.at(thing.model), thing.position, materials.at(thing.material)); } } void updateDelta(); void configure(); void draw_model(Model& scene_model, Material& material, glm::mat4& projection, glm::mat4& view, glm::vec3& position); void render(GLFWwindow* window); void cleanup(); };