Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions examples/webaudio_orientation.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -180,6 +184,7 @@

object.material.envMap = reflectionCube;
object.geometry.rotateY( - Math.PI );
object.castShadow = true;

}

Expand All @@ -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 );
Expand All @@ -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 );

//

Expand Down
2 changes: 1 addition & 1 deletion src/audio/PositionalAudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down