提交 cfac3f28 编写于 作者: M Mr.doob

Merge pull request #8410 from insominx/dev-update-marine-character

 Updated marine character for skinning example.
......@@ -11,21 +11,40 @@ THREE.BlendCharacter = function () {
var scope = this;
var loader = new THREE.JSONLoader();
loader.load( url, function( geometry, materials ) {
var loader = new THREE.ObjectLoader();
loader.load( url, function( loadedObject ) {
var originalMaterial = materials[ 0 ];
originalMaterial.skinning = true;
// The exporter does not currently allow exporting a skinned mesh by itself
// so we must fish it out of the hierarchy it is embedded in (scene)
loadedObject.traverse( function( object ) {
THREE.SkinnedMesh.call( scope, geometry, originalMaterial );
if ( object instanceof THREE.SkinnedMesh ) {
var mixer = new THREE.AnimationMixer( scope );
scope.mixer = mixer;
scope.skinnedMesh = object;
}
} );
THREE.SkinnedMesh.call( scope, scope.skinnedMesh.geometry, scope.skinnedMesh.material );
// If we didn't successfully find the mesh, bail out
if ( scope.skinnedMesh == undefined ) {
console.log( 'unable to find skinned mesh in ' + url );
return;
}
scope.material.skinning = true;
scope.mixer = new THREE.AnimationMixer( scope );
scope.mixer = scope.mixer;
// Create the animations
for ( var i = 0; i < geometry.animations.length; ++ i ) {
for ( var i = 0; i < scope.geometry.animations.length; ++ i ) {
mixer.clipAction( geometry.animations[ i ] );
scope.mixer.clipAction( scope.geometry.animations[ i ] );
}
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -61,11 +61,7 @@
container = document.getElementById( 'container' );
scene = new THREE.Scene();
scene.add ( new THREE.AmbientLight( 0xaaaaaa ) );
var light = new THREE.DirectionalLight( 0xffffff, 1.5 );
light.position.set( 0, 0, 1000 );
scene.add( light );
scene.add ( new THREE.AmbientLight( 0xffffff ) );
renderer = new THREE.WebGLRenderer( { antialias: true, alpha: false } );
renderer.setClearColor( 0x777777 );
......@@ -98,7 +94,7 @@
window.addEventListener( 'toggle-show-model', onShowModel );
blendMesh = new THREE.BlendCharacter();
blendMesh.load( "models/skinned/marine/marine_anims.js", start );
blendMesh.load( "models/skinned/marine/marine_anims_core.json", start );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册