-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
54 lines (45 loc) · 1.68 KB
/
index.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
import * as RODIN from 'rodin/main';
import MainComponent from './main/main.js';
import {Car} from './main/Car.js';
import {Building} from './main/Building.js';
RODIN.start();
RODIN.Scene.renderer.shadowMap.enabled = true;
RODIN.Scene.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
RODIN.Scene.add(new RODIN.Sculpt(new THREE.AmbientLight(0xe3f0ff, 0.2)));
const lightThree = new THREE.DirectionalLight(0xfff1d4, 0.6);
lightThree.castShadow = true;
lightThree.shadow.mapSize.width = 512;
lightThree.shadow.mapSize.height = 512;
lightThree.shadow.camera.near = 0.5;
lightThree.shadow.camera.far = 100;
const light = new RODIN.Sculpt(lightThree);
light.position.set(-20, 30, 25);
RODIN.Scene.add(light);
// const lightContrThree = new THREE.DirectionalLight(0xfff1d4, 0.1);
// lightContrThree.castShadow = true;
// lightContrThree.shadow.mapSize.width = 512;
// lightContrThree.shadow.mapSize.height = 512;
// lightContrThree.shadow.camera.near = 0.5;
// lightContrThree.shadow.camera.far = 100;
// const lightContr =new RODIN.Sculpt( lightContrThree);
// lightContr.position.set(25, 20, -25);
// RODIN.Scene.add(lightContr);
const sky = new RODIN.Sphere(80, new THREE.MeshBasicMaterial({
color: 0xa9d1ff,
map: RODIN.Loader.loadTexture('./textures/sky.jpg'),
side: THREE.DoubleSide
}));
RODIN.Scene.add(sky);
const models = new RODIN.Sculpt();
RODIN.Scene.add(models);
models.position.z = -5;
models.add(MainComponent.mainContainer);
const z4 = new Car();
z4.rotation.y = (2* Math.PI) / 3;
models.add(z4);
const building = new Building();
models.add(building);
RODIN.messenger.once(RODIN.CONST.ALL_SCULPTS_READY, () => {
let el = document.getElementById('loader');
el.style.display = "none";
});