diff --git a/examples/js/loaders/sea3d/SEA3DLoader.js b/examples/js/loaders/sea3d/SEA3DLoader.js index 8d4ce5c7718ebf8f277273685f21461b5a9f4e1c..3049cb619a4ff65830b4c23dba0a14221084bbfe 100644 --- a/examples/js/loaders/sea3d/SEA3DLoader.js +++ b/examples/js/loaders/sea3d/SEA3DLoader.js @@ -476,6 +476,8 @@ THREE.SEA3D.Animator.prototype.update = function( dt ) { if ( ! this.currentAnimationAction.enabled && ! this.currentAnimationData.completed ) { + this.pause(); + this.currentAnimationData.completed = true; if ( this.currentAnimationData.onComplete ) this.currentAnimationData.onComplete( this ); @@ -495,7 +497,7 @@ THREE.SEA3D.Animator.prototype.updateAnimations = function( mixer ) { this.relative = false; this.playing = false; - this.setTimeScale( 1 ); + this.timeScale = 1; this.animations = []; this.animationsData = {}; @@ -551,15 +553,21 @@ THREE.SEA3D.Animator.prototype.resume = function() { THREE.SEA3D.Animator.prototype.setTimeScale = function( val ) { - this.mixer._timeScale = val; + this.timeScale = val; - this.mixer.timeScale = val * ( this.currentAnimation ? this.currentAnimation.timeScale : 1 ); + if ( this.currentAnimationAction ) this.updateTimeScale(); }; THREE.SEA3D.Animator.prototype.getTimeScale = function() { - return this.mixer._timeScale; + return this.timeScale; + +}; + +THREE.SEA3D.Animator.prototype.updateTimeScale = function() { + + this.currentAnimationAction.setEffectiveTimeScale( this.timeScale * ( this.currentAnimation ? this.currentAnimation.timeScale : 1 ) ); }; @@ -576,6 +584,7 @@ THREE.SEA3D.Animator.prototype.play = function( name, crossfade, offset, weight this.previousAnimationAction = this.currentAnimationAction; this.currentAnimationAction = this.mixer.clipAction( animation ).setLoop( animation.loop ? THREE.LoopRepeat : THREE.LoopOnce, Infinity ).reset(); + this.currentAnimationAction.clampWhenFinished = true; this.previousAnimationData = this.currentAnimationData; this.currentAnimationData = this.animationsData[ name ]; @@ -584,9 +593,9 @@ THREE.SEA3D.Animator.prototype.play = function( name, crossfade, offset, weight if ( weight !== undefined ) this.currentAnimationAction.setEffectiveWeight( weight ); - this.currentAnimationAction.play(); + this.updateTimeScale(); - this.mixer.timeScale = this.mixer._timeScale * this.currentAnimation.timeScale; + this.currentAnimationAction.play(); if ( ! this.playing ) this.mixer.update( 0 ); @@ -659,9 +668,9 @@ THREE.SEA3D.Object3DAnimator.prototype.stop = function() { if ( this.currentAnimation ) { - if ( this instanceof THREE.SEA3D.Object3DAnimator ) { + var animate = this.object3d.animate; - var animate = this.object3d.animate; + if ( animate && this instanceof THREE.SEA3D.Object3DAnimator ) { animate.position.set( 0, 0, 0 ); animate.quaternion.set( 0, 0, 0, 1 ); @@ -1450,13 +1459,13 @@ THREE.SEA3D.prototype.readAnimation = function( sea ) { break; } - var clip = new THREE.AnimationClip( seq.name, - 1, tracks ); - clip.loop = seq.repeat; - clip.timeScale = 1; + } - clips.push( clip ); + var clip = new THREE.AnimationClip( seq.name, - 1, tracks ); + clip.loop = seq.repeat; + clip.timeScale = 1; - } + clips.push( clip ); } diff --git a/examples/webgl_loader_sea3d_hierarchy.html b/examples/webgl_loader_sea3d_hierarchy.html index 87860cb7de8c82e58ddf9ec21c21995f3717b72b..d3a5b1f851776e227a07db9c36371026a0623fea 100644 --- a/examples/webgl_loader_sea3d_hierarchy.html +++ b/examples/webgl_loader_sea3d_hierarchy.html @@ -118,7 +118,6 @@ renderer.setClearColor( 0x333333, 1 ); renderer.shadowMap.enabled = true; renderer.shadowMap.type = THREE.PCFSoftShadowMap; - renderer.shadowMap.cullFace = THREE.CullFaceBack; container.appendChild( renderer.domElement ); stats = new Stats(); diff --git a/examples/webgl_loader_sea3d_skinning.html b/examples/webgl_loader_sea3d_skinning.html index b80cccc558454927bbc8cd274dab523b5120473b..678ccb6e379615c9768a3e0b7c1707a6c5269457 100644 --- a/examples/webgl_loader_sea3d_skinning.html +++ b/examples/webgl_loader_sea3d_skinning.html @@ -30,7 +30,7 @@
three.js - asset by sea3d
BoneObject: Object3D attached in a Bone -
Click to hidden/show the hat - Right click to run +
Left Click to hidden/show the hat - Right click to run - Middle click to clone
@@ -45,11 +45,6 @@ - - - - - @@ -118,6 +113,30 @@ // + var cloneAsset = function() { + + var count = 0, size = 50; + + return function() { + + var angle = ( Math.PI / 4 ) * count++; + + var container = new THREE.Object3D(); + container.position.z = ( size * count ) * Math.cos( angle ); + container.position.x = ( size * count ) * Math.sin( angle ); + + scene.add( container ); + + var domain = loader.clone( { + autoPlay : true, + container : container, + lights : false + }); + + } + + }(); + function init() { scene = new THREE.Scene(); @@ -125,7 +144,7 @@ container = document.createElement( 'div' ); document.body.appendChild( container ); - camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 ); + camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 20000 ); camera.position.set( 1000, - 300, 1000 ); renderer = new THREE.WebGLRenderer(); @@ -179,10 +198,15 @@ function onMouseClick( e ) { - if (e.button != 0) return; + if (e.button === 0) { + + hat.visible = !hat.visible; + + } else if (e.button === 1) { - var hat = loader.getMesh("Hat"); - hat.visible = !hat.visible; + cloneAsset(); + + } } @@ -209,9 +233,6 @@ // Update SEA3D Animations THREE.SEA3D.AnimationHandler.update( delta ); - // Update Three.JS Animations - THREE.AnimationHandler.update( delta ); - render( delta ); stats.update(); diff --git a/examples/webgl_loader_sea3d_sound.html b/examples/webgl_loader_sea3d_sound.html index fa13fee2d0d86ce8cbe4c370ff79f5a5a0d11706..81eeceaea2a3c2b4217b9f7b0e568c357ceb1270 100644 --- a/examples/webgl_loader_sea3d_sound.html +++ b/examples/webgl_loader_sea3d_sound.html @@ -92,9 +92,6 @@ - - - @@ -151,7 +148,7 @@ lightOutside = loader.getLight("Light1"); soundOutside = loader.getSound3D("Point001"); - soundOutsideAnalyser = new THREE.AudioAnalyser( soundOutside, 512 ); + soundOutsideAnalyser = new THREE.AudioAnalyser( soundOutside, 32 ); // sound asset 2 + area @@ -458,7 +455,7 @@ updateSoundFilter(); // light intensity from sound amplitude - lightOutside.intensity = soundOutsideAnalyser.getAverageFrequency() / 50; + lightOutside.intensity = soundOutsideAnalyser.getAverageFrequency() / 100; lightArea.intensity = soundAreaAnalyser.getAverageFrequency() / 50; // Update SEA3D Animations