Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Light.cpp
Go to the documentation of this file.
1
/* Project nGenEx
2
Destroyer Studios LLC
3
Copyright © 1997-2004. All Rights Reserved.
4
5
SUBSYSTEM: nGenEx.lib
6
FILE: Light.cpp
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
Dynamic Light Source
13
*/
14
15
#include "
MemDebug.h
"
16
#include "
Light.h
"
17
#include "
Scene.h
"
18
19
// +--------------------------------------------------------------------+
20
21
int
Light::id_key
= 1;
22
23
// +--------------------------------------------------------------------+
24
25
Light::Light
(
float
l,
float
dl,
int
time)
26
: id(id_key++), type(LIGHT_POINT), life(time),
27
light(l), dldt(dl), color(255,255,255),
28
active(true), shadow(false), scene(0)
29
{ }
30
31
// +--------------------------------------------------------------------+
32
33
Light::~Light
()
34
{ }
35
36
// +--------------------------------------------------------------------+
37
38
void
39
Light::Update
()
40
{
41
if
(
dldt
< 1.0f)
42
light
*=
dldt
;
43
44
if
(
life
> 0)
life
--;
45
}
46
47
// +--------------------------------------------------------------------+
48
49
void
50
Light::Destroy
()
51
{
52
if
(
scene
)
53
scene
->
DelLight
(
this
);
54
55
delete
this
;
56
}
57
58
// +--------------------------------------------------------------------+
59
60
void
61
Light::MoveTo
(
const
Point
& dst)
62
{
63
//if (type != LIGHT_DIRECTIONAL)
64
loc
= dst;
65
}
66
67
void
68
Light::TranslateBy
(
const
Point
& ref)
69
{
70
if
(
type
!=
LIGHT_DIRECTIONAL
)
71
loc
=
loc
- ref;
72
}
nGenEx
Light.cpp
Generated on Thu May 31 2012 16:30:55 for Starshatter_Open by
1.8.1