|
@@ -123,22 +123,24 @@
|
|
function initGraphics() {
|
|
function initGraphics() {
|
|
|
|
|
|
container = document.getElementById( 'container' );
|
|
container = document.getElementById( 'container' );
|
|
|
|
+ container.innerHTML = '';
|
|
|
|
|
|
camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.2, 2000 );
|
|
camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.2, 2000 );
|
|
|
|
|
|
scene = new THREE.Scene();
|
|
scene = new THREE.Scene();
|
|
scene.background = new THREE.Color( 0xbfd1e5 );
|
|
scene.background = new THREE.Color( 0xbfd1e5 );
|
|
|
|
|
|
- camera.position.set( -14, 8, 16 );
|
|
|
|
-
|
|
|
|
- controls = new THREE.OrbitControls( camera );
|
|
|
|
- controls.target.set( 0, 2, 0 );
|
|
|
|
- controls.update();
|
|
|
|
|
|
+ camera.position.set( - 14, 8, 16 );
|
|
|
|
|
|
renderer = new THREE.WebGLRenderer();
|
|
renderer = new THREE.WebGLRenderer();
|
|
renderer.setPixelRatio( window.devicePixelRatio );
|
|
renderer.setPixelRatio( window.devicePixelRatio );
|
|
renderer.setSize( window.innerWidth, window.innerHeight );
|
|
renderer.setSize( window.innerWidth, window.innerHeight );
|
|
renderer.shadowMap.enabled = true;
|
|
renderer.shadowMap.enabled = true;
|
|
|
|
+ container.appendChild( renderer.domElement );
|
|
|
|
+
|
|
|
|
+ controls = new THREE.OrbitControls( camera, renderer.domElement );
|
|
|
|
+ controls.target.set( 0, 2, 0 );
|
|
|
|
+ controls.update();
|
|
|
|
|
|
textureLoader = new THREE.TextureLoader();
|
|
textureLoader = new THREE.TextureLoader();
|
|
|
|
|
|
@@ -146,13 +148,13 @@
|
|
scene.add( ambientLight );
|
|
scene.add( ambientLight );
|
|
|
|
|
|
var light = new THREE.DirectionalLight( 0xffffff, 1 );
|
|
var light = new THREE.DirectionalLight( 0xffffff, 1 );
|
|
- light.position.set( -10, 18, 5 );
|
|
|
|
|
|
+ light.position.set( - 10, 18, 5 );
|
|
light.castShadow = true;
|
|
light.castShadow = true;
|
|
var d = 14;
|
|
var d = 14;
|
|
- light.shadow.camera.left = -d;
|
|
|
|
|
|
+ light.shadow.camera.left = - d;
|
|
light.shadow.camera.right = d;
|
|
light.shadow.camera.right = d;
|
|
light.shadow.camera.top = d;
|
|
light.shadow.camera.top = d;
|
|
- light.shadow.camera.bottom = -d;
|
|
|
|
|
|
+ light.shadow.camera.bottom = - d;
|
|
|
|
|
|
light.shadow.camera.near = 2;
|
|
light.shadow.camera.near = 2;
|
|
light.shadow.camera.far = 50;
|
|
light.shadow.camera.far = 50;
|
|
@@ -162,11 +164,6 @@
|
|
|
|
|
|
scene.add( light );
|
|
scene.add( light );
|
|
|
|
|
|
-
|
|
|
|
- container.innerHTML = "";
|
|
|
|
-
|
|
|
|
- container.appendChild( renderer.domElement );
|
|
|
|
-
|
|
|
|
stats = new Stats();
|
|
stats = new Stats();
|
|
stats.domElement.style.position = 'absolute';
|
|
stats.domElement.style.position = 'absolute';
|
|
stats.domElement.style.top = '0px';
|
|
stats.domElement.style.top = '0px';
|