source: golgotha/src/golg/objs/light_o.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.1 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef G1_LIGHT_OBJECT_HH
10#define G1_LIGHT_OBJECT_HH
11
12#include "g1_object.hh"
13#include "g1_render.hh"
14#include "objs/model_draw.hh"
15
16extern g1_object_type g1_lightbulb_type;
17
18
19class g1_light_object_class : public g1_object_class
20{
21public:
22  static g1_light_object_class *cast(g1_object_class *obj)
23  {
24    if (!obj || obj->id != g1_lightbulb_type)
25    {
26#ifdef I4_CAST_WARN
27      i4_warning("bad cast to lightbulb_obj!\n");
28#endif
29      return 0;
30    }
31   
32    return (g1_light_object_class *)obj;
33  }
34
35  i4_float r,g,b;                      // 0..1 if colored lighting supported
36  i4_float white;                      // 0..1 if only white light supported
37
38  // light atenuation formula = min(1/(c1 + c2*d + c3*d*d),1)
39  i4_float c1,c2,c3;                   // 0..1 light antenuation values
40
41  g1_light_object_class *next;   // next point source light in list
42
43  sw32 change_radius;
44  w32 *add_intensities;
45
46
47  enum { DATA_VERSION=0 };
48
49  g1_light_object_class(g1_object_type id, g1_loader_class *fp);
50
51  void save(g1_saver_class *fp);
52
53  virtual i4_bool occupy_location();
54  virtual void unoccupy_location();
55 
56  void setup(float _x, float _y, float _h,
57             float _r, float _g, float _b, float _white,
58             float min_light_contribute=0.05,
59             float linear_contribute=0.25,
60             float geometric_contribute=0.5);
61
62  void move(float new_x, float new_y, float new_h);
63           
64  virtual void draw(g1_draw_context_class *context);
65  virtual void think();
66  ~g1_light_object_class();
67};
68
69extern g1_object_type g1_lightbulb_type;
70
71#endif
Note: See TracBrowser for help on using the repository browser.