-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLight.js
More file actions
51 lines (44 loc) · 1.42 KB
/
Light.js
File metadata and controls
51 lines (44 loc) · 1.42 KB
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
"use strict";
const Light = function Light(lightColor, lightAngle, lightDirection, lightPosition, lightIntensity) {
Object.defineProperty(this, "color", {
get: () => lightColor,
set: (color) => lightColor = color,
enumerable: false,
configurable: false,
});
Object.defineProperty(this, "angle", {
get: () => lightAngle,
set: (angle) => lightAngle = angle,
enumerable: false,
configurable: false,
});
Object.defineProperty(this, "direction", {
get: () => lightDirection,
set: (direction) => lightDirection = direction,
enumerable: false,
configurable: false,
});
Object.defineProperty(this, "position", {
get: () => lightPosition,
set: (position) => lightPosition = position,
enumerable: false,
configurable: false,
});
Object.defineProperty(this, "intensity", {
get: () => lightIntensity,
set: (intensity) => {lightIntensity = intensity; if(lightIntensity < 0) lightIntensity = 0;},
enumerable: false,
configurable: false,
});
Object.defineProperty(this, "isLight", {
get: () => true,
enumerable: false,
configurable: false,
});
Object.defineProperty(this, "isReadyToRender", {
get: () => true,
enumerable: false,
configurable: false,
});
this.__proto__ = new Loadable("LIGHT");
}