Tachyon (current)  Current Main Branch
Macros | Functions | Variables
light.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "tachyon.h"
#include "macros.h"
#include "vector.h"
#include "intersect.h"
#include "util.h"
#include "light.h"

Go to the source code of this file.

Macros

#define TACHYON_INTERNAL   1
 
#define LIGHT_PRIVATE
 

Functions

void free_light_special (void *voidlight)
 
directional_lightnewdirectionallight (void *tex, vector dir)
 
point_lightnewpointlight (void *tex, vector ctr, flt rad)
 
point_lightnewspotlight (void *tex, vector ctr, flt rad, vector dir, flt fallstart, flt fallend)
 
void light_set_attenuation (point_light *li, flt Kc, flt Kl, flt Kq)
 
static flt directional_light_shade_diffuse (directional_light *li, shadedata *shadevars)
 
static flt simple_point_light_shade_diffuse (point_light *li, shadedata *shadevars)
 
static flt point_light_shade_diffuse (point_light *li, shadedata *shadevars)
 
static flt light_no_attenuation (void *vli, flt Llen)
 
static flt light_complex_attenuation (void *vli, flt Llen)
 
static flt light_no_falloff (void *vli, vector *L)
 
static flt light_spotlight_falloff (void *vli, vector *L)
 
static int light_bbox (void *obj, vector *min, vector *max)
 
static void light_intersect (const point_light *l, ray *ry)
 
static void light_normal (const point_light *l, const vector *pnt, const ray *incident, vector *N)
 

Variables

static object_methods light_methods
 

Macro Definition Documentation

◆ LIGHT_PRIVATE

#define LIGHT_PRIVATE

Definition at line 23 of file light.c.

◆ TACHYON_INTERNAL

#define TACHYON_INTERNAL   1

Definition at line 16 of file light.c.

Function Documentation

◆ directional_light_shade_diffuse()

static flt directional_light_shade_diffuse ( directional_light li,
shadedata *  shadevars 
)
static

Definition at line 148 of file light.c.

References directional_light_t::dir, and VDOT.

Referenced by free_light_special(), and newdirectionallight().

◆ free_light_special()

void free_light_special ( void *  voidlight)

Definition at line 35 of file light.c.

References directional_light_shade_diffuse(), and light_t::shade_diffuse.

Referenced by rt_deletescene().

◆ light_bbox()

static int light_bbox ( void *  obj,
vector *  min,
vector *  max 
)
static

Definition at line 243 of file light.c.

◆ light_complex_attenuation()

static flt light_complex_attenuation ( void *  vli,
flt  Llen 
)
static

Definition at line 210 of file light.c.

References point_light_t::Kc, point_light_t::Kl, and point_light_t::Kq.

Referenced by light_set_attenuation().

◆ light_intersect()

static void light_intersect ( const point_light l,
ray *  ry 
)
static

Definition at line 248 of file light.c.

References point_light_t::ctr, point_light_t::rad, SQRT, VDOT, and VSUB.

◆ light_no_attenuation()

static flt light_no_attenuation ( void *  vli,
flt  Llen 
)
static

Definition at line 206 of file light.c.

Referenced by newpointlight(), and newspotlight().

◆ light_no_falloff()

static flt light_no_falloff ( void *  vli,
vector *  L 
)
static

Definition at line 219 of file light.c.

Referenced by newpointlight().

◆ light_normal()

static void light_normal ( const point_light l,
const vector *  pnt,
const ray *  incident,
vector *  N 
)
static

Definition at line 275 of file light.c.

References point_light_t::ctr, SQRT, and VDot().

◆ light_set_attenuation()

void light_set_attenuation ( point_light li,
flt  Kc,
flt  Kl,
flt  Kq 
)

◆ light_spotlight_falloff()

static flt light_spotlight_falloff ( void *  vli,
vector *  L 
)
static

Definition at line 224 of file light.c.

References ACOS, point_light_t::fallend, point_light_t::fallstart, point_light_t::spotdir, and VDOT.

Referenced by newspotlight().

◆ newdirectionallight()

directional_light* newdirectionallight ( void *  tex,
vector  dir 
)

◆ newpointlight()

point_light* newpointlight ( void *  tex,
vector  ctr,
flt  rad 
)

◆ newspotlight()

point_light * newspotlight ( void *  tex,
vector  ctr,
flt  rad,
vector  dir,
flt  fallstart,
flt  fallend 
)

◆ point_light_shade_diffuse()

static flt point_light_shade_diffuse ( point_light li,
shadedata *  shadevars 
)
static

◆ simple_point_light_shade_diffuse()

static flt simple_point_light_shade_diffuse ( point_light li,
shadedata *  shadevars 
)
static

Definition at line 161 of file light.c.

References point_light_t::ctr, SQRT, VDOT, and VSUB.

Referenced by newpointlight().

Variable Documentation

◆ light_methods

object_methods light_methods
static
Initial value:
= {
(void (*)(const void *, void *))(light_intersect),
(void (*)(const void *, const void *, const void *, void *))(light_normal),
free
}
static int light_bbox(void *obj, vector *min, vector *max)
Definition: light.c:243
static void light_normal(const point_light *l, const vector *pnt, const ray *incident, vector *N)
Definition: light.c:275
static void light_intersect(const point_light *l, ray *ry)
Definition: light.c:248

Definition at line 26 of file light.c.

Referenced by newdirectionallight(), newpointlight(), and newspotlight().