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.h
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.h
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
Dynamic Light Source
13
*/
14
15
#ifndef Light_h
16
#define Light_h
17
18
#include "
Geometry.h
"
19
#include "
Color.h
"
20
21
// +--------------------------------------------------------------------+
22
23
#define LIGHT_DESTROY(x) if (x) { x->Destroy(); x = 0; }
24
25
// +--------------------------------------------------------------------+
26
27
class
Scene
;
28
29
// +--------------------------------------------------------------------+
30
31
class
Light
32
{
33
public
:
34
static
const
char
*
TYPENAME
() {
return
"Light"
; }
35
36
enum
TYPES
{
37
LIGHT_POINT
= 1,
38
LIGHT_SPOT
= 2,
39
LIGHT_DIRECTIONAL
= 3,
40
LIGHT_FORCE_DWORD
= 0x7fffffff
41
};
42
43
Light
(
float
l=0.0f,
float
dl=1.0f,
int
time=-1);
44
virtual
~Light
();
45
46
int
operator ==
(
const
Light
& l)
const
{
return
id
== l.
id
; }
47
48
// operations
49
virtual
void
Update
();
50
51
// accessors / mutators
52
int
Identity
()
const
{
return
id
; }
53
Point
Location
()
const
{
return
loc
; }
54
55
DWORD
Type
()
const
{
return
type
; }
56
void
SetType
(DWORD t) {
type
= t; }
57
float
Intensity
()
const
{
return
light
; }
58
void
SetIntensity
(
float
f) {
light
= f; }
59
Color
GetColor
()
const
{
return
color
; }
60
void
SetColor
(
Color
c) {
color
= c; }
61
bool
IsActive
()
const
{
return
active
; }
62
void
SetActive
(
bool
a) {
active
= a; }
63
bool
CastsShadow
()
const
{
return
shadow
; }
64
void
SetShadow
(
bool
s) {
shadow
= s; }
65
66
bool
IsPoint
()
const
{
return
type
==
LIGHT_POINT
; }
67
bool
IsSpot
()
const
{
return
type
==
LIGHT_SPOT
; }
68
bool
IsDirectional
()
const
{
return
type
==
LIGHT_DIRECTIONAL
; }
69
70
virtual
void
MoveTo
(
const
Point
& dst);
71
virtual
void
TranslateBy
(
const
Point
& ref);
72
73
virtual
int
Life
()
const
{
return
life
; }
74
virtual
void
Destroy
();
75
virtual
Scene
*
GetScene
()
const
{
return
scene
; }
76
virtual
void
SetScene
(
Scene
*s) {
scene
= s; }
77
78
protected
:
79
static
int
id_key
;
80
81
int
id
;
82
DWORD
type
;
83
Point
loc
;
84
int
life
;
85
float
light
;
86
float
dldt
;
87
Color
color
;
88
bool
active
;
89
bool
shadow
;
90
Scene
*
scene
;
91
};
92
93
// +--------------------------------------------------------------------+
94
95
#endif Light_h
96
nGenEx
Light.h
Generated on Thu May 31 2012 16:30:55 for Starshatter_Open by
1.8.1