提交 0eaaa845 编写于 作者: S sunag 提交者: Mr.doob

sea3d update (#8892)

* node material r5 + mirror nodes example

* threejs.min in node material examples

* sea3d update

* reverted to un-minified

* update mrdoob EventDispatcher.js

* fix eventdispatcher update

* proto defines replace by Object.assign

* native script support transferred to loader

* sound filters support

* light intensity from sound amplitude

* keep .setFilter() method

* get freq amplitude average

* cleanup

* use THREE.AudioAnalyser to get amplitude
上级 8ebfc03c
此差异已折叠。
......@@ -528,7 +528,7 @@ THREE.SEA3D.prototype.getSkeletonAnimationLegacy = function( sea, skl ) {
if ( sea.tag ) return sea.tag;
var animations = [],
delta = sea.frameRate / 1000,
delta = ( 1000 / sea.frameRate ) / 1000,
scale = [ 1, 1, 1 ];
for ( var i = 0; i < sea.sequence.length; i ++ ) {
......@@ -537,14 +537,13 @@ THREE.SEA3D.prototype.getSkeletonAnimationLegacy = function( sea, skl ) {
var start = seq.start;
var end = start + seq.count;
var ns = sea.name + "/" + seq.name;
var animation = {
name: ns,
name: seq.name,
repeat: seq.repeat,
fps: sea.frameRate,
JIT: 0,
length: delta * ( seq.count - 1 ),
length: delta * seq.count,
hierarchy: []
};
......@@ -614,7 +613,11 @@ THREE.SEA3D.prototype.getSkeletonAnimationLegacy = function( sea, skl ) {
}
animations.push( animation );
var anm = THREE.AnimationClip.parseAnimation( animation, skl.tag );
anm.loop = seq.repeat;
anm.timeScale = 1;
animations.push( anm );
}
......@@ -679,7 +682,7 @@ THREE.SEA3D.prototype.onHead = function( args ) {
};
THREE.SEA3D.EXTENSIONS.push( function() {
THREE.SEA3D.EXTENSIONS_LOADER.push( { setTypeRead: function() {
// CONFIG
......@@ -687,4 +690,4 @@ THREE.SEA3D.EXTENSIONS.push( function() {
this.file.typeRead[ SEA3D.Skeleton.prototype.type ] = this.readSkeleton;
} );
} } );
......@@ -28,16 +28,11 @@
</head>
<body>
<div id="info">
<a href="http://threejs.org" target="_blank">three.js</a> - model by <a href="https://github.com/sunag/sea3d" style="color:#FFFFF" target="_blank">sea3d</a>
<a href="http://threejs.org" target="_blank">three.js</a> - asset by <a href="https://github.com/sunag/sea3d" style="color:#FFFFF" target="_blank">sea3d</a>
</div>
<script src="../build/three.js"></script>
<script src="js/MorphAnimMesh.js"></script>
<script src="js/loaders/collada/Animation.js"></script>
<script src="js/loaders/collada/AnimationHandler.js"></script>
<script src="js/loaders/collada/KeyFrameAnimation.js"></script>
<script src="js/controls/OrbitControls.js"></script>
<script src="js/postprocessing/EffectComposer.js"></script>
......@@ -140,10 +135,6 @@
composer.addPass( copyPass );
copyPass.renderToScreen = true;
// extra lights
scene.add( new THREE.AmbientLight( 0x333333 ) );
// events
window.addEventListener( 'resize', onWindowResize, false );
......@@ -174,9 +165,6 @@
// Update SEA3D Animations
THREE.SEA3D.AnimationHandler.update( delta );
// Update Three.JS Animations
THREE.AnimationHandler.update( delta );
render( delta );
stats.update();
......
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - sea3d</title>
<title>three.js webgl - sea3d / hierarchy</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
......@@ -28,7 +28,7 @@
</head>
<body>
<div id="info">
<a href="http://threejs.org" target="_blank">three.js</a> - model by <a href="https://github.com/sunag/sea3d" style="color:#FFFFF" target="_blank">sea3d</a>
<a href="http://threejs.org" target="_blank">three.js</a> - asset by <a href="https://github.com/sunag/sea3d" style="color:#FFFFF" target="_blank">sea3d</a>
</div>
<script src="../build/three.js"></script>
......@@ -43,14 +43,10 @@
<script src="js/shaders/ColorCorrectionShader.js"></script>
<script src="js/shaders/VignetteShader.js"></script>
<script src="js/MorphAnimMesh.js"></script>
<script src="js/loaders/collada/Animation.js"></script>
<script src="js/loaders/sea3d/SEA3D.js"></script>
<script src="js/loaders/sea3d/SEA3DLZMA.js"></script>
<script src="js/loaders/sea3d/SEA3DLoader.js"></script>
<script src="js/Detector.js"></script>
<script src="js/libs/stats.min.js"></script>
......@@ -81,13 +77,13 @@
loader.onComplete = function( e ) {
// reset global time
SEA3D.AnimationHandler.setTime( 0 );
// play all animations
for(var i = 0; i < loader.meshes.length; i++) {
if (loader.meshes[i].animation)
loader.meshes[i].animation.play("root");
loader.meshes[i].animation.play( "root" );
}
// Get the first camera from SEA3D Studio
......@@ -120,6 +116,9 @@
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
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();
......
......@@ -28,7 +28,7 @@
</head>
<body>
<div id="info">
<a href="http://threejs.org" target="_blank">three.js</a> - model by <a href="https://github.com/sunag/sea3d" style="color:#FFFFF" target="_blank">sea3d</a>
<a href="http://threejs.org" target="_blank">three.js</a> - asset by <a href="https://github.com/sunag/sea3d" style="color:#FFFFF" target="_blank">sea3d</a>
<div id="description">Click to play</div>
</div>
......@@ -44,9 +44,6 @@
<script src="js/shaders/ColorCorrectionShader.js"></script>
<script src="js/shaders/VignetteShader.js"></script>
<script src="js/MorphAnimMesh.js"></script>
<script src="js/loaders/collada/Animation.js"></script>
<script src="js/loaders/sea3d/SEA3D.js"></script>
<script src="js/loaders/sea3d/SEA3DLZMA.js"></script>
<script src="js/loaders/sea3d/SEA3DLoader.js"></script>
......@@ -90,9 +87,6 @@
controls = new THREE.OrbitControls( camera );
// reset global animation time
SEA3D.AnimationHandler.setTime( 0 );
// events
window.addEventListener('click', onMouseClick, false);
......@@ -107,35 +101,38 @@
// Animation Functions
//
function playAll(name, crossfade, offset) {
// reset global time
SEA3D.AnimationHandler.setTime( 0 );
function playAll(id, crossfade, offset) {
// play all animations
for(var i = 0; i < loader.meshes.length; i++) {
if (loader.meshes[i].animation)
loader.meshes[i].animation.play(name, crossfade, offset);
loader.meshes[i].animation.play(id, crossfade, offset);
}
}
function setTimeScale( timeScale ) {
// set in all active animations
for(var i in SEA3D.AnimationHandler.animations) {
SEA3D.AnimationHandler.animations[i].timeScale = timeScale;
for(var i = 0; i < loader.meshes.length; i++) {
if (loader.meshes[i].animation)
loader.meshes[i].animation.setTimeScale( timeScale );
}
}
function stopAll() {
// reset global time
SEA3D.AnimationHandler.setTime( 0 );
for(var i = 0; i < loader.meshes.length; i++) {
// stop all active animations
SEA3D.AnimationHandler.stop();
if (loader.meshes[i].animation)
loader.meshes[i].animation.stop();
}
}
......@@ -182,10 +179,6 @@
composer.addPass( copyPass );
copyPass.renderToScreen = true;
// extra lights
scene.add( new THREE.AmbientLight( 0x333333 ) );
// events
window.addEventListener( 'resize', onWindowResize, false );
......@@ -246,18 +239,15 @@
var fracture99 = loader.getMesh("Object099");
//fracture99.animation.time = 0;
//fracture99.animation.timeScale = 1;
//fracture99.animation.setTimeScale( 1 );
//fracture99.animation.playing
//fracture99.animation.states ...
//fracture99.animation.currentState ...
//fracture99.animation.node ...
//fracture99.animation.node.duration
//fracture99.animation.currentAnimation
//fracture99.animation.previousAnimation
fracture99.animation.play("crash#2", .5, 0);
//fracture99.animation.pause();
//fracture99.animation.stop();
//fracture99.animation.pause();
//fracture99.animation.resume();
description("crash#2 in single object - crossfade 0.5 seconds");
......
此差异已折叠。
......@@ -20,6 +20,22 @@ Object.assign( THREE.AudioAnalyser.prototype, {
this.analyser.getByteFrequencyData( this.data );
return this.data;
},
getAverage: function() {
var values = 0, data = this.getData();
// get all the frequency amplitudes
for (var i = 0; i < data.length; i++) {
values += data[ i ];
}
return values / data.length;
}
} );
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册