|
@@ -35,27 +35,41 @@ function init() {
|
|
|
scene = new THREE.Scene();
|
|
|
camera = new THREE.PerspectiveCamera( 75, container.clientWidth / container.clientHeight, 0.1, 1000 );
|
|
|
camera.position.set(10, 10, 10);
|
|
|
-
|
|
|
+
|
|
|
const color = 0xFFFFFF;
|
|
|
- const intensity = 3;
|
|
|
- const light = new THREE.AmbientLight(color, intensity);
|
|
|
+ const light0 = new THREE.AmbientLight(color, 1);
|
|
|
+ scene.add(light0);
|
|
|
+
|
|
|
+
|
|
|
+ const light = new THREE.DirectionalLight(color, 5);
|
|
|
+ light.position.set(0, 15, -20);
|
|
|
+ light.target.position.set(0, 0, 0);
|
|
|
scene.add(light);
|
|
|
+ scene.add(light.target);
|
|
|
+
|
|
|
+ const light2 = new THREE.DirectionalLight(color, 5);
|
|
|
+ light2.position.set(0, 15, 20);
|
|
|
+ light2.target.position.set(0, 0, 0);
|
|
|
+ scene.add(light2);
|
|
|
+ scene.add(light2.target);
|
|
|
+
|
|
|
+ function animate() {
|
|
|
+ if (controls)
|
|
|
+ controls.update();
|
|
|
+ if (renderer && scene && camera)
|
|
|
+ renderer.render(scene, camera);
|
|
|
+ }
|
|
|
|
|
|
renderer = new THREE.WebGLRenderer({ alpha: true });
|
|
|
renderer.setAnimationLoop(animate);
|
|
|
renderer.setSize(container.clientWidth, container.clientHeight);
|
|
|
|
|
|
- container.appendChild( renderer.domElement );
|
|
|
-
|
|
|
controls = new OrbitControls(camera, renderer.domElement);
|
|
|
+ controls.autoRotate = true;
|
|
|
+ controls.autoRotateSpeed = 1;
|
|
|
controls.update();
|
|
|
|
|
|
- function animate() {
|
|
|
- controls.update();
|
|
|
-
|
|
|
- if (renderer && scene && camera)
|
|
|
- renderer.render(scene, camera);
|
|
|
- }
|
|
|
+ container.appendChild(renderer.domElement);
|
|
|
|
|
|
setTimeout(() => {
|
|
|
if (props.path)
|