Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gl_light.h
Go to the documentation of this file.
1 #ifndef _GL_LIGHT_H_
2 #define _GL_LIGHT_H_
3 #include "gfxlib.h"
4 #include "hashtable_3d.h"
5 #include "gl_globals.h"
6 extern GLint GFX_MAX_LIGHTS;
7 extern GLint GFX_OPTIMAL_LIGHTS;
8 extern GFXBOOL GFXLIGHTING;
9 #define GFX_ATTENUATED 1
10 //#define GFX_DIFFUSE 2
11 //#define GFX_SPECULAR 4
12 //#define GFX_AMBIENT 8
13 //#define GFX_LIGHT_POS 16
14 #define GFX_LIGHT_ENABLED 32
15 #define GFX_LOCAL_LIGHT 64
16 const unsigned int lighthuge = 20*20*20;
23 class gfx_light : public GFXLight
24 {
25 public: gfx_light() : GFXLight() {}
27  GFXLight operator=( const GFXLight &tmp );
29  int lightNum();
31  bool LocalLight() const
32  {
33  return (options&GFX_LOCAL_LIGHT) != 0;
34  }
36  bool enabled() const
37  {
38  return (options&GFX_LIGHT_ENABLED) != 0;
39  }
41  int& Target()
42  {
43  return target;
44  }
45 
50  bool Create( const GFXLight&, bool global );
51 
53  void Kill();
54 
56  void SendGLPosition( const GLenum target ) const;
57 
59  void ClobberGLLight( const int target );
60 
62  inline void FinesseClobberLight( const GLenum target, const int original );
63 
65  inline void ContextSwitchClobberLight( const GLenum target, const int original ) const;
66 
71  void Enable();
72 
77  void Disable();
82  void ResetProperties( const enum LIGHT_TARGET, const GFXColor &color );
83 
85  void AddToTable();
86 
88  bool RemoveFromTable( bool shouldremove = true, const GFXLight &t = GFXLight() );
89 
91  void TrashFromGLLights();
92 
94  static void dopickenables();
96  LineCollide CalculateBounds( bool &err );
97 };
98 
99 namespace OpenGLL
100 {
102 const char GLL_OFF = 0;
104 const char GLL_ON = 1;
106 const char GLL_LOCAL = 2;
108 const char GL_ENABLED = 4;
109 }
110 
112 {
114  int index;
116  char options;
117 };
119 void light_rekey_frame();
121 void unpicklights();
122 void removelightfromnewpick(int whichlight);
124 extern int _currentContext;
126 extern vector< vector< gfx_light > >_local_lights_dat;
128 extern vector< GFXColor > _ambient_light;
130 extern vector< gfx_light > *_llights;
132 extern int _GLLightsEnabled;
133 
135 extern OpenGLLights *GLLights;
136 
139 {
142  {
143  lc = NULL;
144  }
145  bool operator==( const LineCollideStar &b ) const
146  {
147  return lc->object.i == b.lc->object.i;
148  }
149  bool operator<( const LineCollideStar &b ) const
150  {
151  return *( (int*) &(lc->object.i) ) < *( (int*) &(b.lc->object.i) );
152  }
153  inline int GetIndex()
154  {
155  return *( (int*) (&lc->object.i) );
156  }
157 };
160 
161 #define CTACC 40000
164 
166 extern float intensity_cutoff;
168 extern float optintense;
169 extern float optsat;
170 
171 #endif
172