Nuclide
Software Development Kit for id Tech
light Class Reference

Tool/Server-Entity: Light Source. More...

Inheritance diagram for light:
NSPointTrigger light_environment light_surface

Public Member Functions

void light (void)
 
virtual void Save (float)
 Handles saving a copy of this entity to a given filehandle. More...
 
virtual void Restore (string, string)
 Similar to NSIO::SpawnKey but for save-game fields. More...
 
virtual void SpawnKey (string, string)
 This method handles entity key/value pairs on map load. More...
 
virtual void Spawned (void)
 Called when the entity is fulled initialized. More...
 
virtual void Respawn (void)
 Server: Called when the entity first spawns or when game-logic requests the entity to return to its original spawn state. More...
 
virtual void RestoreComplete (void)
 Called when the entity has been successfully restored from a savegame file. More...
 
virtual void Trigger (entity, triggermode_t)
 Called whenever we're legacy triggered by another object or function. More...
 
virtual void DebugDraw (void)
 

Detailed Description

Tool/Server-Entity: Light Source.

QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) LFL_LINEAR x LFL_DARK LFL_NOGRID x x

OVERVIEW

Infinitely small point of light illuminating the scene.

KEYS

  • "targetname" : Name
  • "target" : When set, targets an enity instead, becoming a spotlight
  • "light" : Light intensity value. Default is '300'
  • "color" : Normalized RGB color value. Default is [1,1,1]
  • "color255" : RGB255 color value. e.g. '255 255 255' for white
  • "extradist" : The additional distance it should attempt to travel.
  • "radius" : Sets the light cone radius for spotlights. Default is '64'
  • "fade" : Sets the fade-distance of a light when LFL_LINEAR is set
  • "anglescale" : Sets the light angle scale of non-linear lights
  • "deviance" : Sets the deviance, jitter effect for each light sample.
  • "samples" : Number of light samples. This also needs to be set > 0.0 for deviance to work.
  • "filter" : Setting to blur the light/shadows resulting from this light.
  • "start_active" : Set to either 0 or 1 to tell the light in what mode to start in.
  • "style" : Light style ID. 0-11 are defined, 12-32 are reserved for switched lights. List of pre-defined styles: 0 = Normal 1 = Flicker A 2 = Slow strong pulse 3 = Candle A 4 = Fast strobe 5 = Gentle pulse 6 = Flicker B 7 = Candle B 8 = Candle C 9 = Slow strobe 10 = Fluorescent flicker 11 = Slow pulse, no black "pattern" : Custom light style pattern. Needs unique light style ID. Patterns are defined with letters of the alphabet. 'a' being dark. 'z' being fully lit. Can be a string of characters that'll interpolate between at 10 FPS ingame.

SPAWNFLAGS

  • LFL_LINEAR (1) : Use linear falloff instead of inverse-square falloff.
  • LFL_DARK (4) : Darken, instead of lighting the lightmap.
  • LFL_NOGRID (8) : This light does not affect the lightgrid.

NOTES

In idTech 2/GoldSrc etc. spawnflag 1 means a light starts off. This doesn't exist in idTech3 because lightstyles were not a thing. To avoid huge amounts of lightmap abuse, please consider using light_dynamic or env_projectedtexture for toggled or flickering lights.

TRIVIA

This entity was introduced in Quake (1996).

Constructor & Destructor Documentation

◆ light()

void light::light ( void  )

Member Function Documentation

◆ DebugDraw()

void light::DebugDraw ( void  )
virtual

Reimplemented from NSPointTrigger.

◆ Respawn()

void light::Respawn ( void  )
virtual

Server: Called when the entity first spawns or when game-logic requests the entity to return to its original spawn state.

Reimplemented from NSPointTrigger.

Reimplemented in light_environment.

◆ Restore()

void light::Restore ( string  strKey,
string  strValue 
)
virtual

Similar to NSIO::SpawnKey but for save-game fields.

Whatever you write into file handles within your NSIO::Save() method needs to be read back in here.

Reimplemented from NSPointTrigger.

◆ RestoreComplete()

void light::RestoreComplete ( void  )
virtual

Called when the entity has been successfully restored from a savegame file.

Reimplemented from NSIO.

◆ Save()

void light::Save ( float  handle)
virtual

Handles saving a copy of this entity to a given filehandle.

Within you want to use the NSIO::SaveFloat() etc. methods to write the internal member attributes to the specified file handle.

Reimplemented from NSPointTrigger.

◆ Spawned()

void light::Spawned ( void  )
virtual

Called when the entity is fulled initialized.

Any spawn key/value info pairs have already been dealt with. So now we can make full decisions on the entity. Always make sure to call super::Spawned(); inside your method when overriding.

Reimplemented from NSEntity.

Reimplemented in light_environment.

◆ SpawnKey()

void light::SpawnKey ( string  strKey,
string  strValue 
)
virtual

This method handles entity key/value pairs on map load.

You can easily convert the strValue parameter using the ReadFloat etc. methods that are part of NSIO.

Reimplemented from NSPointTrigger.

Reimplemented in light_environment, and light_environment.

◆ Trigger()

void light::Trigger ( entity  act,
triggermode_t  state 
)
virtual

Called whenever we're legacy triggered by another object or function.

Reimplemented from NSTrigger.


The documentation for this class was generated from the following file: