FS2_Open
Open source remastering of the Freespace 2 engine
lighting.cpp File Reference

Go to the source code of this file.

Macros

#define MAX_LIGHT_LEVELS   16
 
#define LM_BRIGHTEN   0
 
#define LM_DARKEN   1
 
#define MIN_LIGHT   0.03f
 
#define AMBIENT_LIGHT_DEFAULT   0.15f
 
#define REFLECTIVE_LIGHT_DEFAULT   0.75f
 

Functions

 DCF (light,"Changes lighting parameters")
 
void light_reset ()
 
void light_set_ambient (float ambient_light)
 
void light_add_directional (const vec3d *dir, float intensity, float r, float g, float b, float spec_r, float spec_g, float spec_b, bool specular)
 
void light_add_point (const vec3d *pos, float r1, float r2, float intensity, float r, float g, float b, int light_ignore_objnum, float spec_r, float spec_g, float spec_b, bool specular)
 
void light_add_point_unique (const vec3d *pos, float r1, float r2, float intensity, float r, float g, float b, int affected_objnum, float spec_r, float spec_g, float spec_b, bool specular)
 
void light_add_tube (const vec3d *p0, const vec3d *p1, float r1, float r2, float intensity, float r, float g, float b, int affected_objnum, float spec_r, float spec_g, float spec_b, bool specular)
 
int light_filter_push (int objnum, const vec3d *pos, float rad)
 
int light_filter_push_box (const vec3d *min, const vec3d *max)
 
void light_filter_pop ()
 
void light_rotate_all ()
 
int light_get_global_count ()
 
int light_get_global_dir (vec3d *pos, int n)
 
void light_set_shadow (int state)
 
void light_set_all_relevent ()
 
ubyte light_apply (const vec3d *pos, const vec3d *norm, float static_light_level)
 
void light_apply_specular (ubyte *param_r, ubyte *param_g, ubyte *param_b, const vec3d *pos, const vec3d *norm, const vec3d *cam)
 
void light_apply_rgb (ubyte *param_r, ubyte *param_g, ubyte *param_b, const vec3d *pos, const vec3d *norm, float static_light_level)
 
void light_add_cone (const vec3d *pos, const vec3d *dir, float angle, float inner_angle, bool dual_cone, float r1, float r2, float intensity, float r, float g, float b, int light_ignore_objnum, float spec_r, float spec_g, float spec_b, bool specular)
 
bool light_compare_by_type (const light &a, const light &b)
 

Variables

light Lights [MAX_LIGHTS]
 
int Num_lights =0
 
int Cmdline_nohtl
 
SCP_vector< light * > Static_light
 
int Lighting_flag = 1
 
vec3d Object_position
 
float static_light_factor = 1.0f
 
float static_tube_factor = 1.0f
 
float static_point_factor = 1.0f
 
double specular_exponent_value = 16.0
 

Macro Definition Documentation

#define AMBIENT_LIGHT_DEFAULT   0.15f

Definition at line 52 of file lighting.cpp.

#define LM_BRIGHTEN   0

Definition at line 40 of file lighting.cpp.

#define LM_DARKEN   1

Definition at line 41 of file lighting.cpp.

#define MAX_LIGHT_LEVELS   16

Definition at line 25 of file lighting.cpp.

#define MIN_LIGHT   0.03f

Definition at line 43 of file lighting.cpp.

#define REFLECTIVE_LIGHT_DEFAULT   0.75f

Definition at line 53 of file lighting.cpp.

Function Documentation

DCF ( light  ,
"Changes lighting parameters"   
)

Definition at line 67 of file lighting.cpp.

void light_add_cone ( const vec3d pos,
const vec3d dir,
float  angle,
float  inner_angle,
bool  dual_cone,
float  r1,
float  r2,
float  intensity,
float  r,
float  g,
float  b,
int  light_ignore_objnum,
float  spec_r,
float  spec_g,
float  spec_b,
bool  specular 
)

