-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyLights.js
73 lines (58 loc) · 1.67 KB
/
MyLights.js
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
import * as THREE from "three";
class MyLights {
constructor() {
this.addPointLightLight();
this.addDirectionalLight();
this.addSpotLight();
this.addAmbientLight();
this.addFrameLight();
}
/**
* Function that creates a point light
* @returns point light object
*/
addPointLightLight() {
this.pointLight = new THREE.PointLight(0xffffff, 500, 0);
this.pointLight.position.set(0, 20, 0);
return this.addPointLightLight;
}
/**
* Function that creates a directional light
* @returns directional light object
*/
addDirectionalLight() {
this.directionalLight = new THREE.DirectionalLight("#ffffff", 1);
this.directionalLight.position.set(5, 10, 2);
this.directionalLight.target.position.set(0, 2, 0);
return this.addDirectionalLight;
}
/**
* Function that creates a spot light
* @returns spot light object
*/
addSpotLight() {
this.spotLight = new THREE.SpotLight("#ffffff", 10, 12, 1, 0, 0);
this.spotLight.position.set(0, 10, 0);
this.spotLight.target.position.set(0, 0, 0);
this.spotLight.castShadow = true;
return this.spotLight;
}
/**
* Function that creates an ambient light
* @returns ambient light object
*/
addAmbientLight() {
return (this.ambientLight = new THREE.AmbientLight(0x555555, 4));
}
/**
* Function that creates a different spot light
* @returns spot light for a wall frame
*/
addFrameLight(){
this.frameLight = new THREE.SpotLight("#ffffff", 15, 30, 0.2, 0.5, 0);
this.frameLight.position.set(-2,14,-9);
this.frameLight.target.position.set(-2, 5, -9.9);
return this.frameLight;
}
}
export { MyLights };