/
LightData.ts
107 lines (91 loc) · 2.08 KB
/
LightData.ts
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
import { Color } from '../../math/Color';
import { Vector3 } from '../../math/Vector3';
import { Struct } from '../../util/struct/Struct';
/**
*Type of light source
*
*Type Description|
* |:---:|:---:|
*None|
*PointLight|
*DirectionLight|
*SpotLight|
*SkyLight|
* @group Lights
*/
export enum LightType {
None,
PointLight,
DirectionLight,
SpotLight,
SkyLight,
}
/**
* Data structure of light sources
* @internal
* @group Lights
*/
export class LightData extends Struct {
public static lightSize: number = 24;
public index: number = -1;
/**
* Light source type
* @see LightType
* */
public lightType: number = -1;
/**
*
* Light source radius
*/
public radius: number = 0.5;
/**
*
* The illumination distance of the light source, which is 0, means that the intensity of the light will not decrease due to the distance
*/
public linear: number = 1.0;
public lightPosition: Vector3 = new Vector3();
public lightMatrixIndex: number = -1;
/**
* Light source direction
*/
public direction: Vector3 = new Vector3();
public quadratic: number = 0.032;
/**
*
* The color of the light source
*/
public lightColor: Color = new Color(1, 1, 1, 1);
/**
*
* The intensity of light exposure
*/
public intensity: number = 1;
/**
*
* Inner cone angle of light source
*/
public innerAngle: number = 0;
/**
*
* Outer cone angle of light source
*/
public outerAngle: number = 1;
/**
*
* The size of the light source range and the distance emitted from the center of the light source object. Only Point and Spotlight have this parameter.
*/
public range: number = 100;
/**
*
* shadow at shadow map index
*/
public castShadowIndex: number = -1;
/**
* Tangent direction of light
*/
public lightTangent: Vector3 = Vector3.FORWARD;
/**
* Whether to use lighting ies
*/
public iesIndex: number = -1;
}