doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Light.h
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 
29 #ifndef __GAME_LIGHT_H__
30 #define __GAME_LIGHT_H__
31 
32 /*
33 ===============================================================================
34 
35  Generic light.
36 
37 ===============================================================================
38 */
39 
43 
44 class idLight : public idEntity {
45 public:
47 
48  idLight();
49  ~idLight();
50 
51  void Spawn( void );
52 
53  void Save( idSaveGame *savefile ) const; // archives object for save game file
54  void Restore( idRestoreGame *savefile ); // unarchives object from save game file
55 
56  virtual void UpdateChangeableSpawnArgs( const idDict *source );
57  virtual void Think( void );
58  virtual void FreeLightDef( void );
59  virtual bool GetPhysicsToSoundTransform( idVec3 &origin, idMat3 &axis );
60  void Present( void );
61 
62  void SaveState( idDict *args );
63  virtual void SetColor( float red, float green, float blue );
64  virtual void SetColor( const idVec4 &color );
65  virtual void GetColor( idVec3 &out ) const;
66  virtual void GetColor( idVec4 &out ) const;
67  const idVec3 & GetBaseColor( void ) const { return baseColor; }
68  void SetShader( const char *shadername );
69  void SetLightParm( int parmnum, float value );
70  void SetLightParms( float parm0, float parm1, float parm2, float parm3 );
71  void SetRadiusXYZ( float x, float y, float z );
72  void SetRadius( float radius );
73  void On( void );
74  void Off( void );
75  void Fade( const idVec4 &to, float fadeTime );
76  void FadeOut( float time );
77  void FadeIn( float time );
78  void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location );
79  void BecomeBroken( idEntity *activator );
80  qhandle_t GetLightDefHandle( void ) const { return lightDefHandle; }
81  void SetLightParent( idEntity *lparent ) { lightParent = lparent; }
82  void SetLightLevel( void );
83 
84  virtual void ShowEditingDialog( void );
85 
86  enum {
89  };
90 
91  virtual void ClientPredictionThink( void );
92  virtual void WriteToSnapshot( idBitMsgDelta &msg ) const;
93  virtual void ReadFromSnapshot( const idBitMsgDelta &msg );
94  virtual bool ClientReceiveEvent( int event, int time, const idBitMsg &msg );
95 
96 private:
97  renderLight_t renderLight; // light presented to the renderer
98  idVec3 localLightOrigin; // light origin relative to the physics origin
99  idMat3 localLightAxis; // light axis relative to physics axis
100  qhandle_t lightDefHandle; // handle to renderer light def
102  int levels;
106  int count;
112  int fadeEnd;
114 
115 private:
116  void PresentLightDefChange( void );
117  void PresentModelDefChange( void );
118 
119  void Event_SetShader( const char *shadername );
120  void Event_GetLightParm( int parmnum );
121  void Event_SetLightParm( int parmnum, float value );
122  void Event_SetLightParms( float parm0, float parm1, float parm2, float parm3 );
123  void Event_SetRadiusXYZ( float x, float y, float z );
124  void Event_SetRadius( float radius );
125  void Event_Hide( void );
126  void Event_Show( void );
127  void Event_On( void );
128  void Event_Off( void );
129  void Event_ToggleOnOff( idEntity *activator );
130  void Event_SetSoundHandles( void );
131  void Event_FadeOut( float time );
132  void Event_FadeIn( float time );
133 };
134 
135 #endif /* !__GAME_LIGHT_H__ */
void Fade(const idVec4 &to, float fadeTime)
Definition: Light.cpp:596
void BecomeBroken(idEntity *activator)
Definition: Light.cpp:642
virtual void ClientPredictionThink(void)
Definition: Light.cpp:1030
void Event_SetRadiusXYZ(float x, float y, float z)
Definition: Light.cpp:887
byte color[4]
Definition: MegaTexture.cpp:54
void Event_FadeIn(float time)
Definition: Light.cpp:1021
GLsizei const GLfloat * value
Definition: glext.h:3614
~idLight()
Definition: Light.cpp:216
int qhandle_t
Definition: Lib.h:81
int count
Definition: Light.h:106
int currentLevel
Definition: Light.h:103
const idEventDef EV_Light_GetLightParm
void Present(void)
Definition: Light.cpp:737
void SetShader(const char *shadername)
Definition: Light.cpp:498
idVec3 baseColor
Definition: Light.h:104
idMat3 localLightAxis
Definition: Light.h:99
CLASS_PROTOTYPE(idLight)
idVec4 fadeTo
Definition: Light.h:110
void Event_Show(void)
Definition: Light.cpp:916
void Event_SetSoundHandles(void)
Definition: Light.cpp:981
GLint location
Definition: glext.h:3631
void Event_SetLightParm(int parmnum, float value)
Definition: Light.cpp:869
void Event_SetRadius(float radius)
Definition: Light.cpp:896
GLenum GLint GLint y
Definition: glext.h:2849
virtual void Think(void)
Definition: Light.cpp:770
void SetRadiusXYZ(float x, float y, float z)
Definition: Light.cpp:541
Definition: Vector.h:316
void FadeOut(float time)
Definition: Light.cpp:609
void Off(void)
Definition: Light.cpp:580
void Event_ToggleOnOff(idEntity *activator)
Definition: Light.cpp:945
void SetLightParent(idEntity *lparent)
Definition: Light.h:81
void PresentModelDefChange(void)
Definition: Light.cpp:718
GLclampf GLclampf blue
Definition: glext.h:2843
idEntity * lightParent
Definition: Light.h:108
GLenum GLint x
Definition: glext.h:2849
virtual void ShowEditingDialog(void)
Definition: Light.cpp:834
void SetRadius(float radius)
Definition: Light.cpp:553
const idEventDef EV_Light_SetLightParm
void Restore(idRestoreGame *savefile)
Definition: Light.cpp:261
bool breakOnTrigger
Definition: Light.h:105
void SetLightLevel(void)
Definition: Light.cpp:432
virtual bool GetPhysicsToSoundTransform(idVec3 &origin, idMat3 &axis)
Definition: Light.cpp:795
int triggercount
Definition: Light.h:107
void Event_On(void)
Definition: Light.cpp:927
virtual void WriteToSnapshot(idBitMsgDelta &msg) const
Definition: Light.cpp:1039
const idVec3 & GetBaseColor(void) const
Definition: Light.h:67
virtual void UpdateChangeableSpawnArgs(const idDict *source)
Definition: Light.cpp:169
GLsizei GLsizei GLcharARB * source
Definition: glext.h:3633
qhandle_t lightDefHandle
Definition: Light.h:100
void Event_Hide(void)
Definition: Light.cpp:905
virtual void ReadFromSnapshot(const idBitMsgDelta &msg)
Definition: Light.cpp:1078
void SetLightParm(int parmnum, float value)
Definition: Light.cpp:509
idVec3 localLightOrigin
Definition: Light.h:98
Definition: Vector.h:808
Definition: Dict.h:65
void Killed(idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location)
Definition: Light.cpp:633
void Spawn(void)
Definition: Light.cpp:308
void On(void)
Definition: Light.cpp:563
virtual void FreeLightDef(void)
Definition: Light.cpp:806
qhandle_t GetLightDefHandle(void) const
Definition: Light.h:80
void FadeIn(float time)
Definition: Light.cpp:618
void Save(idSaveGame *savefile) const
Definition: Light.cpp:229
void PresentLightDefChange(void)
Definition: Light.cpp:704
virtual bool ClientReceiveEvent(int event, int time, const idBitMsg &msg)
Definition: Light.cpp:1140
int fadeEnd
Definition: Light.h:112
void Event_GetLightParm(int parmnum)
Definition: Light.cpp:856
void Event_FadeOut(float time)
Definition: Light.cpp:1012
Definition: Matrix.h:333
virtual void SetColor(float red, float green, float blue)
Definition: Light.cpp:476
void Event_SetLightParms(float parm0, float parm1, float parm2, float parm3)
Definition: Light.cpp:878
int fadeStart
Definition: Light.h:111
Definition: Str.h:116
void SetLightParms(float parm0, float parm1, float parm2, float parm3)
Definition: Light.cpp:523
virtual void GetColor(idVec3 &out) const
Definition: Light.cpp:453
int levels
Definition: Light.h:102
bool soundWasPlaying
Definition: Light.h:113
idLight()
Definition: Light.cpp:192
void SaveState(idDict *args)
Definition: Light.cpp:818
void Event_SetShader(const char *shadername)
Definition: Light.cpp:847
renderLight_t renderLight
Definition: Light.h:97
Definition: Light.h:44
void Event_Off(void)
Definition: Light.cpp:936
const idEventDef EV_Light_SetLightParms
GLdouble GLdouble z
Definition: glext.h:3067
idStr brokenModel
Definition: Light.h:101
idVec4 fadeFrom
Definition: Light.h:109
GLclampf green
Definition: glext.h:2843