|
@@ -56,11 +56,11 @@
|
|
|
|
|
|
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
|
|
|
|
|
|
- console.log("Visit https://github.com/sunag/sea3d to all codes and builds under development.");
|
|
|
+ console.log( "Visit https://github.com/sunag/sea3d to all codes and builds under development." );
|
|
|
|
|
|
var container, stats;
|
|
|
|
|
|
- var camera, scene, renderer, composer, controls, demoAt = -1;
|
|
|
+ var camera, scene, renderer, composer, demoAt = - 1;
|
|
|
|
|
|
var loader;
|
|
|
|
|
@@ -74,25 +74,25 @@
|
|
|
|
|
|
loader = new THREE.SEA3D( {
|
|
|
|
|
|
- autoPlay : false, // Manual play animations
|
|
|
- container : scene // Container to add models
|
|
|
+ autoPlay: false, // Manual play animations
|
|
|
+ container: scene // Container to add models
|
|
|
|
|
|
} );
|
|
|
|
|
|
- loader.onComplete = function( e ) {
|
|
|
+ loader.onComplete = function ( e ) {
|
|
|
|
|
|
// Get the first camera from 3ds Max
|
|
|
// use loader.get... to get others objects
|
|
|
|
|
|
- var cam = loader.cameras[0];
|
|
|
+ var cam = loader.cameras[ 0 ];
|
|
|
camera.position.copy( cam.position );
|
|
|
camera.rotation.copy( cam.rotation );
|
|
|
|
|
|
- controls = new THREE.OrbitControls( camera );
|
|
|
+ new THREE.OrbitControls( camera );
|
|
|
|
|
|
// events
|
|
|
|
|
|
- window.addEventListener('click', onMouseClick, false);
|
|
|
+ window.addEventListener( 'click', onMouseClick, false );
|
|
|
|
|
|
animate();
|
|
|
|
|
@@ -104,14 +104,14 @@
|
|
|
// Animation Functions
|
|
|
//
|
|
|
|
|
|
- function playAll(id, crossfade, offset) {
|
|
|
+ function playAll( id, crossfade, offset ) {
|
|
|
|
|
|
// play all animations
|
|
|
|
|
|
- for(var i = 0; i < loader.meshes.length; i++) {
|
|
|
+ for ( var i = 0; i < loader.meshes.length; i ++ ) {
|
|
|
|
|
|
- if (loader.meshes[i].animator)
|
|
|
- loader.meshes[i].animator.play(id, crossfade, offset);
|
|
|
+ if ( loader.meshes[ i ].animator )
|
|
|
+ loader.meshes[ i ].animator.play( id, crossfade, offset );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -119,10 +119,10 @@
|
|
|
|
|
|
function setTimeScale( timeScale ) {
|
|
|
|
|
|
- for(var i = 0; i < loader.meshes.length; i++) {
|
|
|
+ for ( var i = 0; i < loader.meshes.length; i ++ ) {
|
|
|
|
|
|
- if (loader.meshes[i].animator)
|
|
|
- loader.meshes[i].animator.setTimeScale( timeScale );
|
|
|
+ if ( loader.meshes[ i ].animator )
|
|
|
+ loader.meshes[ i ].animator.setTimeScale( timeScale );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -130,10 +130,10 @@
|
|
|
|
|
|
function stopAll() {
|
|
|
|
|
|
- for(var i = 0; i < loader.meshes.length; i++) {
|
|
|
+ for ( var i = 0; i < loader.meshes.length; i ++ ) {
|
|
|
|
|
|
- if (loader.meshes[i].animator)
|
|
|
- loader.meshes[i].animator.stop();
|
|
|
+ if ( loader.meshes[ i ].animator )
|
|
|
+ loader.meshes[ i ].animator.stop();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -201,9 +201,9 @@
|
|
|
|
|
|
//
|
|
|
|
|
|
- function description(msg) {
|
|
|
+ function description( msg ) {
|
|
|
|
|
|
- document.getElementById('description').innerHTML = (demoAt + 1) + " - " + msg;
|
|
|
+ document.getElementById( 'description' ).innerHTML = ( demoAt + 1 ) + " - " + msg;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -211,62 +211,64 @@
|
|
|
|
|
|
// 0 at 3 demos
|
|
|
|
|
|
- switch( demoAt = ++demoAt % 4 ) {
|
|
|
+ switch ( demoAt = ++ demoAt % 4 ) {
|
|
|
|
|
|
- // play all animation to sequence "crash#1"
|
|
|
+ // play all animation to sequence "crash#1"
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
- playAll("crash#1", .5);
|
|
|
- setTimeScale(1);
|
|
|
+ playAll( "crash#1", .5 );
|
|
|
+ setTimeScale( 1 );
|
|
|
|
|
|
- description("crash#1 - crossfade 0.5 seconds");
|
|
|
+ description( "crash#1 - crossfade 0.5 seconds" );
|
|
|
|
|
|
break;
|
|
|
|
|
|
- // play all animation to sequence "crash#2"
|
|
|
+ // play all animation to sequence "crash#2"
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
- playAll("crash#2", .5);
|
|
|
+ playAll( "crash#2", .5 );
|
|
|
|
|
|
- description("crash#2 - crossfade 0.5 seconds");
|
|
|
+ description( "crash#2 - crossfade 0.5 seconds" );
|
|
|
|
|
|
break;
|
|
|
|
|
|
- // play animation in single object
|
|
|
+ // play animation in single object
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
stopAll();
|
|
|
|
|
|
- var fracture99 = loader.getMesh("Object099");
|
|
|
+ var fracture99 = loader.getMesh( "Object099" );
|
|
|
|
|
|
//fracture99.animator.setTimeScale( 1 );
|
|
|
//fracture99.animator.playing
|
|
|
//fracture99.animator.currentAnimation
|
|
|
//fracture99.animator.previousAnimation
|
|
|
|
|
|
- fracture99.animator.play("crash#2", .5, 0);
|
|
|
+ fracture99.animator.play( "crash#2", .5, 0 );
|
|
|
//fracture99.animator.stop();
|
|
|
//fracture99.animator.pause();
|
|
|
//fracture99.animator.resume();
|
|
|
|
|
|
- description("crash#2 in single object - crossfade 0.5 seconds");
|
|
|
+ description( "crash#2 in single object - crossfade 0.5 seconds" );
|
|
|
|
|
|
break;
|
|
|
|
|
|
- // set time scale
|
|
|
+ // set time scale
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
- playAll("crash#2", .5);
|
|
|
- setTimeScale(.1);
|
|
|
+ playAll( "crash#2", .5 );
|
|
|
+ setTimeScale( .1 );
|
|
|
|
|
|
- description("time scale / 10 - crossfade 0.5 seconds");
|
|
|
+ description( "time scale / 10 - crossfade 0.5 seconds" );
|
|
|
|
|
|
break;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//
|