light.js
2.07 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { Object3D, DirectionalLight, AmbientLight, PointLight, HemisphereLight } from 'three';
const Light = () => {
const makeCameraLight = () => {
const direct1 = new DirectionalLight(0xffffff, 0.8);
direct1.name = 'direct1';
direct1.position.set(0, -150, 0);
const direct2 = new DirectionalLight(0xe0e0e0, 0.8);
direct2.position.set(0, 150, 0);
direct2.name = 'direct2';
const direct3 = new DirectionalLight(0xe0e0e0, 0.8);
direct3.position.set(0, 0, 150);
direct3.name = 'direct3';
const point1 = new PointLight(0xffffff, 0.7, 0);
const point2 = new PointLight(0xffffff, 0.2, 0);
point1.position.set(0, 200, 10);
point2.position.set(0, 200, -10);
const hemisphereLight = new HemisphereLight(0xffffff, 0xffffff, 0.2);
const cameralights = new Object3D();
cameralights.add(direct1);
cameralights.add(direct2);
cameralights.add(direct3);
cameralights.add(point1);
cameralights.add(point2);
cameralights.add(hemisphereLight);
return cameralights;
};
const makeSceneLight = () => {
const ambient = new AmbientLight(0xffffff, 0.9);
ambient.name = 'ambient';
const direct1 = new DirectionalLight(0xffffff, 0.8);
direct1.name = 'direct1';
direct1.position.set(0, 0, 150);
const direct2 = new DirectionalLight(0xffffff, 0.4);
direct2.name = 'direct2';
direct2.position.set(0, 200, 10);
const direct3 = new DirectionalLight(0xe0e0e0, 0.7);
direct3.position.set(0, -200, 10);
direct3.name = 'direct3';
const hemisphereLight = new HemisphereLight(0xffffff, 0xffffff, 0.3);
const scenelights = new Object3D();
scenelights.add(ambient);
scenelights.add(direct1);
scenelights.add(direct2);
// scenelights.add(direct3);
// scenelights.add(hemisphereLight);
return scenelights;
};
return {
makeCameraLight,
makeSceneLight
};
};
export default Light;