29 #include "../idlib/precompiled.h"
81 bool gotTarget, gotUp, gotRight;
85 memset( renderLight, 0,
sizeof( *renderLight ) );
87 if (!args->GetVector(
"light_origin",
"", renderLight->origin)) {
88 args->GetVector(
"origin",
"", renderLight->origin );
91 gotTarget = args->GetVector(
"light_target",
"", renderLight->target );
92 gotUp = args->GetVector(
"light_up",
"", renderLight->up );
93 gotRight = args->GetVector(
"light_right",
"", renderLight->right );
94 args->GetVector(
"light_start",
"0 0 0", renderLight->start );
95 if ( !args->GetVector(
"light_end",
"", renderLight->end ) ) {
96 renderLight->end = renderLight->target;
100 if ( ( gotTarget || gotUp || gotRight ) != ( gotTarget && gotUp && gotRight ) ) {
102 renderLight->origin[0], renderLight->origin[1], renderLight->origin[2] );
107 renderLight->pointLight =
true;
110 args->GetVector(
"light_center",
"0 0 0", renderLight->lightCenter );
113 if (!args->GetVector(
"light_radius",
"300 300 300", renderLight->lightRadius ) ) {
116 args->GetFloat(
"light",
"300", radius );
117 renderLight->lightRadius[0] = renderLight->lightRadius[1] = renderLight->lightRadius[2] = radius;
124 if ( !args->GetMatrix(
"light_rotation",
"1 0 0 0 1 0 0 0 1", mat ) ) {
125 if ( !args->GetMatrix(
"rotation",
"1 0 0 0 1 0 0 0 1", mat ) ) {
126 args->GetFloat(
"angle",
"0", angles[ 1 ] );
135 mat[0].FixDegenerateNormal();
136 mat[1].FixDegenerateNormal();
137 mat[2].FixDegenerateNormal();
139 renderLight->axis = mat;
142 args->GetVector(
"_color",
"1 1 1", color );
152 args->GetFloat(
"shaderParm5",
"0", renderLight->shaderParms[5] );
153 args->GetFloat(
"shaderParm6",
"0", renderLight->shaderParms[6] );
154 args->GetFloat(
"shaderParm7",
"0", renderLight->shaderParms[
SHADERPARM_MODE ] );
155 args->GetBool(
"noshadows",
"0", renderLight->noShadows );
156 args->GetBool(
"nospecular",
"0", renderLight->noSpecular );
157 args->GetBool(
"parallel",
"0", renderLight->parallel );
159 args->GetString(
"texture",
"lights/squarelight1", &texture );
262 bool hadPrelightModel;
266 savefile->
ReadBool( hadPrelightModel );
272 gameLocal.
Error(
"idLight::Restore: prelightModel '_prelight_%s' not found",
name.c_str() );
311 const char *demonic_shader;
394 pos = model.
Find(
"." );
511 gameLocal.
Error(
"shader parm index (%d) out of range", parmnum );
624 color4.
Set( color.
x, color.
y, color.
z, 1.0f );
625 Fade( color4, time );
643 const char *damageDefName;
692 if ( parm && *parm ) {
820 for ( i = 0; i <
c; i++ ) {
822 if ( pv->
GetKey().
Find(
"editor_",
false ) >= 0 || pv->
GetKey().
Find(
"parse_",
false ) >= 0 ) {
858 gameLocal.
Error(
"shader parm index (%d) out of range", parmnum );
990 targetEnt =
targets[
i ].GetEntity();
991 if ( targetEnt && targetEnt->
IsType( idLight::Type ) ) {
virtual const idVec3 & GetOrigin(int id=0) const =0
void Fade(const idVec4 &to, float fadeTime)
void FreeSoundEmitter(bool immediate)
void BecomeBroken(idEntity *activator)
virtual void ClientPredictionThink(void)
void Event_SetRadiusXYZ(float x, float y, float z)
void Event_FadeIn(float time)
renderEntity_t renderEntity
GLsizei const GLfloat * value
int ReadShort(void) const
void WriteString(const char *string)
int GetInt(const char *key, const char *defaultString="0") const
virtual void InitTool(const toolFlag_t tool, const idDict *dict)=0
void WriteBindToSnapshot(idBitMsgDelta &msg) const
assert(prefInfo.fullscreenBtn)
virtual const idSoundShader * FindSound(const char *name, bool makeDefault=true)=0
virtual bool CurrentlyPlaying(void) const =0
virtual void FreeLightDef(qhandle_t lightHandle)=0
void SetShader(const char *shadername)
idMat3 mat3_identity(idVec3(1, 0, 0), idVec3(0, 1, 0), idVec3(0, 0, 1))
virtual void SetContents(int contents, int id=-1)=0
const idEventDef EV_PostSpawn("<postspawn>", NULL)
void WriteObject(const idClass *obj)
idVec3 GetCenter(void) const
void Printf(const char *fmt,...) const id_attribute((format(printf
struct idEntity::entityFlags_s fl
const idStr & GetKey(void) const
const idEventDef EV_Activate("activate","e")
void Event_SetSoundHandles(void)
virtual qhandle_t AddEntityDef(const renderEntity_t *re)=0
const idEventDef EV_Light_GetLightParm("getLightParm","d", 'f')
idMat3 Transpose(void) const
void void void void void Error(const char *fmt,...) const id_attribute((format(printf
void Event_SetLightParm(int parmnum, float value)
const idEventDef EV_Light_SetRadius("setRadius","f")
void UnpackColor(const dword color, idVec4 &unpackedColor)
bool IsType(const idTypeInfo &c) const
void Set(const float x, const float y, const float z)
void Event_SetRadius(float radius)
void WriteVec4(const idVec4 &vec)
const idMaterial * referenceShader
idList< idEntityPtr< idEntity > > targets
const idEventDef EV_Light_FadeOut("fadeOutLight","f")
void RadiusDamage(const idVec3 &origin, idEntity *inflictor, idEntity *attacker, idEntity *ignoreDamage, idEntity *ignorePush, const char *damageDefName, float dmgPower=1.0f)
const idEventDef EV_Light_FadeIn("fadeInLight","f")
void SetRadiusXYZ(float x, float y, float z)
void ReadBool(bool &value)
const int SHADERPARM_GREEN
const char * Left(int len, idStr &result) const
dword PackColor(const idVec4 &color)
void Event_ToggleOnOff(idEntity *activator)
void PresentModelDefChange(void)
idSoundEmitter * GetSoundEmitter(void) const
virtual qhandle_t AddLightDef(const renderLight_t *rlight)=0
virtual const idMaterial * FindMaterial(const char *name, bool makeDefault=true)=0
void Set(const char *key, const char *value)
virtual void ShowEditingDialog(void)
void WriteVec3(const idVec3 &vec)
bool HasChanged(void) const
void SetRadius(float radius)
virtual void SetModel(const char *modelname)
void Restore(idRestoreGame *savefile)
virtual bool GetPhysicsToSoundTransform(idVec3 &origin, idMat3 &axis)
const int SHADERPARM_ALPHA
#define EVENT(event, function)
const int MAX_ENTITY_SHADER_PARMS
virtual void WriteToSnapshot(idBitMsgDelta &msg) const
void WriteBool(const bool value)
idCVar developer("developer","0", CVAR_GAME|CVAR_BOOL,"")
float shaderParms[MAX_ENTITY_SHADER_PARMS]
bool IsHidden(void) const
const int SHADERPARM_TIMESCALE
virtual void UpdateChangeableSpawnArgs(const idDict *source)
void void void Warning(const char *fmt,...) const id_attribute((format(printf
GLsizei GLsizei GLcharARB * source
const idEventDef EV_Show("show", NULL)
bool StartSoundShader(const idSoundShader *shader, const s_channelType channel, int soundShaderFlags, bool broadcast, int *length)
const int SHADERPARM_BLUE
void WriteColorToSnapshot(idBitMsgDelta &msg) const
GLuint GLuint GLsizei count
virtual void ReadFromSnapshot(const idBitMsgDelta &msg)
const idEventDef EV_Light_On("On", NULL)
virtual void ReadFromSnapshot(const idBitMsgDelta &msg)=0
idPhysics * GetPhysics(void) const
void SetLightParm(int parmnum, float value)
const int SHADERPARM_MODE
const char * GetString(const char *key, const char *defaultString="") const
idSoundEmitter * referenceSound
void ReadRenderLight(renderLight_t &renderLight)
bool GetBool(const char *key, const char *defaultString="0") const
virtual void UpdateChangeableSpawnArgs(const idDict *source)
static float AngleNormalize360(float angle)
void Killed(idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location)
virtual const idDecl * FindType(declType_t type, const char *name, bool makeDefault=true)=0
int GetInteger(void) const
idVec3 GetVector(const char *key, const char *defaultString=NULL) const
void ServerSendEvent(int eventId, const idBitMsg *msg, bool saveEvent, int excludeClient) const
const idEventDef EV_Hide("hide", NULL)
const idEventDef EV_Light_Off("Off", NULL)
static void ReturnFloat(float value)
void ReadVec4(idVec4 &vec)
const idStr & GetValue(void) const
virtual const idSoundShader * GetAltSound() const
virtual const idMat3 & GetAxis(int id=0) const =0
const idSoundShader * shader
virtual void UpdateEntityDef(qhandle_t entityHandle, const renderEntity_t *re)=0
virtual void FreeLightDef(void)
int Find(const char c, int start=0, int end=-1) const
const int SHADERPARM_TIMEOFFSET
virtual void UpdateLightDef(qhandle_t lightHandle, const renderLight_t *rlight)=0
virtual int StartSound(const idSoundShader *shader, const s_channelType channel, float diversity=0, int shaderFlags=0, bool allowSlow=true)=0
void Save(idSaveGame *savefile) const
void WriteInt(const int value)
virtual void Present(void)
const idEventDef EV_Light_SetRadiusXYZ("setRadiusXYZ","fff")
idDeclManager * declManager
const idEventDef EV_Light_SetLightParms("setLightParms","ffff")
void WriteMat3(const idMat3 &mat)
void PresentLightDefChange(void)
virtual bool ClientReceiveEvent(int event, int time, const idBitMsg &msg)
void ReadMat3(idMat3 &mat)
virtual bool ClientReceiveEvent(int event, int time, const idBitMsg &msg)
void Event_GetLightParm(int parmnum)
idRenderModelManager * renderModelManager
idRenderModel * prelightModel
void Event_FadeOut(float time)
virtual void WriteToSnapshot(idBitMsgDelta &msg) const =0
virtual void SetColor(float red, float green, float blue)
void Lerp(const idVec4 &v1, const idVec4 &v2, const float l)
bool IsGametypeFlagBased(void)
idMat3 ToMat3(void) const
void Event_SetLightParms(float parm0, float parm1, float parm2, float parm3)
#define CLASS_DECLARATION(nameofsuperclass, nameofclass)
void SetLightParms(float parm0, float parm1, float parm2, float parm3)
virtual void GetColor(idVec3 &out) const
virtual void SetClipModel(idClipModel *model, float density, int id=0, bool freeOld=true)=0
void ReadVec3(idVec3 &vec)
class idSoundEmitter * referenceSound
const char * c_str(void) const
void SaveState(idDict *args)
virtual void ParseSpawnArgsToRenderLight(const idDict *args, renderLight_t *renderLight)
void BecomeActive(int flags)
idCVar g_editEntityMode("g_editEntityMode","0", CVAR_GAME|CVAR_INTEGER,"0 = off\n""1 = lights\n""2 = sounds\n""3 = articulated figures\n""4 = particle systems\n""5 = monsters\n""6 = entity names\n""7 = entity models", 0, 7, idCmdSystem::ArgCompletion_Integer< 0, 7 >)
const idEventDef EV_Light_SetLightParm("setLightParm","df")
const idKeyValue * GetKeyVal(int index) const
const idVec3 & ToVec3(void) const
void ReadColorFromSnapshot(const idBitMsgDelta &msg)
float ReadFloat(void) const
void Event_SetShader(const char *shadername)
renderLight_t renderLight
static cmHandle_t CheckModel(const char *name)
virtual idRenderModel * CheckModel(const char *modelName)=0
virtual void ParseSpawnArgsToRefSound(const idDict *args, refSound_t *refSound)
idRenderWorld * gameRenderWorld
char * va(const char *fmt,...)
void ReadBindFromSnapshot(const idBitMsgDelta &msg)
bool PostEventMS(const idEventDef *ev, int time)
idSoundEmitter * referenceSound
const idMaterial * shader
int GetNumKeyVals(void) const
void Set(const float x, const float y, const float z, const float w)
float shaderParms[MAX_ENTITY_SHADER_PARMS]
void ReadString(idStr &string)
void BecomeInactive(int flags)
void WriteRenderLight(const renderLight_t &renderLight)
void ActivateTargets(idEntity *activator) const
void StopSound(const s_channelType channel, bool broadcast)
void ReadObject(idClass *&obj)
const idEventDef EV_Light_SetShader("setShader","s")