2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
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.
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.
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/>.
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.
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.
26 ===========================================================================
29 #ifndef __GAME_LIGHT_H__
30 #define __GAME_LIGHT_H__
33 ===============================================================================
37 ===============================================================================
40 extern const idEventDef EV_Light_GetLightParm;
41 extern const idEventDef EV_Light_SetLightParm;
42 extern const idEventDef EV_Light_SetLightParms;
44 class idLight : public idEntity {
46 CLASS_PROTOTYPE( idLight );
53 void Save( idSaveGame *savefile ) const; // archives object for save game file
54 void Restore( idRestoreGame *savefile ); // unarchives object from save game file
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 );
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 );
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 );
84 virtual void ShowEditingDialog( void );
87 EVENT_BECOMEBROKEN = idEntity::EVENT_MAXEVENTS,
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 );
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
108 idEntity * lightParent;
113 bool soundWasPlaying;
116 void PresentLightDefChange( void );
117 void PresentModelDefChange( void );
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 );
135 #endif /* !__GAME_LIGHT_H__ */