Definition at line 1050 of file lighting.cpp.

void light_add_directional ( const vec3d dir,
float  intensity,
float  r,
float  g,
float  b,
float  spec_r,
float  spec_g,
float  spec_b,
bool  specular 
)

Definition at line 209 of file lighting.cpp.

void light_add_point ( const vec3d pos,
float  r1,
float  r2,
float  intensity,
float  r,
float  g,
float  b,
int  light_ignore_objnum,
float  spec_r,
float  spec_g,
float  spec_b,
bool  specular 
)

Definition at line 253 of file lighting.cpp.

void light_add_point_unique ( const vec3d pos,
float  r1,
float  r2,
float  intensity,
float  r,
float  g,
float  b,
int  affected_objnum,
float  spec_r,
float  spec_g,
float  spec_b,
bool  specular 
)

Definition at line 300 of file lighting.cpp.

void light_add_tube ( const vec3d p0,
const vec3d p1,
float  r1,
float  r2,
float  intensity,
float  r,
float  g,
float  b,
int  affected_objnum,
float  spec_r,
float  spec_g,
float  spec_b,
bool  specular 
)

Definition at line 343 of file lighting.cpp.

ubyte light_apply ( const vec3d pos,
const vec3d norm,
float  static_light_level 
)

Definition at line 666 of file lighting.cpp.

void light_apply_rgb ( ubyte param_r,
ubyte param_g,
ubyte param_b,
const vec3d pos,
const vec3d norm,
float  static_light_level 
)

Definition at line 899 of file lighting.cpp.

void light_apply_specular ( ubyte param_r,
ubyte param_g,
ubyte param_b,
const vec3d pos,
const vec3d norm,
const vec3d cam 
)

Definition at line 749 of file lighting.cpp.

bool light_compare_by_type ( const light a,
const light b 
)

Definition at line 1101 of file lighting.cpp.

void light_filter_pop ( )

Definition at line 574 of file lighting.cpp.

int light_filter_push ( int  objnum,
const vec3d pos,
float  rad 
)

Makes a list of only the lights that will affect the sphere specified by 'pos' and 'rad' and 'objnum'

Parameters
objnumObject number
posWorld position
radRadius

Definition at line 416 of file lighting.cpp.

int light_filter_push_box ( const vec3d min,
const vec3d max 
)

Definition at line 526 of file lighting.cpp.

int light_get_global_count ( )

Return the # of global light sources

Definition at line 608 of file lighting.cpp.

int light_get_global_dir ( vec3d pos,
int  n 
)

Fills direction of global light source N in pos.

Parameters
posPosition
nLight source

Returns 0 if there is no global light.

Definition at line 621 of file lighting.cpp.

void light_reset ( )

Definition at line 150 of file lighting.cpp.

void light_rotate_all ( )

Definition at line 585 of file lighting.cpp.

void light_set_all_relevent ( )

Definition at line 644 of file lighting.cpp.

void light_set_ambient ( float  ambient_light)

Definition at line 205 of file lighting.cpp.

void light_set_shadow ( int  state)

Definition at line 638 of file lighting.cpp.

Variable Documentation

int Cmdline_nohtl

Definition at line 438 of file cmdline.cpp.

int Lighting_flag = 1

Definition at line 63 of file lighting.cpp.

light Lights[MAX_LIGHTS]

Definition at line 28 of file lighting.cpp.

int Num_lights =0

Definition at line 29 of file lighting.cpp.

vec3d Object_position

Definition at line 42 of file 3dsetup.cpp.

double specular_exponent_value = 16.0

Definition at line 747 of file lighting.cpp.

SCP_vector<light*> Static_light

Definition at line 36 of file lighting.cpp.

float static_light_factor = 1.0f

Definition at line 744 of file lighting.cpp.

float static_point_factor = 1.0f

Definition at line 746 of file lighting.cpp.

float static_tube_factor = 1.0f

Definition at line 745 of file lighting.cpp.