forked from lokesh-sharma/GameEngine
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSkyBoxShader.h
More file actions
30 lines (26 loc) · 959 Bytes
/
SkyBoxShader.h
File metadata and controls
30 lines (26 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef SKYBOXSHADER_H_INCLUDED
#define SKYBOXSHADER_H_INCLUDED
#include"Light.h"
#include"shader.h"
#include"string"
#include <glm/gtc/type_ptr.hpp>
class SkyBoxShader : public Shader
{
public:
SkyBoxShader(const std::string fileName) : Shader(fileName , false)
{
m_uniforms["projection"] = glGetUniformLocation(m_program , "projection");
m_uniforms["fogColor"] = glGetUniformLocation(m_program , "fogColor");
}
void UpdateSkyBox(const Camera&c , RenderingEngine* renderer)
{
glm::mat4 proj = c.getProjection();
glm::mat4 view = glm::mat4_cast(glm::conjugate(c.getRot()));
// glm::mat4 view = glm::mat4(glm::mat3(c.getModel()));
setUniformMatrix4f("projection" , &proj[0][0]);
setUniformMatrix4f("Model" , &view[0][0]);
glm::vec4 fc = renderer->getFogColor();
setUniformVector4f("fogColor" , fc.x , fc.y , fc.z , fc.w);
}
};
#endif // SKYBOXSHADER_H_INCLUDED