[ADD] automatic loading of models

This commit is contained in:
Sem van der Hoeven
2021-06-01 13:57:45 +02:00
parent ef466c9d95
commit 658b809ef2
3 changed files with 85 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
#include "entity_shader.h"
#include "../toolbox/toolbox.h"
#include <deque>
namespace shaders
{
@@ -160,6 +161,25 @@ namespace shaders
}
}
void EntityShader::LoadLights(std::deque<entities::Light>& lights) const
{
for (int i = 0; i < MAX_LIGHTS; ++i)
{
if (i < lights.size())
{
LoadVector(location_light_position[i], lights[i].GetPosition());
LoadVector(location_light_color[i], lights[i].GetColor());
LoadVector(location_light_attenuation[i], lights[i].GetAttenuation());
}
else
{
LoadVector(location_light_position[i], glm::vec3(0, 0, 0));
LoadVector(location_light_color[i], glm::vec3(0, 0, 0));
LoadVector(location_light_attenuation[i], glm::vec3(1, 0, 0));
}
}
}
void EntityShader::LoadShineVariables(float shine_damper, float reflectivity) const
{
LoadFloat(location_shine_damper, shine_damper);

View File

@@ -58,6 +58,13 @@ namespace shaders
*/
void LoadLights(std::vector<entities::Light>& lights) const;
/**
* @brief loads some lights contained in a deque.
*
* @param lights the deque containing the lights to load
*/
void LoadLights(std::deque<entities::Light>& lights) const;
/*
* @brief: A method to load the the shine variables from a model into the shader
*