![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
#include "machine.h"#include "types.h"#include "macros.h"#include "vector.h"#include "intersect.h"#include "util.h"#include "light.h"
Include dependency graph for light.cpp:Go to the source code of this file.
Defines | |
| #define | LIGHT_PRIVATE |
Functions | |
| static int | light_bbox (void *obj, vector *min, vector *max) |
| static void | light_intersect (point_light *l, ray *ry) |
| static void | light_normal (point_light *l, vector *pnt, ray *incident, vector *N) |
| point_light * | newlight (void *tex, vector ctr, flt rad) |
Variables | |
| static object_methods | light_methods |
| #define LIGHT_PRIVATE |
| static void light_intersect | ( | point_light * | l, |
| ray * | ry | ||
| ) | [static] |
Definition at line 99 of file light.cpp.
References add_intersection(), point_light::ctr, ray::d, ray::flags, ray::o, point_light::rad, RT_RAY_SHADOW, SPEPSILON, V, VDOT, and VSUB.
{
flt b, disc, t1, t2, temp;
vector V;
/* Lights do not cast shadows.. */
if (ry->flags & RT_RAY_SHADOW)
return;
VSUB(l->ctr, ry->o, V);
VDOT(b, V, ry->d);
VDOT(temp, V, V);
disc=b*b + l->rad*l->rad - temp;
if (disc<=0.0) return;
disc=sqrt(disc);
t2=b+disc;
if (t2 <= SPEPSILON)
return;
add_intersection(t2, (object *) l, ry);
t1=b-disc;
if (t1 > SPEPSILON)
add_intersection(t1, (object *) l, ry);
}
| static void light_normal | ( | point_light * | l, |
| vector * | pnt, | ||
| ray * | incident, | ||
| vector * | N | ||
| ) | [static] |
| point_light* newlight | ( | void * | tex, |
| vector | ctr, | ||
| flt | rad | ||
| ) |
Definition at line 81 of file light.cpp.
References point_light::ctr, light_methods, point_light::methods, point_light::rad, rt_getmem(), and point_light::tex.
Referenced by rt_light().
{
point_light * l;
l=(point_light *) rt_getmem(sizeof(point_light));
memset(l, 0, sizeof(point_light));
l->methods = &light_methods;
l->tex=(texture *)tex;
l->ctr=ctr;
l->rad=rad;
return l;
}
object_methods light_methods [static] |
{
(void (*)(void *, void *))(light_intersect),
(void (*)(void *, void *, void *, void *))(light_normal),
light_bbox,
free
}
Definition at line 74 of file light.cpp.
Referenced by newlight().
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.