提交 23e09a70 编写于 作者: M Mugen87

PositionalAudio: Honor "hasPlaybackControl" in updateMatrixWorld().

上级 fcff7a4c
......@@ -127,27 +127,31 @@
//
var light = new THREE.HemisphereLight( 0xffffff, 0x444444 );
light.position.set( 0, 200, 0 );
scene.add( light );
light = new THREE.DirectionalLight( 0xffffff );
light.position.set( 0, 200, 100 );
light.castShadow = true;
light.shadow.camera.top = 180;
light.shadow.camera.bottom = - 100;
light.shadow.camera.left = - 120;
light.shadow.camera.right = 120;
scene.add( light );
var hemiLight = new THREE.HemisphereLight( 0xffffff, 0x444444 );
hemiLight.position.set( 0, 20, 0 );
scene.add( hemiLight );
var dirLight = new THREE.DirectionalLight( 0xffffff );
dirLight.position.set( 5, 5, 0 );
dirLight.castShadow = true;
dirLight.shadow.camera.top = 1;
dirLight.shadow.camera.bottom = - 1;
dirLight.shadow.camera.left = - 1;
dirLight.shadow.camera.right = 1;
dirLight.shadow.camera.near = 0.1;
dirLight.shadow.camera.far = 20;
scene.add( dirLight );
// scene.add( new THREE.CameraHelper( dirLight.shadow.camera ) );
//
var mesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 20, 20 ), new THREE.MeshPhongMaterial( { color: 0x999999, depthWrite: false } ) );
var mesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 50, 50 ), new THREE.MeshPhongMaterial( { color: 0x999999, depthWrite: false } ) );
mesh.rotation.x = - Math.PI / 2;
mesh.receiveShadow = true;
scene.add( mesh );
var grid = new THREE.GridHelper( 20, 20, 0x000000, 0x000000 );
var grid = new THREE.GridHelper( 50, 50, 0x000000, 0x000000 );
grid.material.opacity = 0.2;
grid.material.transparent = true;
scene.add( grid );
......@@ -180,6 +184,7 @@
object.material.envMap = reflectionCube;
object.geometry.rotateY( - Math.PI );
object.castShadow = true;
}
......@@ -194,7 +199,7 @@
// sound is damped behind this wall
var wallGeometry = new THREE.BoxBufferGeometry( 2, 1, 0.1 );
var wallMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );
var wallMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000, transparent: true, opacity: 0.5 } );
var wall = new THREE.Mesh( wallGeometry, wallMaterial );
wall.position.set( 0, 0.5, - 0.5 );
......@@ -206,9 +211,10 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setPixelRatio( window.devicePixelRatio );
container.appendChild( renderer.domElement );
renderer.gammaOutput = true;
renderer.gammaFactor = 2.2;
renderer.shadowMap.enabled = true;
container.appendChild( renderer.domElement );
//
......
......@@ -104,7 +104,7 @@ PositionalAudio.prototype = Object.assign( Object.create( Audio.prototype ), {
Object3D.prototype.updateMatrixWorld.call( this, force );
if ( this.isPlaying === false ) return;
if ( this.hasPlaybackControl === true && this.isPlaying === false ) return;
this.matrixWorld.decompose( position, quaternion, scale );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册