LibGame  v0.4.0
The LG Game Engine - Copyright (C) 2024 ETMSoftware
lg_light.c File Reference

Functions

LG_Light lg_light (lg_light_type type, vec3_t pos_or_dir, LG_Color_f color)
 
void lg_set_light_src (LG_Light *light, vec3_t pos)
 
vec3_t lg_get_light_src (LG_Light *light)
 
void lg_move_light_src (LG_Light *light, vec3_t delta)
 
void lg_set_light_dir (LG_Light *light, vec3_t dir)
 
vec3_t lg_get_light_dir (LG_Light *light)
 
void lg_change_light_dir (LG_Light *light, LG_EulerAng angle, const char *rot_order)
 

Detailed Description

=== It's all about scene lights position, direction, color ===

Use an array of LG_Light structs if you want to have several different lights in a scene

 - Point lighting - vec3_t as a position
 - Directional lighting - vec3_t as an orientation

Function Documentation

◆ lg_light()

LG_Light lg_light ( lg_light_type  type,
vec3_t  pos_or_dir,
LG_Color_f  color 
)

Return a new LG_Light

Parameters
typeLight type (lg_light_type enum), one of POINT, DIRECTIONAL, SPOTLIGHT, AMBIENT, DIFFUSE, EMISSIVE, SPECULAR
pos_or_dirSource of light (vec3_t) in case of POINT light or light orientation (vec3_t) in case of DIRECTIONAL light
colorLight color
Returns
A new LG_Light

◆ lg_set_light_src()

void lg_set_light_src ( LG_Light light,
vec3_t  pos 
)

Set light source position

Parameters
lightA LG_Light
posLight source pos

◆ lg_get_light_src()

vec3_t lg_get_light_src ( LG_Light light)

Read light source position

Parameters
lightA LG_Light
Returns
Light source pos

◆ lg_move_light_src()

void lg_move_light_src ( LG_Light light,
vec3_t  delta 
)

Move light source position by delta

Parameters
lightA LG_Light
deltaTranslation vector

◆ lg_set_light_dir()

void lg_set_light_dir ( LG_Light light,
vec3_t  dir 
)

Set light orientation

Parameters
lightA LG_Light
dirLight dir

◆ lg_get_light_dir()

vec3_t lg_get_light_dir ( LG_Light light)

Read light orientation

Parameters
lightA LG_Light
Returns
Light dir

◆ lg_change_light_dir()

void lg_change_light_dir ( LG_Light light,
LG_EulerAng  angle,
const char *  rot_order 
)

Change light orientation by rotating by Euler angle

Parameters
lightA LG_Light
rotRotation to apply (Euler angle)
rot_orderRotation order, one of "XYZ", "YXZ", "ZXY", "ZYX", "YZX", "XZY"