From 14b81975fae59db03c35e5517cffd9ff6fc47729 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Fri, 11 Apr 2014 23:09:55 -0600 Subject: [PATCH] Updated builds. --- build/three.js | 664 ++++++++++++++++++++++++++++++--------------- build/three.min.js | 136 +++++----- 2 files changed, 513 insertions(+), 287 deletions(-) diff --git a/build/three.js b/build/three.js index ed3d900de7..550aff2f4c 100644 --- a/build/three.js +++ b/build/three.js @@ -3727,6 +3727,8 @@ THREE.Box3.prototype = { this.max.z = point.z; } + + return this; }, @@ -16832,6 +16834,10 @@ THREE.Bone = function( belongsToSkin ) { this.skin = belongsToSkin; this.skinMatrix = new THREE.Matrix4(); + this.accumulatedRotWeight = 0; + this.accumulatedPosWeight = 0; + this.accumulatedSclWeight = 0; + }; THREE.Bone.prototype = Object.create( THREE.Object3D.prototype ); @@ -16863,6 +16869,12 @@ THREE.Bone.prototype.update = function ( parentSkinMatrix, forceUpdate ) { this.matrixWorldNeedsUpdate = false; forceUpdate = true; + // Reset weights to be re-accumulated in the next frame + + this.accumulatedRotWeight = 0; + this.accumulatedPosWeight = 0; + this.accumulatedSclWeight = 0; + } // update children @@ -16879,30 +16891,25 @@ THREE.Bone.prototype.update = function ( parentSkinMatrix, forceUpdate ) { /** * @author mikael emtinger / http://gomo.se/ * @author alteredq / http://alteredqualia.com/ + * @author michael guerrero / http://realitymeltdown.com */ -THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) { - - THREE.Mesh.call( this, geometry, material ); - - // +THREE.Skeleton = function ( boneList, useVertexTexture ) { this.useVertexTexture = useVertexTexture !== undefined ? useVertexTexture : true; // init bones - this.identityMatrix = new THREE.Matrix4(); - this.bones = []; this.boneMatrices = []; - var b, bone, gbone, p, q, s; + var bone, gbone, p, q, s; - if ( this.geometry && this.geometry.bones !== undefined ) { + if ( boneList !== undefined ) { - for ( b = 0; b < this.geometry.bones.length; b ++ ) { + for ( var b = 0; b < boneList.length; ++b ) { - gbone = this.geometry.bones[ b ]; + gbone = boneList[ b ]; p = gbone.pos; q = gbone.rotq; @@ -16913,7 +16920,7 @@ THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) { bone.name = gbone.name; bone.position.set( p[0], p[1], p[2] ); bone.quaternion.set( q[0], q[1], q[2], q[3] ); - + if ( s !== undefined ) { bone.scale.set( s[0], s[1], s[2] ); @@ -16926,18 +16933,13 @@ THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) { } - for ( b = 0; b < this.bones.length; b ++ ) { - - gbone = this.geometry.bones[ b ]; - bone = this.bones[ b ]; - - if ( gbone.parent === -1 ) { + for ( var b = 0; b < boneList.length; ++b ) { - this.add( bone ); + gbone = boneList[ b ]; - } else { + if ( gbone.parent !== -1 ) { - this.bones[ gbone.parent ].add( bone ); + this.bones[ gbone.parent ].add( this.bones[ b ] ); } @@ -16950,11 +16952,11 @@ THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) { if ( this.useVertexTexture ) { // layout (1 matrix = 4 pixels) - // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4) + // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4) // with 8x8 pixel texture max 16 bones (8 * 8 / 4) - // 16x16 pixel texture max 64 bones (16 * 16 / 4) - // 32x32 pixel texture max 256 bones (32 * 32 / 4) - // 64x64 pixel texture max 1024 bones (64 * 64 / 4) + // 16x16 pixel texture max 64 bones (16 * 16 / 4) + // 32x32 pixel texture max 256 bones (32 * 32 / 4) + // 64x64 pixel texture max 1024 bones (64 * 64 / 4) var size; @@ -16983,15 +16985,15 @@ THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) { } - this.pose(); - } }; -THREE.SkinnedMesh.prototype = Object.create( THREE.Mesh.prototype ); -THREE.SkinnedMesh.prototype.addBone = function( bone ) { +THREE.Skeleton.prototype = Object.create( THREE.Mesh.prototype ); + + +THREE.Skeleton.prototype.addBone = function( bone ) { if ( bone === undefined ) { @@ -17005,6 +17007,57 @@ THREE.SkinnedMesh.prototype.addBone = function( bone ) { }; + +THREE.Skeleton.prototype.calculateInverses = function( bone ) { + + this.boneInverses = []; + + for ( var b = 0, bl = this.bones.length; b < bl; ++b ) { + + var inverse = new THREE.Matrix4(); + + inverse.getInverse( this.bones[ b ].skinMatrix ); + + this.boneInverses.push( inverse ); + + } + +}; + +/** + * @author mikael emtinger / http://gomo.se/ + * @author alteredq / http://alteredqualia.com/ + */ + +THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) { + + THREE.Mesh.call( this, geometry, material ); + + this.skeleton = new THREE.Skeleton( this.geometry && this.geometry.bones, useVertexTexture ); + + // Add root level bones as children of the mesh + + for ( var b = 0; b < this.skeleton.bones.length; ++b ) { + + var bone = this.skeleton.bones[ b ]; + + if ( bone.parent === undefined ) { + + this.add( bone ); + + } + + } + + this.identityMatrix = new THREE.Matrix4(); + + this.pose(); + +}; + + +THREE.SkinnedMesh.prototype = Object.create( THREE.Mesh.prototype ); + THREE.SkinnedMesh.prototype.updateMatrixWorld = function () { var offsetMatrix = new THREE.Matrix4(); @@ -17053,25 +17106,15 @@ THREE.SkinnedMesh.prototype.updateMatrixWorld = function () { // make a snapshot of the bones' rest position - if ( this.boneInverses == undefined ) { - - this.boneInverses = []; - - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { - - var inverse = new THREE.Matrix4(); - - inverse.getInverse( this.bones[ b ].skinMatrix ); + if ( this.skeleton.boneInverses === undefined ) { - this.boneInverses.push( inverse ); - - } + this.skeleton.calculateInverses(); } // flatten bone matrices to array - for ( var b = 0, bl = this.bones.length; b < bl; b ++ ) { + for ( var b = 0, bl = this.skeleton.bones.length; b < bl; b ++ ) { // compute the offset between the current and the original transform; @@ -17079,14 +17122,14 @@ THREE.SkinnedMesh.prototype.updateMatrixWorld = function () { // was already representing the offset; however, this requires some // major changes to the animation system - offsetMatrix.multiplyMatrices( this.bones[ b ].skinMatrix, this.boneInverses[ b ] ); - offsetMatrix.flattenToArrayOffset( this.boneMatrices, b * 16 ); + offsetMatrix.multiplyMatrices( this.skeleton.bones[ b ].skinMatrix, this.skeleton.boneInverses[ b ] ); + offsetMatrix.flattenToArrayOffset( this.skeleton.boneMatrices, b * 16 ); } - if ( this.useVertexTexture ) { + if ( this.skeleton.useVertexTexture ) { - this.boneTexture.needsUpdate = true; + this.skeleton.boneTexture.needsUpdate = true; } @@ -22141,7 +22184,7 @@ THREE.WebGLRenderer = function ( parameters ) { var _glExtensionCompressedTextureS3TC; var _glExtensionElementIndexUint; var _glExtensionFragDepth; - + initGL(); @@ -22561,7 +22604,7 @@ THREE.WebGLRenderer = function ( parameters ) { if ( attributes[ key ].buffer !== undefined ) { _gl.deleteBuffer( attributes[ key ].buffer ); - + } } @@ -22742,7 +22785,7 @@ THREE.WebGLRenderer = function ( parameters ) { attribute.__webglInitialized = true; - var size = 1; // "f" and "i" + var size = 1; // "f" and "i" if ( attribute.type === "v2" ) size = 2; else if ( attribute.type === "v3" ) size = 3; @@ -22922,7 +22965,7 @@ THREE.WebGLRenderer = function ( parameters ) { attribute.__webglInitialized = true; - var size = 1; // "f" and "i" + var size = 1; // "f" and "i" if( attribute.type === "v2" ) size = 2; else if( attribute.type === "v3" ) size = 3; @@ -23004,11 +23047,11 @@ THREE.WebGLRenderer = function ( parameters ) { // material must use some texture to require uvs if ( material.map || - material.lightMap || - material.bumpMap || - material.normalMap || - material.specularMap || - material instanceof THREE.ShaderMaterial ) { + material.lightMap || + material.bumpMap || + material.normalMap || + material.specularMap || + material instanceof THREE.ShaderMaterial ) { return true; @@ -23134,7 +23177,7 @@ THREE.WebGLRenderer = function ( parameters ) { value = customAttribute.value[ index ]; - customAttribute.array[ offset ] = value.x; + customAttribute.array[ offset ] = value.x; customAttribute.array[ offset + 1 ] = value.y; offset += 2; @@ -23167,7 +23210,7 @@ THREE.WebGLRenderer = function ( parameters ) { value = customAttribute.value[ index ]; - customAttribute.array[ offset ] = value.x; + customAttribute.array[ offset ] = value.x; customAttribute.array[ offset + 1 ] = value.y; customAttribute.array[ offset + 2 ] = value.z; @@ -23242,7 +23285,7 @@ THREE.WebGLRenderer = function ( parameters ) { if ( customAttribute.needsUpdate && ( customAttribute.boundTo === undefined || - customAttribute.boundTo === "vertices") ) { + customAttribute.boundTo === "vertices") ) { cal = customAttribute.value.length; @@ -23262,7 +23305,7 @@ THREE.WebGLRenderer = function ( parameters ) { value = customAttribute.value[ ca ]; - customAttribute.array[ offset ] = value.x; + customAttribute.array[ offset ] = value.x; customAttribute.array[ offset + 1 ] = value.y; offset += 2; @@ -23277,7 +23320,7 @@ THREE.WebGLRenderer = function ( parameters ) { value = customAttribute.value[ ca ]; - customAttribute.array[ offset ] = value.r; + customAttribute.array[ offset ] = value.r; customAttribute.array[ offset + 1 ] = value.g; customAttribute.array[ offset + 2 ] = value.b; @@ -23291,7 +23334,7 @@ THREE.WebGLRenderer = function ( parameters ) { value = customAttribute.value[ ca ]; - customAttribute.array[ offset ] = value.x; + customAttribute.array[ offset ] = value.x; customAttribute.array[ offset + 1 ] = value.y; customAttribute.array[ offset + 2 ] = value.z; @@ -23444,7 +23487,7 @@ THREE.WebGLRenderer = function ( parameters ) { if ( customAttribute.needsUpdate && ( customAttribute.boundTo === undefined || - customAttribute.boundTo === "vertices" ) ) { + customAttribute.boundTo === "vertices" ) ) { offset = 0; @@ -23464,7 +23507,7 @@ THREE.WebGLRenderer = function ( parameters ) { value = customAttribute.value[ ca ]; - customAttribute.array[ offset ] = value.x; + customAttribute.array[ offset ] = value.x; customAttribute.array[ offset + 1 ] = value.y; offset += 2; @@ -23479,7 +23522,7 @@ THREE.WebGLRenderer = function ( parameters ) { value = customAttribute.value[ ca ]; - customAttribute.array[ offset ] = value.r; + customAttribute.array[ offset ] = value.r; customAttribute.array[ offset + 1 ] = value.g; customAttribute.array[ offset + 2 ] = value.b; @@ -23493,7 +23536,7 @@ THREE.WebGLRenderer = function ( parameters ) { value = customAttribute.value[ ca ]; - customAttribute.array[ offset ] = value.x; + customAttribute.array[ offset ] = value.x; customAttribute.array[ offset + 1 ] = value.y; customAttribute.array[ offset + 2 ] = value.z; @@ -23509,7 +23552,7 @@ THREE.WebGLRenderer = function ( parameters ) { value = customAttribute.value[ ca ]; - customAttribute.array[ offset ] = value.x; + customAttribute.array[ offset ] = value.x; customAttribute.array[ offset + 1 ] = value.y; customAttribute.array[ offset + 2 ] = value.z; customAttribute.array[ offset + 3 ] = value.w; @@ -23672,7 +23715,7 @@ THREE.WebGLRenderer = function ( parameters ) { vka = morphTargetsArrays[ vk ]; - vka[ offset_morphTarget ] = v1.x; + vka[ offset_morphTarget ] = v1.x; vka[ offset_morphTarget + 1 ] = v1.y; vka[ offset_morphTarget + 2 ] = v1.z; @@ -23706,7 +23749,7 @@ THREE.WebGLRenderer = function ( parameters ) { nka = morphNormalsArrays[ vk ]; - nka[ offset_morphTarget ] = n1.x; + nka[ offset_morphTarget ] = n1.x; nka[ offset_morphTarget + 1 ] = n1.y; nka[ offset_morphTarget + 2 ] = n1.z; @@ -23744,7 +23787,7 @@ THREE.WebGLRenderer = function ( parameters ) { for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - face = obj_faces[ chunk_faces3[ f ] ]; + face = obj_faces[ chunk_faces3[ f ] ]; // weights @@ -23808,7 +23851,7 @@ THREE.WebGLRenderer = function ( parameters ) { for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - face = obj_faces[ chunk_faces3[ f ] ]; + face = obj_faces[ chunk_faces3[ f ] ]; vertexColors = face.vertexColors; faceColor = face.color; @@ -23856,7 +23899,7 @@ THREE.WebGLRenderer = function ( parameters ) { for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - face = obj_faces[ chunk_faces3[ f ] ]; + face = obj_faces[ chunk_faces3[ f ] ]; vertexTangents = face.vertexTangents; @@ -23892,7 +23935,7 @@ THREE.WebGLRenderer = function ( parameters ) { for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - face = obj_faces[ chunk_faces3[ f ] ]; + face = obj_faces[ chunk_faces3[ f ] ]; vertexNormals = face.vertexNormals; faceNormal = face.normal; @@ -24000,7 +24043,7 @@ THREE.WebGLRenderer = function ( parameters ) { for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - faceArray[ offset_face ] = vertexIndex; + faceArray[ offset_face ] = vertexIndex; faceArray[ offset_face + 1 ] = vertexIndex + 1; faceArray[ offset_face + 2 ] = vertexIndex + 2; @@ -24046,9 +24089,9 @@ THREE.WebGLRenderer = function ( parameters ) { for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - face = obj_faces[ chunk_faces3[ f ] ]; + face = obj_faces[ chunk_faces3[ f ] ]; - customAttribute.array[ offset_custom ] = customAttribute.value[ face.a ]; + customAttribute.array[ offset_custom ] = customAttribute.value[ face.a ]; customAttribute.array[ offset_custom + 1 ] = customAttribute.value[ face.b ]; customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ face.c ]; @@ -24062,7 +24105,7 @@ THREE.WebGLRenderer = function ( parameters ) { value = customAttribute.value[ chunk_faces3[ f ] ]; - customAttribute.array[ offset_custom ] = value; + customAttribute.array[ offset_custom ] = value; customAttribute.array[ offset_custom + 1 ] = value; customAttribute.array[ offset_custom + 2 ] = value; @@ -24078,13 +24121,13 @@ THREE.WebGLRenderer = function ( parameters ) { for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - face = obj_faces[ chunk_faces3[ f ] ]; + face = obj_faces[ chunk_faces3[ f ] ]; v1 = customAttribute.value[ face.a ]; v2 = customAttribute.value[ face.b ]; v3 = customAttribute.value[ face.c ]; - customAttribute.array[ offset_custom ] = v1.x; + customAttribute.array[ offset_custom ] = v1.x; customAttribute.array[ offset_custom + 1 ] = v1.y; customAttribute.array[ offset_custom + 2 ] = v2.x; @@ -24107,7 +24150,7 @@ THREE.WebGLRenderer = function ( parameters ) { v2 = value; v3 = value; - customAttribute.array[ offset_custom ] = v1.x; + customAttribute.array[ offset_custom ] = v1.x; customAttribute.array[ offset_custom + 1 ] = v1.y; customAttribute.array[ offset_custom + 2 ] = v2.x; @@ -24140,13 +24183,13 @@ THREE.WebGLRenderer = function ( parameters ) { for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - face = obj_faces[ chunk_faces3[ f ] ]; + face = obj_faces[ chunk_faces3[ f ] ]; v1 = customAttribute.value[ face.a ]; v2 = customAttribute.value[ face.b ]; v3 = customAttribute.value[ face.c ]; - customAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ]; + customAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ]; customAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ]; customAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ]; @@ -24172,7 +24215,7 @@ THREE.WebGLRenderer = function ( parameters ) { v2 = value; v3 = value; - customAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ]; + customAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ]; customAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ]; customAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ]; @@ -24198,7 +24241,7 @@ THREE.WebGLRenderer = function ( parameters ) { v2 = value[ 1 ]; v3 = value[ 2 ]; - customAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ]; + customAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ]; customAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ]; customAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ]; @@ -24222,13 +24265,13 @@ THREE.WebGLRenderer = function ( parameters ) { for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - face = obj_faces[ chunk_faces3[ f ] ]; + face = obj_faces[ chunk_faces3[ f ] ]; v1 = customAttribute.value[ face.a ]; v2 = customAttribute.value[ face.b ]; v3 = customAttribute.value[ face.c ]; - customAttribute.array[ offset_custom ] = v1.x; + customAttribute.array[ offset_custom ] = v1.x; customAttribute.array[ offset_custom + 1 ] = v1.y; customAttribute.array[ offset_custom + 2 ] = v1.z; customAttribute.array[ offset_custom + 3 ] = v1.w; @@ -24257,7 +24300,7 @@ THREE.WebGLRenderer = function ( parameters ) { v2 = value; v3 = value; - customAttribute.array[ offset_custom ] = v1.x; + customAttribute.array[ offset_custom ] = v1.x; customAttribute.array[ offset_custom + 1 ] = v1.y; customAttribute.array[ offset_custom + 2 ] = v1.z; customAttribute.array[ offset_custom + 3 ] = v1.w; @@ -24286,7 +24329,7 @@ THREE.WebGLRenderer = function ( parameters ) { v2 = value[ 1 ]; v3 = value[ 2 ]; - customAttribute.array[ offset_custom ] = v1.x; + customAttribute.array[ offset_custom ] = v1.x; customAttribute.array[ offset_custom + 1 ] = v1.y; customAttribute.array[ offset_custom + 2 ] = v1.z; customAttribute.array[ offset_custom + 3 ] = v1.w; @@ -24417,7 +24460,7 @@ THREE.WebGLRenderer = function ( parameters ) { ny = ( nay + nby + ncy ) / 3; nz = ( naz + nbz + ncz ) / 3; - normalArray[ i ] = nx; + normalArray[ i ] = nx; normalArray[ i + 1 ] = ny; normalArray[ i + 2 ] = nz; @@ -24501,7 +24544,7 @@ THREE.WebGLRenderer = function ( parameters ) { } disableUnusedAttributes(); - + } this.renderBufferDirect = function ( camera, lights, fog, material, geometry, object ) { @@ -24544,17 +24587,17 @@ THREE.WebGLRenderer = function ( parameters ) { // indexed triangles var type, size; - + if ( index.array instanceof Uint32Array ) { - + type = _gl.UNSIGNED_INT; size = 4; - + } else { - + type = _gl.UNSIGNED_SHORT; size = 2; - + } var offsets = geometry.offsets; @@ -24653,23 +24696,23 @@ THREE.WebGLRenderer = function ( parameters ) { setLineWidth( material.linewidth ); var index = geometryAttributes[ "index" ]; - + if ( index ) { // indexed lines var type, size; - + if ( index.array instanceof Uint32Array ){ - + type = _gl.UNSIGNED_INT; size = 4; - + } else { - + type = _gl.UNSIGNED_SHORT; size = 2; - + } var offsets = geometry.offsets; @@ -24682,7 +24725,7 @@ THREE.WebGLRenderer = function ( parameters ) { _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer ); } - + _gl.drawElements( _gl.LINES, index.array.length, type, 0 ); // 2 bytes per Uint16Array _this.info.render.calls ++; @@ -24708,7 +24751,7 @@ THREE.WebGLRenderer = function ( parameters ) { } // render indexed lines - + _gl.drawElements( _gl.LINES, offsets[ i ].count, type, offsets[ i ].start * size ); // 2 bytes per Uint16Array _this.info.render.calls ++; @@ -24925,7 +24968,7 @@ THREE.WebGLRenderer = function ( parameters ) { var type = geometryGroup.__typeArray === Uint32Array ? _gl.UNSIGNED_INT : _gl.UNSIGNED_SHORT; // wireframe - + if ( material.wireframe ) { setLineWidth( material.wireframeLinewidth ); @@ -26061,7 +26104,7 @@ THREE.WebGLRenderer = function ( parameters ) { skinning: material.skinning, maxBones: maxBones, - useVertexTexture: _supportsBoneTextures && object && object.useVertexTexture, + useVertexTexture: _supportsBoneTextures && object && object.skeleton && object.skeleton.useVertexTexture, morphTargets: material.morphTargets, morphNormals: material.morphNormals, @@ -26274,26 +26317,26 @@ THREE.WebGLRenderer = function ( parameters ) { if ( material.skinning ) { - if ( _supportsBoneTextures && object.useVertexTexture ) { + if ( _supportsBoneTextures && object.skeleton.useVertexTexture ) { if ( p_uniforms.boneTexture !== null ) { var textureUnit = getTextureUnit(); _gl.uniform1i( p_uniforms.boneTexture, textureUnit ); - _this.setTexture( object.boneTexture, textureUnit ); + _this.setTexture( object.skeleton.boneTexture, textureUnit ); } if ( p_uniforms.boneTextureWidth !== null ) { - _gl.uniform1i( p_uniforms.boneTextureWidth, object.boneTextureWidth ); + _gl.uniform1i( p_uniforms.boneTextureWidth, object.skeleton.boneTextureWidth ); } if ( p_uniforms.boneTextureHeight !== null ) { - _gl.uniform1i( p_uniforms.boneTextureHeight, object.boneTextureHeight ); + _gl.uniform1i( p_uniforms.boneTextureHeight, object.skeleton.boneTextureHeight ); } @@ -26301,7 +26344,7 @@ THREE.WebGLRenderer = function ( parameters ) { if ( p_uniforms.boneGlobalMatrices !== null ) { - _gl.uniformMatrix4fv( p_uniforms.boneGlobalMatrices, false, object.boneMatrices ); + _gl.uniformMatrix4fv( p_uniforms.boneGlobalMatrices, false, object.skeleton.boneMatrices ); } @@ -26465,10 +26508,10 @@ THREE.WebGLRenderer = function ( parameters ) { } // uv repeat and offset setting priorities - // 1. color map - // 2. specular map - // 3. normal map - // 4. bump map + // 1. color map + // 2. specular map + // 3. normal map + // 4. bump map var uvScaleMap; @@ -26762,7 +26805,7 @@ THREE.WebGLRenderer = function ( parameters ) { offset = i * 2; - uniform._array[ offset ] = value[ i ].x; + uniform._array[ offset ] = value[ i ].x; uniform._array[ offset + 1 ] = value[ i ].y; } @@ -26781,7 +26824,7 @@ THREE.WebGLRenderer = function ( parameters ) { offset = i * 3; - uniform._array[ offset ] = value[ i ].x; + uniform._array[ offset ] = value[ i ].x; uniform._array[ offset + 1 ] = value[ i ].y; uniform._array[ offset + 2 ] = value[ i ].z; @@ -26801,7 +26844,7 @@ THREE.WebGLRenderer = function ( parameters ) { offset = i * 4; - uniform._array[ offset ] = value[ i ].x; + uniform._array[ offset ] = value[ i ].x; uniform._array[ offset + 1 ] = value[ i ].y; uniform._array[ offset + 2 ] = value[ i ].z; uniform._array[ offset + 3 ] = value[ i ].w; @@ -27618,7 +27661,7 @@ THREE.WebGLRenderer = function ( parameters ) { _gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, glFormat, glType, cubeImage[ i ] ); } else { - + var mipmap, mipmaps = cubeImage[ i ].mipmaps; for( var j = 0, jl = mipmaps.length; j < jl; j ++ ) { @@ -27950,7 +27993,7 @@ THREE.WebGLRenderer = function ( parameters ) { function allocateBones ( object ) { - if ( _supportsBoneTextures && object && object.useVertexTexture ) { + if ( _supportsBoneTextures && object && object.skeleton && object.skeleton.useVertexTexture ) { return 1024; @@ -27960,7 +28003,7 @@ THREE.WebGLRenderer = function ( parameters ) { // ( for example when prebuilding shader // to be used with multiple objects ) // - // - leave some extra space for other uniforms + // - leave some extra space for other uniforms // - limit here is ANGLE's 254 max uniform vectors // (up to 54 should be safe) @@ -27971,11 +28014,11 @@ THREE.WebGLRenderer = function ( parameters ) { if ( object !== undefined && object instanceof THREE.SkinnedMesh ) { - maxBones = Math.min( object.bones.length, maxBones ); + maxBones = Math.min( object.skeleton.bones.length, maxBones ); - if ( maxBones < object.bones.length ) { + if ( maxBones < object.skeleton.bones.length ) { - console.warn( "WebGLRenderer: too many bones - " + object.bones.length + ", this GPU supports just " + maxBones + " (try OpenGL instead of ANGLE)" ); + console.warn( "WebGLRenderer: too many bones - " + object.skeleton.bones.length + ", this GPU supports just " + maxBones + " (try OpenGL instead of ANGLE)" ); } @@ -28068,8 +28111,8 @@ THREE.WebGLRenderer = function ( parameters ) { _glExtensionCompressedTextureS3TC = _gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' ); _glExtensionElementIndexUint = _gl.getExtension( 'OES_element_index_uint' ); - - + + if ( _glExtensionTextureFloat === null ) { console.log( 'THREE.WebGLRenderer: Float textures not supported.' ); @@ -28139,7 +28182,7 @@ THREE.WebGLRenderer = function ( parameters ) { _gl.blendFunc( _gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA ); _gl.viewport( _viewportX, _viewportY, _viewportWidth, _viewportHeight ); - + _gl.clearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha ); }; @@ -32601,7 +32644,7 @@ THREE.AnimationHandler = ( function () { console.log( "THREE.AnimationHandler.add: Warning! " + name + " doesn't exists in library. Doing nothing." ); } - + library[ name ] = undefined; }; @@ -32636,9 +32679,9 @@ THREE.AnimationHandler = ( function () { if ( root instanceof THREE.SkinnedMesh ) { - for ( var b = 0; b < root.bones.length; b++ ) { + for ( var b = 0; b < root.skeleton.bones.length; b++ ) { - hierarchy.push( root.bones[ b ] ); + hierarchy.push( root.skeleton.bones[ b ] ); } @@ -32806,23 +32849,24 @@ THREE.Animation = function ( root, name ) { this.isPlaying = false; this.isPaused = true; this.loop = true; + this.weight = 0; this.interpolationType = THREE.AnimationHandler.LINEAR; }; -THREE.Animation.prototype.play = function ( startTime ) { - this.currentTime = startTime !== undefined ? startTime : 0; +THREE.Animation.prototype.keyTypes = [ "pos", "rot", "scl" ]; - if ( this.isPlaying === false ) { - this.isPlaying = true; +THREE.Animation.prototype.play = function ( startTime, weight ) { - this.reset(); - this.update( 0 ); + this.currentTime = startTime !== undefined ? startTime : 0; + this.weight = weight !== undefined ? weight: 1; - } + this.isPlaying = true; + this.reset(); + this.update( 0 ); this.isPaused = false; @@ -32867,22 +32911,40 @@ THREE.Animation.prototype.reset = function () { if ( object.animationCache === undefined ) { object.animationCache = {}; - object.animationCache.prevKey = { pos: 0, rot: 0, scl: 0 }; - object.animationCache.nextKey = { pos: 0, rot: 0, scl: 0 }; - object.animationCache.originalMatrix = object instanceof THREE.Bone ? object.skinMatrix : object.matrix; } - var prevKey = object.animationCache.prevKey; - var nextKey = object.animationCache.nextKey; + if ( object.animationCache[this.data.name] === undefined ) { + + object.animationCache[this.data.name] = {}; + object.animationCache[this.data.name].prevKey = { pos: 0, rot: 0, scl: 0 }; + object.animationCache[this.data.name].nextKey = { pos: 0, rot: 0, scl: 0 }; + object.animationCache[this.data.name].originalMatrix = object instanceof THREE.Bone ? object.skinMatrix : object.matrix; + + } + + var animationCache = object.animationCache[this.data.name]; + + // Get keys to match our current time + + for ( var t = 0; t < 3; t ++ ) { - prevKey.pos = this.data.hierarchy[ h ].keys[ 0 ]; - prevKey.rot = this.data.hierarchy[ h ].keys[ 0 ]; - prevKey.scl = this.data.hierarchy[ h ].keys[ 0 ]; + var type = this.keyTypes[ t ]; - nextKey.pos = this.getNextKeyWith( "pos", h, 1 ); - nextKey.rot = this.getNextKeyWith( "rot", h, 1 ); - nextKey.scl = this.getNextKeyWith( "scl", h, 1 ); + var prevKey = this.data.hierarchy[ h ].keys[ 0 ]; + var nextKey = this.getNextKeyWith( type, h, 1 ); + + while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) { + + prevKey = nextKey; + nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 ); + + } + + animationCache.prevKey[ type ] = prevKey; + animationCache.nextKey[ type ] = nextKey; + + } } @@ -32893,7 +32955,9 @@ THREE.Animation.prototype.update = (function(){ var points = []; var target = new THREE.Vector3(); - + var newVector = new THREE.Vector3(); + var newQuat = new THREE.Quaternion(); + // Catmull-Rom spline var interpolateCatmullRom = function ( points, scale ) { @@ -32901,172 +32965,222 @@ THREE.Animation.prototype.update = (function(){ var c = [], v3 = [], point, intPoint, weight, w2, w3, pa, pb, pc, pd; - + point = ( points.length - 1 ) * scale; intPoint = Math.floor( point ); weight = point - intPoint; - + c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1; c[ 1 ] = intPoint; c[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1; c[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2; - + pa = points[ c[ 0 ] ]; pb = points[ c[ 1 ] ]; pc = points[ c[ 2 ] ]; pd = points[ c[ 3 ] ]; - + w2 = weight * weight; w3 = weight * w2; - + v3[ 0 ] = interpolate( pa[ 0 ], pb[ 0 ], pc[ 0 ], pd[ 0 ], weight, w2, w3 ); v3[ 1 ] = interpolate( pa[ 1 ], pb[ 1 ], pc[ 1 ], pd[ 1 ], weight, w2, w3 ); v3[ 2 ] = interpolate( pa[ 2 ], pb[ 2 ], pc[ 2 ], pd[ 2 ], weight, w2, w3 ); - + return v3; }; var interpolate = function ( p0, p1, p2, p3, t, t2, t3 ) { - + var v0 = ( p2 - p0 ) * 0.5, v1 = ( p3 - p1 ) * 0.5; - + return ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1; - + }; - + return function ( delta ) { if ( this.isPlaying === false ) return; - + this.currentTime += delta * this.timeScale; - + + if ( this.weight === 0 ) + return; + // - + var vector; - var types = [ "pos", "rot", "scl" ]; - var duration = this.data.length; - + if ( this.loop === true && this.currentTime > duration ) { - + this.currentTime %= duration; this.reset(); - + } else if ( this.loop === false && this.currentTime > duration ) { - + this.stop(); return; - + } - - this.currentTime = Math.min( this.currentTime, duration ); - + for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) { - + var object = this.hierarchy[ h ]; - var animationCache = object.animationCache; - + var animationCache = object.animationCache[this.data.name]; + // loop through pos/rot/scl - + for ( var t = 0; t < 3; t ++ ) { - + // get keys - - var type = types[ t ]; + + var type = this.keyTypes[ t ]; var prevKey = animationCache.prevKey[ type ]; var nextKey = animationCache.nextKey[ type ]; - + if ( nextKey.time <= this.currentTime ) { - + prevKey = this.data.hierarchy[ h ].keys[ 0 ]; nextKey = this.getNextKeyWith( type, h, 1 ); - + while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) { - + prevKey = nextKey; nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 ); - + } - + animationCache.prevKey[ type ] = prevKey; animationCache.nextKey[ type ] = nextKey; - + } - + object.matrixAutoUpdate = true; object.matrixWorldNeedsUpdate = true; - + var scale = ( this.currentTime - prevKey.time ) / ( nextKey.time - prevKey.time ); - + var prevXYZ = prevKey[ type ]; var nextXYZ = nextKey[ type ]; - + if ( scale < 0 ) scale = 0; if ( scale > 1 ) scale = 1; - + // interpolate - + if ( type === "pos" ) { - + vector = object.position; - + if ( this.interpolationType === THREE.AnimationHandler.LINEAR ) { - - vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale; - vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale; - vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale; - + + newVector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale; + newVector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale; + newVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale; + + // blend + if (object instanceof THREE.Bone) { + + var proportionalWeight = this.weight / ( this.weight + object.accumulatedPosWeight ); + vector.lerp( newVector, proportionalWeight ); + object.accumulatedPosWeight += this.weight; + + } else + vector = newVector; + } else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM || this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { - + points[ 0 ] = this.getPrevKeyWith( "pos", h, prevKey.index - 1 )[ "pos" ]; points[ 1 ] = prevXYZ; points[ 2 ] = nextXYZ; points[ 3 ] = this.getNextKeyWith( "pos", h, nextKey.index + 1 )[ "pos" ]; - + scale = scale * 0.33 + 0.33; - + var currentPoint = interpolateCatmullRom( points, scale ); - - vector.x = currentPoint[ 0 ]; - vector.y = currentPoint[ 1 ]; - vector.z = currentPoint[ 2 ]; - + + if ( object instanceof THREE.Bone ) { + + var proportionalWeight = this.weight / ( this.weight + object.accumulatedPosWeight ); + object.accumulatedPosWeight += this.weight; + + } + else + var proportionalWeight = 1; + + // blend + vector.x = vector.x + ( currentPoint[ 0 ] - vector.x ) * proportionalWeight; + vector.y = vector.y + ( currentPoint[ 1 ] - vector.y ) * proportionalWeight; + vector.z = vector.z + ( currentPoint[ 2 ] - vector.z ) * proportionalWeight; + if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { - + var forwardPoint = interpolateCatmullRom( points, scale * 1.01 ); - + target.set( forwardPoint[ 0 ], forwardPoint[ 1 ], forwardPoint[ 2 ] ); target.sub( vector ); target.y = 0; target.normalize(); - + var angle = Math.atan2( target.x, target.z ); object.rotation.set( 0, angle, 0 ); - + } - + } - + } else if ( type === "rot" ) { - - THREE.Quaternion.slerp( prevXYZ, nextXYZ, object.quaternion, scale ); - + + THREE.Quaternion.slerp( prevXYZ, nextXYZ, newQuat, scale ); + + // Avoid paying the cost of an additional slerp if we don't have to + if ( !( object instanceof THREE.Bone ) ) { + + object.quaternion.copy(newQuat); + + } + else if ( object.accumulatedRotWeight === 0) { + + object.quaternion.copy(newQuat); + object.accumulatedRotWeight = this.weight; + + } + else { + + var proportionalWeight = this.weight / ( this.weight + object.accumulatedRotWeight ); + THREE.Quaternion.slerp( object.quaternion, newQuat, object.quaternion, proportionalWeight ); + object.accumulatedRotWeight += this.weight; + + } + } else if ( type === "scl" ) { - + vector = object.scale; - - vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale; - vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale; - vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale; - + + newVector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale; + newVector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale; + newVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale; + + if ( object instanceof THREE.Bone ) { + + var proportionalWeight = this.weight / ( this.weight + object.accumulatedSclWeight); + vector.lerp( newVector, proportionalWeight ); + object.accumulatedSclWeight += this.weight; + + } else + vector = newVector; + } - + } - + } + return true; + }; })(); @@ -33277,7 +33391,7 @@ THREE.KeyFrameAnimation.prototype.stop = function() { // reset JIT matrix and remove cache for ( var h = 0; h < this.data.hierarchy.length; h++ ) { - + var obj = this.hierarchy[ h ]; var node = this.data.hierarchy[ h ]; @@ -37148,6 +37262,110 @@ THREE.PointLightHelper.prototype.update = function () { }; +/** + * @author Sean Griffin / http://twitter.com/sgrif + * @author Michael Guerrero / http://realitymeltdown.com + */ + +THREE.SkeletonHelper = function ( skeleton, jointBoxSize, scaleRatio ) { + + THREE.Object3D.call( this ); + + this.scaleRatio = ( scaleRatio !== undefined ) ? scaleRatio : 1; + this.skeleton = skeleton; + + if ( jointBoxSize === undefined ) jointBoxSize = 1; + + var boxSize = jointBoxSize * this.scaleRatio; + + for ( var i = 0; i < skeleton.bones.length; ++i ) { + + var bone = skeleton.bones[ i ]; + var boxGeometry = new THREE.BoxGeometry( boxSize, boxSize, boxSize ); + var boxMaterial = new THREE.MeshBasicMaterial(); + + bone.helper = {}; + bone.helper.box = new THREE.Mesh( boxGeometry, boxMaterial ); + bone.helper.axes = new THREE.AxisHelper( jointBoxSize * 3 ); + + this.add( bone.helper.box ); + this.add( bone.helper.axes ); + + if ( bone.parent instanceof THREE.Bone ) { + + var lineMaterial = new THREE.LineBasicMaterial(); + var lineGeometry = new THREE.Geometry(); + + lineMaterial.vertexColors = true; + + lineGeometry.vertices.push( new THREE.Vector3() ); + lineGeometry.vertices.push( new THREE.Vector3() ); + lineGeometry.colors.push( new THREE.Color( 1, 1, 0 ) ); + lineGeometry.colors.push( new THREE.Color( 0, 0, 0 ) ); + + bone.helper.line = new THREE.Line( lineGeometry, lineMaterial ); + this.add( bone.helper.line); + + } + + } + + this.update(); +}; + + +THREE.SkeletonHelper.prototype = Object.create( THREE.Object3D.prototype ); + +THREE.SkeletonHelper.prototype.update = function () { + + for ( var i = 0; i < this.skeleton.bones.length; ++i ) { + + var bone = this.skeleton.bones[ i ]; + + if ( this.visible && bone.parent instanceof THREE.Bone ) { + + bone.skinMatrix.decompose( bone.helper.box.position, bone.helper.box.quaternion, bone.helper.box.scale ); + bone.helper.box.position.multiplyScalar( this.scaleRatio ); + + bone.helper.axes.quaternion = bone.helper.box.quaternion; + bone.helper.axes.position = bone.helper.box.position; + bone.helper.axes.scale = bone.helper.box.scale; + + bone.helper.line.geometry.vertices[0].setFromMatrixPosition( bone.skinMatrix ); + bone.helper.line.geometry.vertices[0].multiplyScalar( this.scaleRatio ); + + bone.helper.line.geometry.vertices[1].setFromMatrixPosition( bone.parent.skinMatrix ); + bone.helper.line.geometry.vertices[1].multiplyScalar( this.scaleRatio ); + + bone.helper.line.geometry.verticesNeedUpdate = true; + + } + + } + +}; + +THREE.SkeletonHelper.prototype.setVisible = function ( shouldBeVisible ) { + + for ( var i = 0; i < this.skeleton.bones.length; ++i ) { + + var bone = this.skeleton.bones[ i ]; + if ( bone.helper ) { + + bone.helper.box.visible = shouldBeVisible; + bone.helper.axes.visible = shouldBeVisible; + + if ( bone.parent instanceof THREE.Bone ) { + + bone.helper.line.visible = shouldBeVisible; + + } + + } + + } +} + /** * @author alteredq / http://alteredqualia.com/ * @author mrdoob / http://mrdoob.com/ diff --git a/build/three.min.js b/build/three.min.js index e7c64103ad..eb9b4e154b 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -76,14 +76,14 @@ this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),copy:function(a) this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.xthis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getParameter:function(a,b){return(b||new THREE.Vector2).set((a.x-this.min.x)/(this.max.x-this.min.x), (a.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector2).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector2;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max); return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box2).copy(this)}};THREE.Box3=function(a,b){this.min=void 0!==a?a:new THREE.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector3(-Infinity,-Infinity,-Infinity)}; -THREE.Box3.prototype={constructor:THREE.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},addPoint:function(a){a.xthis.max.x&&(this.max.x=a.x);a.ythis.max.y&&(this.max.y=a.y);a.zthis.max.z&&(this.max.z=a.z)},setFromPoints:function(a){if(0this.max.x||a.ythis.max.y||a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a,b){return(b||new THREE.Vector3).set((a.x-this.min.x)/(this.max.x- -this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector3).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a= -new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=0.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(b){a[0].set(this.min.x,this.min.y, -this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty();this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a); -this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box3).copy(this)}};THREE.Matrix3=function(a,b,c,d,e,f,g,h,k){var l=this.elements=new Float32Array(9);l[0]=void 0!==a?a:1;l[3]=b||0;l[6]=c||0;l[1]=d||0;l[4]=void 0!==e?e:1;l[7]=f||0;l[2]=g||0;l[5]=h||0;l[8]=void 0!==k?k:1}; +THREE.Box3.prototype={constructor:THREE.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},addPoint:function(a){a.xthis.max.x&&(this.max.x=a.x);a.ythis.max.y&&(this.max.y=a.y);a.zthis.max.z&&(this.max.z=a.z);return this},setFromPoints:function(a){if(0this.max.x||a.ythis.max.y||a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a, +b){return(b||new THREE.Vector3).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector3).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min, +this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=0.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]; +return function(b){a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty(); +this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box3).copy(this)}};THREE.Matrix3=function(a,b,c,d,e,f,g,h,k){var l=this.elements=new Float32Array(9);l[0]=void 0!==a?a:1;l[3]=b||0;l[6]=c||0;l[1]=d||0;l[4]=void 0!==e?e:1;l[7]=f||0;l[2]=g||0;l[5]=h||0;l[8]=void 0!==k?k:1}; THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,g,h,k){var l=this.elements;l[0]=a;l[3]=b;l[6]=c;l[1]=d;l[4]=e;l[7]=f;l[2]=g;l[5]=h;l[8]=k;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)}, multiplyVector3Array:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var a=new THREE.Vector3;return function(b,c,d){void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;eh.end&&(h.end=e);b||(b=g)}}a.firstAnimation=b}; @@ -447,38 +448,38 @@ h),g.__webglLineCount=h,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.l THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)v(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],v(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,v(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function v(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function w(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function u(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function y(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Line?L(b.__webglObjects,a):a instanceof THREE.Sprite?x(b.__webglSprites,a):a instanceof THREE.LensFlare? x(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&L(b.__webglObjectsImmediate,a);delete a.__webglActive}function L(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function x(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function N(a,b,c,d,e){Ea=0;d.needsUpdate&&(d.program&&Fb(d),P.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(P.maxMorphTargets)); -var f=!1,g=d.program,h=g.uniforms,k=d.uniforms;g.id!==wa&&(m.useProgram(g.program),wa=g.id,f=!0);d.id!==fa&&(fa=d.id,f=!0);if(f||a!==Ia)m.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),da&&m.uniform1f(h.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==Ia&&(Ia=a);if(d.skinning)if(Gb&&e.useVertexTexture){if(null!==h.boneTexture){var l=J();m.uniform1i(h.boneTexture,l);P.setTexture(e.boneTexture,l)}null!==h.boneTextureWidth&&m.uniform1i(h.boneTextureWidth,e.boneTextureWidth);null!== -h.boneTextureHeight&&m.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&m.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(k.fogColor.value=c.color,c instanceof THREE.Fog?(k.fogNear.value=c.near,k.fogFar.value=c.far):c instanceof THREE.FogExp2&&(k.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(cb){var n,p=l=0,q=0,r,s,t,u=Bb,w=u.directional.colors,v=u.directional.positions, -y=u.point.colors,A=u.point.positions,L=u.point.distances,x=u.spot.colors,G=u.spot.positions,C=u.spot.distances,E=u.spot.directions,N=u.spot.anglesCos,F=u.spot.exponents,Q=u.hemi.skyColors,I=u.hemi.groundColors,U=u.hemi.positions,Y=0,ga=0,R=0,X=0,$=0,aa=0,ba=0,Z=0,W=n=0;c=t=W=0;for(f=b.length;cp;p++)P.autoScaleCubemaps&&!f?(q=l,u=p,w=c.image[p],y=dc,w.width<=y&&w.height<=y||(A=Math.max(w.width,w.height),v=Math.floor(w.width*y/A),y=Math.floor(w.height*y/A),A=document.createElement("canvas"),A.width=v,A.height=y,A.getContext("2d").drawImage(w,0,0,w.width,w.height,0,0,v,y),w=A),q[u]=w):l[p]=c.image[p];p=l[0];q=THREE.Math.isPowerOfTwo(p.width)&&THREE.Math.isPowerOfTwo(p.height);u=z(c.format);w=z(c.type);D(m.TEXTURE_CUBE_MAP,c,q);for(p=0;6>p;p++)if(f)for(y=l[p].mipmaps,A=0,L=y.length;A< -L;A++)v=y[A],c.format!==THREE.RGBAFormat?m.compressedTexImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+p,A,u,v.width,v.height,0,v.data):m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+p,A,u,v.width,v.height,0,u,w,v.data);else m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,u,u,w,l[p]);c.generateMipmaps&&q&&m.generateMipmap(m.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else m.activeTexture(m.TEXTURE0+f),m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else u instanceof THREE.WebGLRenderTargetCube? -(c=u,m.activeTexture(m.TEXTURE0+l),m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture)):P.setTexture(u,l)}else if("tv"===p){void 0===c._array&&(c._array=[]);p=0;for(q=c.value.length;p=Cb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Cb);Ea+=1;return a}function B(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function K(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function A(a){a!==ua&&(m.lineWidth(a),ua=a)}function G(a,b,c){ya!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),ya=a);!a||Z===b&&qa===c||(m.polygonOffset(b,c),Z=b,qa=c)}function D(a,b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,z(b.wrapS)), -m.texParameteri(a,m.TEXTURE_WRAP_T,z(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,z(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,z(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,F(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,F(b.minFilter)));db&&b.type!==THREE.FloatType&&(1p;p++)P.autoScaleCubemaps&&!f?(q=l,u=p,w=c.image[p],y=dc,w.width<=y&&w.height<=y||(A=Math.max(w.width,w.height),v=Math.floor(w.width*y/A),y=Math.floor(w.height*y/A),A=document.createElement("canvas"),A.width=v,A.height=y,A.getContext("2d").drawImage(w,0,0,w.width,w.height,0,0,v,y),w=A),q[u]=w):l[p]=c.image[p];p=l[0];q=THREE.Math.isPowerOfTwo(p.width)&&THREE.Math.isPowerOfTwo(p.height);u=z(c.format);w=z(c.type);D(m.TEXTURE_CUBE_MAP,c,q); +for(p=0;6>p;p++)if(f)for(y=l[p].mipmaps,A=0,L=y.length;A=Cb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Cb);Ea+=1;return a}function B(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function K(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function A(a){a!==ua&&(m.lineWidth(a),ua=a)}function G(a,b,c){ya!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),ya=a);!a||Z===b&&qa===c||(m.polygonOffset(b,c),Z=b,qa=c)}function D(a, +b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,z(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,z(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,z(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,z(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,F(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,F(b.minFilter)));db&&b.type!==THREE.FloatType&&(1f;f++){a.__webglFramebuffer[f]=m.createFramebuffer();a.__webglRenderbuffer[f]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=m.TEXTURE_CUBE_MAP_POSITIVE_X+f;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[f]);m.framebufferTexture2D(m.FRAMEBUFFER, m.COLOR_ATTACHMENT0,h,g.__webglTexture,0);C(a.__webglRenderbuffer[f],a)}c&&m.generateMipmap(m.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),D(m.TEXTURE_2D,a,c),m.texImage2D(m.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0, @@ -632,14 +633,17 @@ THREE.EllipseCurve.prototype.getPoint=function(a){var b;b=this.aEndAngle-this.aS d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;ca.hierarchy[c].keys[d].time&& (a.hierarchy[c].keys[d].time=0),void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=(new THREE.Quaternion).fromArray(h)}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;da.length-2?l:l+1;c[3]=l>a.length-3?l:l+2;l=a[c[0]];r=a[c[1]];p=a[c[2]];s=a[c[3]];c=k*k;n=k*c;h[0]=d(l[0],r[0],p[0],s[0],k,c,n);h[1]=d(l[1],r[1],p[1],s[1],k,c,n);h[2]=d(l[2],r[2],p[2],s[2],k,c,n);return h},d=function(a,b,c,d,k,l,n){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*n+(-3*(b-c)-2*a-d)*l+a*k+b};return function(d){if(!1!== -this.isPlaying){this.currentTime+=d*this.timeScale;var f;d=["pos","rot","scl"];var g=this.data.length;if(!0===this.loop&&this.currentTime>g)this.currentTime%=g,this.reset();else if(!1===this.loop&&this.currentTime>g){this.stop();return}this.currentTime=Math.min(this.currentTime,g);for(var g=0,h=this.hierarchy.length;gn;n++){f=d[n];var r=l.prevKey[f],p=l.nextKey[f];if(p.time<=this.currentTime){r=this.data.hierarchy[g].keys[0];for(p=this.getNextKeyWith(f, -g,1);p.timer.index;)r=p,p=this.getNextKeyWith(f,g,p.index+1);l.prevKey[f]=r;l.nextKey[f]=p}k.matrixAutoUpdate=!0;k.matrixWorldNeedsUpdate=!0;var s=(this.currentTime-r.time)/(p.time-r.time),t=r[f],q=p[f];0>s&&(s=0);1d;d++){for(var e=this.keyTypes[d],f=this.data.hierarchy[a].keys[0],g=this.getNextKeyWith(e,a,1);g.timef.index;)f=g,g=this.getNextKeyWith(e,a,g.index+1);c.prevKey[e]=f;c.nextKey[e]=g}}}; +THREE.Animation.prototype.update=function(){var a=[],b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Quaternion,e=function(a,b){var c=[],d=[],e,r,p,s,t,q;e=(a.length-1)*b;r=Math.floor(e);e-=r;c[0]=0===r?r:r-1;c[1]=r;c[2]=r>a.length-2?r:r+1;c[3]=r>a.length-3?r:r+2;r=a[c[0]];s=a[c[1]];t=a[c[2]];q=a[c[3]];c=e*e;p=e*c;d[0]=f(r[0],s[0],t[0],q[0],e,c,p);d[1]=f(r[1],s[1],t[1],q[1],e,c,p);d[2]=f(r[2],s[2],t[2],q[2],e,c,p);return d},f=function(a,b,c,d,e,f,p){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)* +p+(-3*(b-c)-2*a-d)*f+a*e+b};return function(f){if(!1!==this.isPlaying&&(this.currentTime+=f*this.timeScale,0!==this.weight)){var h;f=this.data.length;if(!0===this.loop&&this.currentTime>f)this.currentTime%=f,this.reset();else if(!1===this.loop&&this.currentTime>f){this.stop();return}f=0;for(var k=this.hierarchy.length;fr;r++){h=this.keyTypes[r];var p=n.prevKey[h],s=n.nextKey[h];if(s.time<=this.currentTime){p=this.data.hierarchy[f].keys[0]; +for(s=this.getNextKeyWith(h,f,1);s.timep.index;)p=s,s=this.getNextKeyWith(h,f,s.index+1);n.prevKey[h]=p;n.nextKey[h]=s}l.matrixAutoUpdate=!0;l.matrixWorldNeedsUpdate=!0;var t=(this.currentTime-p.time)/(s.time-p.time),q=p[h],v=s[h];0>t&&(t=0);1=e)return new THREE.Vector2(c,a);e=Math.sqrt(e/2)}else a=!1,1E-10e?-1E-10>g&& -(a=!0):d(f)==d(h)&&(a=!0),a?(c=-f,a=e,e=Math.sqrt(k)):(c=e,a=f,e=Math.sqrt(k/2));return new THREE.Vector2(c/e,a/e)}function e(c,d){var e,f;for(I=c.length;0<=--I;){e=I;f=I-1;0>f&&(f=c.length-1);for(var g=0,h=s+2*n,g=0;gf&&(f=c.length-1);for(var g=0,h=s+2*n,g=0;gc&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/ +b){var c=Math.pow(2,b);Math.pow(4,b);for(var d=e(k.vertices[a.a]),g=e(k.vertices[a.b]),h=e(k.vertices[a.c]),l=[],n=0;n<=c;n++){l[n]=[];for(var p=e(d.clone().lerp(h,n/c)),q=e(g.clone().lerp(h,n/c)),r=c-n,s=0;s<=r;s++)l[n][s]=0==s&&n==c?p:e(p.clone().lerp(q,s/r))}for(n=0;nc&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/ Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);c=c||1;d=d||0;for(var k=this,l=0,n=a.length;ls&&(0.2>d&&(b[0].x+=1),0.2>a&&(b[1].x+=1),0.2>r&&(b[2].x+=1));l=0;for(n=this.vertices.length;lb;b++)a.faces[b].color=this.colors[4>b?0:1];b=new THREE.MeshBasicMaterial({vertexColors:THREE.FaceColors,wireframe:!0});this.lightSphere=new THREE.Mesh(a,b);this.add(this.lightSphere); this.update()};THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose();this.lightSphere.material.dispose()}; THREE.HemisphereLightHelper.prototype.update=function(){var a=new THREE.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity);this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity);this.lightSphere.lookAt(a.setFromMatrixPosition(this.light.matrixWorld).negate());this.lightSphere.geometry.colorsNeedUpdate=!0}}();THREE.PointLightHelper=function(a,b){this.light=a;this.light.updateMatrixWorld();var c=new THREE.SphereGeometry(b,4,2),d=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);THREE.Mesh.call(this,c,d);this.matrixWorld=this.light.matrixWorld;this.matrixAutoUpdate=!1};THREE.PointLightHelper.prototype=Object.create(THREE.Mesh.prototype);THREE.PointLightHelper.prototype.dispose=function(){this.geometry.dispose();this.material.dispose()}; -THREE.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};THREE.SpotLightHelper=function(a){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;a=new THREE.CylinderGeometry(0,1,1,8,1,!0);a.applyMatrix((new THREE.Matrix4).makeTranslation(0,-0.5,0));a.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));var b=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new THREE.Mesh(a,b);this.add(this.cone);this.update()};THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype); +THREE.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};THREE.SkeletonHelper=function(a,b,c){THREE.Object3D.call(this);this.scaleRatio=void 0!==c?c:1;this.skeleton=a;void 0===b&&(b=1);c=b*this.scaleRatio;for(var d=0;d