47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#ifndef LIGHT_H
|
|
#define LIGHT_H
|
|
|
|
#include <glm/vec3.hpp>
|
|
#include <string>
|
|
|
|
class FrameBuffer;
|
|
class Shader;
|
|
class Scene;
|
|
class Texture;
|
|
|
|
class Light
|
|
{
|
|
private:
|
|
// standard attributes
|
|
glm::vec3 position;
|
|
glm::vec3 direction;
|
|
float angle; // spotlight not supported yet
|
|
glm::vec3 color;
|
|
|
|
bool isDir;
|
|
|
|
// shadowmap attributes
|
|
bool shadowCaster;
|
|
FrameBuffer* shadowMap;
|
|
Shader* shaders[2];
|
|
static const char* vertSource;
|
|
static const char* fragSource;
|
|
public:
|
|
Light();
|
|
void initDirectionnalLight(glm::vec3 dir = glm::vec3(1, 0, 0), glm::vec3 lightColor = glm::vec3(1));
|
|
void initPointLight(glm::vec3 pos = glm::vec3(0), glm::vec3 lightColor = glm::vec3(1));
|
|
// spotlight not supported yet
|
|
//void initSpotLight(glm::vec3 pos = glm::vec3(0), glm::vec3 dir = glm::vec3(1, 0, 0), float spotAngle = 360, glm::vec3 lightColor = glm::vec3(1));
|
|
|
|
bool isDirectionnal();
|
|
glm::vec3 getDir() {return direction;}
|
|
glm::vec3 getPos() {return position;}
|
|
glm::vec3 getColor() {return color;}
|
|
|
|
void initShadowMap(int resWidth, int resHeight);
|
|
void generateShadowMap(Scene* scene);
|
|
Texture* getShadowMap();
|
|
};
|
|
|
|
#endif // LIGHT_H
|