1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
KX_LightObject(KX_GameObject)
=============================
.. module:: bge.types
base class --- :class:`KX_GameObject`
.. class:: KX_LightObject(KX_GameObject)
A Light object.
.. code-block:: python
# Turn on a red alert light.
import bge
co = bge.logic.getCurrentController()
light = co.owner
light.energy = 1.0
light.color = [1.0, 0.0, 0.0]
.. data:: SPOT
A spot light source. See attribute :data:`type`
.. data:: SUN
A point light source with no attenuation. See attribute :data:`type`
.. data:: NORMAL
A point light source. See attribute :data:`type`
.. attribute:: type
The type of light - must be SPOT, SUN or NORMAL
.. attribute:: layer
The layer mask that this light affects object on.
:type: bitfield
.. attribute:: energy
The brightness of this light.
:type: float
.. attribute:: shadowClipStart
The shadowmap clip start, below which objects will not generate shadows.
:type: float (read only)
.. attribute:: shadowClipEnd
The shadowmap clip end, beyond which objects will not generate shadows.
:type: float (read only)
..attribute:: shadowFrustumSize
Size of the frustum used for creating the shadowmap.
:type: float (read only)
..attribute:: shadowBindId
The OpenGL shadow texture bind number/id.
:type: int (read only)
..attribute:: shadowMapType
The shadow shadow map type (0 -> Simple; 1 -> Variance)
:type: int (read only)
..attribute:: shadowBias
The shadow buffer sampling bias.
:type: float (read only)
..attribute:: shadowBleedBias
The bias for reducing light-bleed on variance shadow maps.
:type: float (read only)
..attribute:: useShadow
Returns True if the light has Shadow option activated, else returns False.
:type: boolean (read only)
.. attribute:: shadowColor
The color of this light shadows. Black = (0.0, 0.0, 0.0), White = (1.0, 1.0, 1.0).
:type: :class:`mathutils.Color` (read only)
.. attribute:: shadowMatrix
Matrix that converts a vector in camera space to shadow buffer depth space.
Computed as:
mat4_perspective_to_depth * mat4_lamp_to_perspective * mat4_world_to_lamp * mat4_cam_to_world.
mat4_perspective_to_depth is a fixed matrix defined as follow:
0.5 0.0 0.0 0.5
0.0 0.5 0.0 0.5
0.0 0.0 0.5 0.5
0.0 0.0 0.0 1.0
.. note:
There is one matrix of that type per lamp casting shadow in the scene.
:type: Matrix4x4 (read only)
.. attribute:: distance
The maximum distance this light can illuminate. (SPOT and NORMAL lights only).
:type: float
.. attribute:: color
The color of this light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
:type: list [r, g, b]
.. attribute:: lin_attenuation
The linear component of this light's attenuation. (SPOT and NORMAL lights only).
:type: float
.. attribute:: quad_attenuation
The quadratic component of this light's attenuation (SPOT and NORMAL lights only).
:type: float
.. attribute:: spotsize
The cone angle of the spot light, in degrees (SPOT lights only).
:type: float in [0 - 180].
.. attribute:: spotblend
Specifies the intensity distribution of the spot light (SPOT lights only).
:type: float in [0 - 1]
.. note::
Higher values result in a more focused light source.
|