dungeon_crawler
view prototype/src/light.h @ 14:67ae9fcb802c
loading normal map
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 19 Aug 2012 06:30:18 +0300 |
parents | |
children | 0588f8a1a351 |
line source
1 #ifndef LIGHT_H_
2 #define LIGHT_H_
4 #include "color.h"
6 class Light {
7 protected:
8 float intensity;
9 Color color;
11 public:
12 Light(const Color &col = 1.0);
13 virtual ~Light();
15 virtual void set_intensity(float val);
16 virtual void set_color(const Color &col);
18 virtual void use(int id = 0) const;
19 };
21 class PointLight : public Light {
22 protected:
23 Vector3 pos;
24 float atten[3];
26 public:
27 PointLight();
28 PointLight(const Vector3 &pos, const Color &col = 1.0);
30 void set_position(const Vector3 &pos);
31 void set_attenuation(float att_const, float att_lin, float att_quad);
33 virtual void use(int id = 0) const;
34 };
36 class DirLight : public Light {
37 protected:
38 Vector3 dir;
40 public:
41 DirLight();
42 DirLight(const Vector3 &dir, const Color &col = 1.0);
44 void set_direction(const Vector3 &dir);
46 virtual void use(int id = 0) const;
47 };
50 void set_light(int id, const Light *lt);
53 #endif // LIGHT_H_