[ADD] added deque support for light loading

This commit is contained in:
Sem van der Hoeven
2021-06-01 14:06:28 +02:00
parent 658b809ef2
commit 8d52703297
2 changed files with 2 additions and 10 deletions

View File

@@ -20,7 +20,6 @@ namespace scene
{ {
std::deque<entities::Entity> entites; std::deque<entities::Entity> entites;
std::deque<entities::Light> lights; std::deque<entities::Light> lights;
entities::Light sun;
models::RawModel raw_model; models::RawModel raw_model;
models::ModelTexture texture; models::ModelTexture texture;
@@ -51,8 +50,6 @@ namespace scene
} }
int z_offset = model_pos * (model.raw_model.model_size.x * 20); // how much "in the distance" we should load the model int z_offset = model_pos * (model.raw_model.model_size.x * 20); // how much "in the distance" we should load the model
entites.push_front(entities::Entity(model, glm::vec3(0, -50, -50 - z_offset), glm::vec3(0, 90, 0), 20)); entites.push_front(entities::Entity(model, glm::vec3(0, -50, -50 - z_offset), glm::vec3(0, 90, 0), 20));
} }
@@ -76,7 +73,7 @@ namespace scene
load_chunk(i); load_chunk(i);
} }
sun = entities::Light(glm::vec3(0, 1000, -7000), glm::vec3(5, 5, 5)); lights.push_back(entities::Light(glm::vec3(0, 1000, -7000), glm::vec3(5, 5, 5)));
lights.push_back(entities::Light(glm::vec3(0, 0, -30), glm::vec3(2, 0, 2), glm::vec3(0.0001f, 0.0001f, 0.0001f))); lights.push_back(entities::Light(glm::vec3(0, 0, -30), glm::vec3(2, 0, 2), glm::vec3(0.0001f, 0.0001f, 0.0001f)));
lights.push_back(entities::Light(glm::vec3(0, 0, -200), glm::vec3(0, 2, 0), glm::vec3(0.0001f, 0.0001f, 0.0001f))); lights.push_back(entities::Light(glm::vec3(0, 0, -200), glm::vec3(0, 2, 0), glm::vec3(0.0001f, 0.0001f, 0.0001f)));
@@ -116,12 +113,6 @@ namespace scene
shader->LoadLights(lights); shader->LoadLights(lights);
shader->LoadViewMatrix(camera); shader->LoadViewMatrix(camera);
// Renders each entity in the entities list
/*for (entities::Entity& entity : entities)
{
render_engine::renderer::Render(entity, *shader);
}*/
for (entities::Entity& model_entity : entites) for (entities::Entity& model_entity : entites)
{ {
render_engine::renderer::Render(model_entity, *shader); render_engine::renderer::Render(model_entity, *shader);

View File

@@ -2,6 +2,7 @@
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <vector> #include <vector>
#include <deque>
#include "shader_program.h" #include "shader_program.h"
#include "../entities/camera.h" #include "../entities/camera.h"
#include "../entities/light.h" #include "../entities/light.h"