forkkmuopengl/BaseGLProject/SceneContext.h
2019-04-03 15:06:37 +09:00

37 lines
738 B
C++

#pragma once
#include <map>
#include <glm/mat3x3.hpp>
#include <glm/mat4x4.hpp>
#include <glm/vec3.hpp>
#include "Texture.h"
#include "Light.h"
struct SceneContext
{
std::map<std::string, Light> lights;
std::map<std::string, float> floatValues;
glm::mat4x4 viewMatrix;
glm::mat4x4 projectionMatrix;
glm::mat4x4 mvpMatrix;
glm::mat4x4 modelViewMatrix;
glm::mat4x4 modelMatrix;
glm::mat3x3 normalMatrix;
GLuint skybox_tex;
std::map<std::string, Texture> textures;
void adjustSpots()
{
for (auto it : lights)
{
if (it.second.type == Light::SPOT)
{
it.second.location = it.second.location * viewMatrix;
it.second.direction = (viewMatrix * it.second.lookAt - it.second.location * viewMatrix);
}
}
}
};