dungeon_crawler

annotate prototype/src/light.h @ 53:1ea56011c1ff

stuff + streaming start
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 19 Sep 2012 01:08:41 +0300
parents 862461b686f4
children aa86119e3295
rev   line source
nuclear@4 1 #ifndef LIGHT_H_
nuclear@4 2 #define LIGHT_H_
nuclear@4 3
nuclear@4 4 #include "color.h"
nuclear@4 5
nuclear@4 6 class Light {
nuclear@4 7 protected:
nuclear@4 8 float intensity;
nuclear@4 9 Color color;
nuclear@4 10
nuclear@38 11 float flicker_offset;
nuclear@38 12
nuclear@23 13 // VBO for rendering the light source
nuclear@23 14 unsigned int vbo;
nuclear@23 15 unsigned int num_faces;
nuclear@23 16
nuclear@23 17 virtual bool create_mesh();
nuclear@23 18
nuclear@4 19 public:
nuclear@4 20 Light(const Color &col = 1.0);
nuclear@4 21 virtual ~Light();
nuclear@4 22
nuclear@4 23 virtual void set_intensity(float val);
nuclear@4 24 virtual void set_color(const Color &col);
nuclear@4 25
nuclear@21 26 virtual Color get_color(bool with_intensity = true) const;
nuclear@21 27
nuclear@4 28 virtual void use(int id = 0) const;
nuclear@23 29
nuclear@23 30 virtual void draw() const;
nuclear@4 31 };
nuclear@4 32
nuclear@4 33 class PointLight : public Light {
nuclear@4 34 protected:
nuclear@4 35 Vector3 pos;
nuclear@4 36 float atten[3];
nuclear@21 37 float radius;
nuclear@4 38
nuclear@23 39 bool create_mesh();
nuclear@23 40
nuclear@4 41 public:
nuclear@4 42 PointLight();
nuclear@4 43 PointLight(const Vector3 &pos, const Color &col = 1.0);
nuclear@4 44
nuclear@4 45 void set_position(const Vector3 &pos);
nuclear@46 46 const Vector3 &get_position() const;
nuclear@46 47
nuclear@4 48 void set_attenuation(float att_const, float att_lin, float att_quad);
nuclear@4 49
nuclear@21 50 void set_radius(float rad);
nuclear@21 51 float get_radius() const;
nuclear@21 52
nuclear@4 53 virtual void use(int id = 0) const;
nuclear@23 54
nuclear@23 55 virtual void draw() const;
nuclear@4 56 };
nuclear@4 57
nuclear@4 58 class DirLight : public Light {
nuclear@4 59 protected:
nuclear@4 60 Vector3 dir;
nuclear@4 61
nuclear@23 62 bool create_mesh();
nuclear@23 63
nuclear@4 64 public:
nuclear@4 65 DirLight();
nuclear@4 66 DirLight(const Vector3 &dir, const Color &col = 1.0);
nuclear@4 67
nuclear@4 68 void set_direction(const Vector3 &dir);
nuclear@46 69 const Vector3 &get_direction() const;
nuclear@4 70
nuclear@4 71 virtual void use(int id = 0) const;
nuclear@4 72 };
nuclear@4 73
nuclear@4 74
nuclear@4 75 void set_light(int id, const Light *lt);
nuclear@4 76
nuclear@4 77
nuclear@4 78 #endif // LIGHT_H_