Browse Source

Updated builds.

Mr.doob 8 years ago
parent
commit
b2cbafead5
3 changed files with 35 additions and 25 deletions
  1. 6 1
      build/three.js
  2. 23 23
      build/three.min.js
  3. 6 1
      build/three.module.js

+ 6 - 1
build/three.js

@@ -8996,8 +8996,9 @@
 			_lightPositionWorld = new Vector3(),
 			_lightPositionWorld = new Vector3(),
 
 
 			_MorphingFlag = 1,
 			_MorphingFlag = 1,
+			_SkinningFlag = 2,
 
 
-			_NumberOfMaterialVariants = ( _MorphingFlag ) + 1,
+			_NumberOfMaterialVariants = ( _MorphingFlag | _SkinningFlag ) + 1,
 
 
 			_depthMaterials = new Array( _NumberOfMaterialVariants ),
 			_depthMaterials = new Array( _NumberOfMaterialVariants ),
 			_distanceMaterials = new Array( _NumberOfMaterialVariants ),
 			_distanceMaterials = new Array( _NumberOfMaterialVariants ),
@@ -9031,6 +9032,7 @@
 		for ( var i = 0; i !== _NumberOfMaterialVariants; ++ i ) {
 		for ( var i = 0; i !== _NumberOfMaterialVariants; ++ i ) {
 
 
 			var useMorphing = ( i & _MorphingFlag ) !== 0;
 			var useMorphing = ( i & _MorphingFlag ) !== 0;
+			var useSkinning = ( i & _SkinningFlag ) !== 0;
 
 
 			var depthMaterial = depthMaterialTemplate.clone();
 			var depthMaterial = depthMaterialTemplate.clone();
 			depthMaterial.morphTargets = useMorphing;
 			depthMaterial.morphTargets = useMorphing;
@@ -9270,9 +9272,12 @@
 
 
 				}
 				}
 
 
+				var useSkinning = object.isSkinnedMesh;
+
 				var variantIndex = 0;
 				var variantIndex = 0;
 
 
 				if ( useMorphing ) variantIndex |= _MorphingFlag;
 				if ( useMorphing ) variantIndex |= _MorphingFlag;
+				if ( useSkinning ) variantIndex |= _SkinningFlag;
 
 
 				result = materialVariants[ variantIndex ];
 				result = materialVariants[ variantIndex ];
 
 

+ 23 - 23
build/three.min.js

@@ -32,29 +32,29 @@ v.uniform2f(d,C.map.repeat.x,C.map.repeat.y)):(v.uniform2f(c,0,0),v.uniform2f(d,
 !1;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.premultipliedAlpha=!1;this.overdraw=0;this._needsUpdate=this.visible=!0}function Ga(a){X.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=
 !1;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.premultipliedAlpha=!1;this.overdraw=0;this._needsUpdate=this.visible=!0}function Ga(a){X.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=
 this.morphTargets=this.clipping=this.lights=this.fog=!1;this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1};this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName=void 0;void 0!==a&&(void 0!==a.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(a))}function Za(a){X.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=!1;this.displacementMap=
 this.morphTargets=this.clipping=this.lights=this.fog=!1;this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1};this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName=void 0;void 0!==a&&(void 0!==a.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(a))}function Za(a){X.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=!1;this.displacementMap=
 this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(a)}function Ua(a,b){this.min=void 0!==a?a:new q(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new q(-Infinity,-Infinity,-Infinity)}function Aa(a,b){this.center=void 0!==a?a:new q;this.radius=void 0!==b?b:0}function Ba(){this.elements=[1,0,0,0,1,0,0,0,1];0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}
 this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(a)}function Ua(a,b){this.min=void 0!==a?a:new q(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new q(-Infinity,-Infinity,-Infinity)}function Aa(a,b){this.center=void 0!==a?a:new q;this.radius=void 0!==b?b:0}function Ba(){this.elements=[1,0,0,0,1,0,0,0,1];0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}
-function ia(a,b){this.normal=void 0!==a?a:new q(1,0,0);this.constant=void 0!==b?b:0}function jd(a,b,c,d,e,f){this.planes=[void 0!==a?a:new ia,void 0!==b?b:new ia,void 0!==c?c:new ia,void 0!==d?d:new ia,void 0!==e?e:new ia,void 0!==f?f:new ia]}function De(a,b,c,d){function e(b,c,d,e){var f=b.geometry,g;g=t;var h=b.customDepthMaterial;d&&(g=z,h=b.customDistanceMaterial);h?g=h:(b=!1,c.morphTargets&&(f&&f.isBufferGeometry?b=f.morphAttributes&&f.morphAttributes.position&&0<f.morphAttributes.position.length:
-f&&f.isGeometry&&(b=f.morphTargets&&0<f.morphTargets.length)),f=0,b&&(f|=1),g=g[f]);a.localClippingEnabled&&!0===c.clipShadows&&0!==c.clippingPlanes.length&&(h=g.uuid,f=c.uuid,b=w[h],void 0===b&&(b={},w[h]=b),h=b[f],void 0===h&&(h=g.clone(),b[f]=h),g=h);g.visible=c.visible;g.wireframe=c.wireframe;f=c.side;ba.renderSingleSided&&2==f&&(f=0);ba.renderReverseSided&&(0===f?f=1:1===f&&(f=0));g.side=f;g.clipShadows=c.clipShadows;g.clippingPlanes=c.clippingPlanes;g.wireframeLinewidth=c.wireframeLinewidth;
-g.linewidth=c.linewidth;d&&void 0!==g.uniforms.lightPos&&g.uniforms.lightPos.value.copy(e);return g}function f(b,d,g,h){if(!1!==b.visible){if(b.layers.test(d.layers)&&(b.isMesh||b.isLine||b.isPoints)&&b.castShadow&&(!b.frustumCulled||k.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,b.matrixWorld);var m=c.update(b),n=b.material;if(Array.isArray(n))for(var u=m.groups,p=0,r=u.length;p<r;p++){var w=u[p],y=n[w.materialIndex];y&&y.visible&&(y=e(b,y,h,l),a.renderBufferDirect(g,
-null,m,y,b,w))}else n.visible&&(y=e(b,n,h,l),a.renderBufferDirect(g,null,m,y,b,null))}b=b.children;m=0;for(n=b.length;m<n;m++)f(b[m],d,g,h)}}var g=a.context,h=a.state,k=new jd,m=new Q,u=b.shadows,p=new C,n=new C(d.maxTextureSize,d.maxTextureSize),r=new q,l=new q,t=Array(2),z=Array(2),w={},y=[new q(1,0,0),new q(-1,0,0),new q(0,0,1),new q(0,0,-1),new q(0,1,0),new q(0,-1,0)],M=[new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,0,1),new q(0,0,-1)],v=[new ga,new ga,new ga,new ga,new ga,new ga];
-b=new Za;b.depthPacking=3201;b.clipping=!0;d=$a.distanceRGBA;for(var F=Ja.clone(d.uniforms),G=0;2!==G;++G){var A=0!==(G&1),H=b.clone();H.morphTargets=A;t[G]=H;A=new Ga({defines:{USE_SHADOWMAP:""},uniforms:F,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader,morphTargets:A,clipping:!0});z[G]=A}var ba=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.renderSingleSided=this.renderReverseSided=!0;this.render=function(b,c){if(!1!==ba.enabled&&(!1!==ba.autoUpdate||!1!==
-ba.needsUpdate)&&0!==u.length){h.disable(g.BLEND);h.buffers.color.setClear(1,1,1,1);h.buffers.depth.setTest(!0);h.setScissorTest(!1);for(var d,e,w=0,t=u.length;w<t;w++){var q=u[w],z=q.shadow;if(void 0===z)console.warn("THREE.WebGLShadowMap:",q,"has no shadow.");else{var A=z.camera;p.copy(z.mapSize);p.min(n);if(q&&q.isPointLight){d=6;e=!0;var G=p.x,F=p.y;v[0].set(2*G,F,G,F);v[1].set(0,F,G,F);v[2].set(3*G,F,G,F);v[3].set(G,F,G,F);v[4].set(3*G,0,G,F);v[5].set(G,0,G,F);p.x*=4;p.y*=2}else d=1,e=!1;null===
-z.map&&(z.map=new Bb(p.x,p.y,{minFilter:1003,magFilter:1003,format:1023}),z.map.texture.name=q.name+".shadowMap",A.updateProjectionMatrix());z.isSpotLightShadow&&z.update(q);z&&z.isRectAreaLightShadow&&z.update(q);G=z.map;z=z.matrix;l.setFromMatrixPosition(q.matrixWorld);A.position.copy(l);a.setRenderTarget(G);a.clear();for(G=0;G<d;G++)e?(r.copy(A.position),r.add(y[G]),A.up.copy(M[G]),A.lookAt(r),h.viewport(v[G])):(r.setFromMatrixPosition(q.target.matrixWorld),A.lookAt(r)),A.updateMatrixWorld(),A.matrixWorldInverse.getInverse(A.matrixWorld),
-z.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),z.multiply(A.projectionMatrix),z.multiply(A.matrixWorldInverse),m.multiplyMatrices(A.projectionMatrix,A.matrixWorldInverse),k.setFromMatrix(m),f(b,c,A,e)}}d=a.getClearColor();e=a.getClearAlpha();a.setClearColor(d,e);ba.needsUpdate=!1}}}function eb(a,b){this.origin=void 0!==a?a:new q;this.direction=void 0!==b?b:new q}function ab(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||ab.DefaultOrder}function Qd(){this.mask=1}function E(){Object.defineProperty(this,
-"id",{value:Bf++});this.uuid=T.generateUUID();this.name="";this.type="Object3D";this.parent=null;this.children=[];this.up=E.DefaultUp.clone();var a=new q,b=new ab,c=new ca,d=new q(1,1,1);b.onChange(function(){c.setFromEuler(b,!1)});c.onChange(function(){b.setFromQuaternion(c,void 0,!1)});Object.defineProperties(this,{position:{enumerable:!0,value:a},rotation:{enumerable:!0,value:b},quaternion:{enumerable:!0,value:c},scale:{enumerable:!0,value:d},modelViewMatrix:{value:new Q},normalMatrix:{value:new Ba}});
-this.matrix=new Q;this.matrixWorld=new Q;this.matrixAutoUpdate=E.DefaultMatrixAutoUpdate;this.matrixWorldNeedsUpdate=!1;this.layers=new Qd;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.renderOrder=0;this.userData={};this.onBeforeRender=function(){};this.onAfterRender=function(){}}function Eb(a,b){this.start=void 0!==a?a:new q;this.end=void 0!==b?b:new q}function Ka(a,b,c){this.a=void 0!==a?a:new q;this.b=void 0!==b?b:new q;this.c=void 0!==c?c:new q}function ua(a,
-b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d&&d.isVector3?d:new q;this.vertexNormals=Array.isArray(d)?d:[];this.color=e&&e.isColor?e:new J;this.vertexColors=Array.isArray(e)?e:[];this.materialIndex=void 0!==f?f:0}function La(a){X.call(this);this.type="MeshBasicMaterial";this.color=new J(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.envMap=this.alphaMap=this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;
-this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=this.morphTargets=!1;this.setValues(a)}function W(a,b,c){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");Object.defineProperty(this,"id",{value:Cf++});this.uuid=T.generateUUID();this.array=a;this.itemSize=b;this.count=void 0!==a?a.length/b:0;this.normalized=!0===c;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.onUploadCallback=function(){};
-this.version=0}function qc(a,b){W.call(this,new Int8Array(a),b)}function rc(a,b){W.call(this,new Uint8Array(a),b)}function sc(a,b){W.call(this,new Uint8ClampedArray(a),b)}function tc(a,b){W.call(this,new Int16Array(a),b)}function fb(a,b){W.call(this,new Uint16Array(a),b)}function uc(a,b){W.call(this,new Int32Array(a),b)}function gb(a,b){W.call(this,new Uint32Array(a),b)}function B(a,b){W.call(this,new Float32Array(a),b)}function vc(a,b){W.call(this,new Float64Array(a),b)}function Ee(){this.indices=
-[];this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function Rd(a){for(var b=a.length,c=-Infinity;b--;)a[b]>c&&(c=a[b]);return c}function R(){Object.defineProperty(this,"id",{value:Sd++});this.uuid=T.generateUUID();this.name="";this.type="Geometry";
-this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.verticesNeedUpdate=this.elementsNeedUpdate=!1}function I(){Object.defineProperty(this,"id",{value:Sd++});this.uuid=T.generateUUID();this.name="";this.type="BufferGeometry";
-this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity}}function wa(a,b){E.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new I;this.material=void 0!==b?b:new La({color:16777215*Math.random()});this.drawMode=0;this.updateMorphTargets()}function Fb(a,b,c,d,e,f){R.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.fromBufferGeometry(new hb(a,
-b,c,d,e,f));this.mergeVertices()}function hb(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,l,G,A,H){var ba=f/G,C=g/A,U=f/2,na=g/2,E=l/2;g=G+1;var B=A+1,P=f=0,K,L,S=new q;for(L=0;L<B;L++){var I=L*C-na;for(K=0;K<g;K++)S[a]=(K*ba-U)*d,S[b]=I*e,S[c]=E,m.push(S.x,S.y,S.z),S[a]=0,S[b]=0,S[c]=0<l?1:-1,u.push(S.x,S.y,S.z),p.push(K/G),p.push(1-L/A),f+=1}for(L=0;L<A;L++)for(K=0;K<G;K++)a=n+K+g*(L+1),b=n+(K+1)+g*(L+1),c=n+(K+1)+g*L,k.push(n+K+g*L,a,c),k.push(a,b,c),P+=6;h.addGroup(r,P,H);r+=P;n+=f}I.call(this);this.type=
-"BoxBufferGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};var h=this;d=Math.floor(d)||1;e=Math.floor(e)||1;f=Math.floor(f)||1;var k=[],m=[],u=[],p=[],n=0,r=0;g("z","y","x",-1,-1,c,b,a,f,e,0);g("z","y","x",1,-1,c,b,-a,f,e,1);g("x","z","y",1,1,a,c,b,d,f,2);g("x","z","y",1,-1,a,c,-b,d,f,3);g("x","y","z",1,-1,a,b,c,d,e,4);g("x","y","z",-1,-1,a,b,-c,d,e,5);this.setIndex(k);this.addAttribute("position",new B(m,3));this.addAttribute("normal",new B(u,
-3));this.addAttribute("uv",new B(p,2))}function wc(a,b,c,d){R.call(this);this.type="PlaneGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};this.fromBufferGeometry(new ib(a,b,c,d))}function ib(a,b,c,d){I.call(this);this.type="PlaneBufferGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};var e=a/2,f=b/2;c=Math.floor(c)||1;d=Math.floor(d)||1;var g=c+1,h=d+1,k=a/c,m=b/d,u=[],p=[],n=[],r=[];for(a=0;a<h;a++){var l=a*m-f;for(b=0;b<g;b++)p.push(b*k-e,
--l,0),n.push(0,0,1),r.push(b/c),r.push(1-a/d)}for(a=0;a<d;a++)for(b=0;b<c;b++)e=b+g*(a+1),f=b+1+g*(a+1),h=b+1+g*a,u.push(b+g*a,e,h),u.push(e,f,h);this.setIndex(u);this.addAttribute("position",new B(p,3));this.addAttribute("normal",new B(n,3));this.addAttribute("uv",new B(r,2))}function da(){E.call(this);this.type="Camera";this.matrixWorldInverse=new Q;this.projectionMatrix=new Q}function Ea(a,b,c,d){da.call(this);this.type="PerspectiveCamera";this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==
-c?c:.1;this.far=void 0!==d?d:2E3;this.focus=10;this.aspect=void 0!==b?b:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()}function Gb(a,b,c,d,e,f){da.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()}function Df(a){var b={};return{get:function(a){a.isInterleavedBufferAttribute&&(a=a.data);return b[a.id]},remove:function(c){var d=
-b[c.id];d&&(a.deleteBuffer(d.buffer),delete b[c.id])},update:function(c,d){c.isInterleavedBufferAttribute&&(c=c.data);var e=b[c.id];if(void 0===e){var e=c.id,f=c,g=f.array,h=f.dynamic?a.DYNAMIC_DRAW:a.STATIC_DRAW,k=a.createBuffer();a.bindBuffer(d,k);a.bufferData(d,g,h);f.onUploadCallback();h=a.FLOAT;g instanceof Float32Array?h=a.FLOAT:g instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):g instanceof Uint16Array?h=a.UNSIGNED_SHORT:g instanceof Int16Array?h=a.SHORT:
-g instanceof Uint32Array?h=a.UNSIGNED_INT:g instanceof Int32Array?h=a.INT:g instanceof Int8Array?h=a.BYTE:g instanceof Uint8Array&&(h=a.UNSIGNED_BYTE);b[e]={buffer:k,type:h,bytesPerElement:g.BYTES_PER_ELEMENT,version:f.version}}else e.version<c.version&&(f=c,g=f.array,k=f.updateRange,a.bindBuffer(d,e.buffer),!1===f.dynamic?a.bufferData(d,g,a.STATIC_DRAW):-1===k.count?a.bufferSubData(d,0,g):0===k.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):
+function ia(a,b){this.normal=void 0!==a?a:new q(1,0,0);this.constant=void 0!==b?b:0}function jd(a,b,c,d,e,f){this.planes=[void 0!==a?a:new ia,void 0!==b?b:new ia,void 0!==c?c:new ia,void 0!==d?d:new ia,void 0!==e?e:new ia,void 0!==f?f:new ia]}function De(a,b,c,d){function e(b,c,d,e){var f=b.geometry,g;g=t;var h=b.customDepthMaterial;d&&(g=z,h=b.customDistanceMaterial);h?g=h:(h=!1,c.morphTargets&&(f&&f.isBufferGeometry?h=f.morphAttributes&&f.morphAttributes.position&&0<f.morphAttributes.position.length:
+f&&f.isGeometry&&(h=f.morphTargets&&0<f.morphTargets.length)),b=b.isSkinnedMesh,f=0,h&&(f|=1),b&&(f|=2),g=g[f]);a.localClippingEnabled&&!0===c.clipShadows&&0!==c.clippingPlanes.length&&(f=g.uuid,h=c.uuid,b=w[f],void 0===b&&(b={},w[f]=b),f=b[h],void 0===f&&(f=g.clone(),b[h]=f),g=f);g.visible=c.visible;g.wireframe=c.wireframe;h=c.side;ba.renderSingleSided&&2==h&&(h=0);ba.renderReverseSided&&(0===h?h=1:1===h&&(h=0));g.side=h;g.clipShadows=c.clipShadows;g.clippingPlanes=c.clippingPlanes;g.wireframeLinewidth=
+c.wireframeLinewidth;g.linewidth=c.linewidth;d&&void 0!==g.uniforms.lightPos&&g.uniforms.lightPos.value.copy(e);return g}function f(b,d,g,h){if(!1!==b.visible){if(b.layers.test(d.layers)&&(b.isMesh||b.isLine||b.isPoints)&&b.castShadow&&(!b.frustumCulled||k.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,b.matrixWorld);var m=c.update(b),n=b.material;if(Array.isArray(n))for(var u=m.groups,p=0,r=u.length;p<r;p++){var w=u[p],y=n[w.materialIndex];y&&y.visible&&(y=e(b,y,h,
+l),a.renderBufferDirect(g,null,m,y,b,w))}else n.visible&&(y=e(b,n,h,l),a.renderBufferDirect(g,null,m,y,b,null))}b=b.children;m=0;for(n=b.length;m<n;m++)f(b[m],d,g,h)}}var g=a.context,h=a.state,k=new jd,m=new Q,u=b.shadows,p=new C,n=new C(d.maxTextureSize,d.maxTextureSize),r=new q,l=new q,t=Array(4),z=Array(4),w={},y=[new q(1,0,0),new q(-1,0,0),new q(0,0,1),new q(0,0,-1),new q(0,1,0),new q(0,-1,0)],M=[new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,0,1),new q(0,0,-1)],v=[new ga,new ga,
+new ga,new ga,new ga,new ga];b=new Za;b.depthPacking=3201;b.clipping=!0;d=$a.distanceRGBA;for(var F=Ja.clone(d.uniforms),G=0;4!==G;++G){var A=0!==(G&1),H=b.clone();H.morphTargets=A;t[G]=H;A=new Ga({defines:{USE_SHADOWMAP:""},uniforms:F,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader,morphTargets:A,clipping:!0});z[G]=A}var ba=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.renderSingleSided=this.renderReverseSided=!0;this.render=function(b,c){if(!1!==ba.enabled&&
+(!1!==ba.autoUpdate||!1!==ba.needsUpdate)&&0!==u.length){h.disable(g.BLEND);h.buffers.color.setClear(1,1,1,1);h.buffers.depth.setTest(!0);h.setScissorTest(!1);for(var d,e,w=0,t=u.length;w<t;w++){var q=u[w],z=q.shadow;if(void 0===z)console.warn("THREE.WebGLShadowMap:",q,"has no shadow.");else{var A=z.camera;p.copy(z.mapSize);p.min(n);if(q&&q.isPointLight){d=6;e=!0;var G=p.x,F=p.y;v[0].set(2*G,F,G,F);v[1].set(0,F,G,F);v[2].set(3*G,F,G,F);v[3].set(G,F,G,F);v[4].set(3*G,0,G,F);v[5].set(G,0,G,F);p.x*=
+4;p.y*=2}else d=1,e=!1;null===z.map&&(z.map=new Bb(p.x,p.y,{minFilter:1003,magFilter:1003,format:1023}),z.map.texture.name=q.name+".shadowMap",A.updateProjectionMatrix());z.isSpotLightShadow&&z.update(q);z&&z.isRectAreaLightShadow&&z.update(q);G=z.map;z=z.matrix;l.setFromMatrixPosition(q.matrixWorld);A.position.copy(l);a.setRenderTarget(G);a.clear();for(G=0;G<d;G++)e?(r.copy(A.position),r.add(y[G]),A.up.copy(M[G]),A.lookAt(r),h.viewport(v[G])):(r.setFromMatrixPosition(q.target.matrixWorld),A.lookAt(r)),
+A.updateMatrixWorld(),A.matrixWorldInverse.getInverse(A.matrixWorld),z.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),z.multiply(A.projectionMatrix),z.multiply(A.matrixWorldInverse),m.multiplyMatrices(A.projectionMatrix,A.matrixWorldInverse),k.setFromMatrix(m),f(b,c,A,e)}}d=a.getClearColor();e=a.getClearAlpha();a.setClearColor(d,e);ba.needsUpdate=!1}}}function eb(a,b){this.origin=void 0!==a?a:new q;this.direction=void 0!==b?b:new q}function ab(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=
+d||ab.DefaultOrder}function Qd(){this.mask=1}function E(){Object.defineProperty(this,"id",{value:Bf++});this.uuid=T.generateUUID();this.name="";this.type="Object3D";this.parent=null;this.children=[];this.up=E.DefaultUp.clone();var a=new q,b=new ab,c=new ca,d=new q(1,1,1);b.onChange(function(){c.setFromEuler(b,!1)});c.onChange(function(){b.setFromQuaternion(c,void 0,!1)});Object.defineProperties(this,{position:{enumerable:!0,value:a},rotation:{enumerable:!0,value:b},quaternion:{enumerable:!0,value:c},
+scale:{enumerable:!0,value:d},modelViewMatrix:{value:new Q},normalMatrix:{value:new Ba}});this.matrix=new Q;this.matrixWorld=new Q;this.matrixAutoUpdate=E.DefaultMatrixAutoUpdate;this.matrixWorldNeedsUpdate=!1;this.layers=new Qd;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.renderOrder=0;this.userData={};this.onBeforeRender=function(){};this.onAfterRender=function(){}}function Eb(a,b){this.start=void 0!==a?a:new q;this.end=void 0!==b?b:new q}function Ka(a,b,c){this.a=
+void 0!==a?a:new q;this.b=void 0!==b?b:new q;this.c=void 0!==c?c:new q}function ua(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d&&d.isVector3?d:new q;this.vertexNormals=Array.isArray(d)?d:[];this.color=e&&e.isColor?e:new J;this.vertexColors=Array.isArray(e)?e:[];this.materialIndex=void 0!==f?f:0}function La(a){X.call(this);this.type="MeshBasicMaterial";this.color=new J(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.envMap=this.alphaMap=
+this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=this.morphTargets=!1;this.setValues(a)}function W(a,b,c){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");Object.defineProperty(this,"id",{value:Cf++});this.uuid=T.generateUUID();this.array=a;this.itemSize=b;this.count=void 0!==a?a.length/b:0;this.normalized=!0===
+c;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.onUploadCallback=function(){};this.version=0}function qc(a,b){W.call(this,new Int8Array(a),b)}function rc(a,b){W.call(this,new Uint8Array(a),b)}function sc(a,b){W.call(this,new Uint8ClampedArray(a),b)}function tc(a,b){W.call(this,new Int16Array(a),b)}function fb(a,b){W.call(this,new Uint16Array(a),b)}function uc(a,b){W.call(this,new Int32Array(a),b)}function gb(a,b){W.call(this,new Uint32Array(a),b)}function B(a,b){W.call(this,new Float32Array(a),
+b)}function vc(a,b){W.call(this,new Float64Array(a),b)}function Ee(){this.indices=[];this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function Rd(a){for(var b=a.length,c=-Infinity;b--;)a[b]>c&&(c=a[b]);return c}function R(){Object.defineProperty(this,
+"id",{value:Sd++});this.uuid=T.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.verticesNeedUpdate=this.elementsNeedUpdate=!1}function I(){Object.defineProperty(this,
+"id",{value:Sd++});this.uuid=T.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity}}function wa(a,b){E.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new I;this.material=void 0!==b?b:new La({color:16777215*Math.random()});this.drawMode=0;this.updateMorphTargets()}function Fb(a,b,c,d,e,f){R.call(this);this.type="BoxGeometry";this.parameters=
+{width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.fromBufferGeometry(new hb(a,b,c,d,e,f));this.mergeVertices()}function hb(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,l,G,A,H){var ba=f/G,C=g/A,U=f/2,na=g/2,E=l/2;g=G+1;var B=A+1,P=f=0,K,L,S=new q;for(L=0;L<B;L++){var I=L*C-na;for(K=0;K<g;K++)S[a]=(K*ba-U)*d,S[b]=I*e,S[c]=E,m.push(S.x,S.y,S.z),S[a]=0,S[b]=0,S[c]=0<l?1:-1,u.push(S.x,S.y,S.z),p.push(K/G),p.push(1-L/A),f+=1}for(L=0;L<A;L++)for(K=0;K<G;K++)a=n+K+g*(L+1),b=n+(K+
+1)+g*(L+1),c=n+(K+1)+g*L,k.push(n+K+g*L,a,c),k.push(a,b,c),P+=6;h.addGroup(r,P,H);r+=P;n+=f}I.call(this);this.type="BoxBufferGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};var h=this;d=Math.floor(d)||1;e=Math.floor(e)||1;f=Math.floor(f)||1;var k=[],m=[],u=[],p=[],n=0,r=0;g("z","y","x",-1,-1,c,b,a,f,e,0);g("z","y","x",1,-1,c,b,-a,f,e,1);g("x","z","y",1,1,a,c,b,d,f,2);g("x","z","y",1,-1,a,c,-b,d,f,3);g("x","y","z",1,-1,a,b,c,d,e,4);g("x","y","z",
+-1,-1,a,b,-c,d,e,5);this.setIndex(k);this.addAttribute("position",new B(m,3));this.addAttribute("normal",new B(u,3));this.addAttribute("uv",new B(p,2))}function wc(a,b,c,d){R.call(this);this.type="PlaneGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};this.fromBufferGeometry(new ib(a,b,c,d))}function ib(a,b,c,d){I.call(this);this.type="PlaneBufferGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};var e=a/2,f=b/2;c=Math.floor(c)||1;d=Math.floor(d)||
+1;var g=c+1,h=d+1,k=a/c,m=b/d,u=[],p=[],n=[],r=[];for(a=0;a<h;a++){var l=a*m-f;for(b=0;b<g;b++)p.push(b*k-e,-l,0),n.push(0,0,1),r.push(b/c),r.push(1-a/d)}for(a=0;a<d;a++)for(b=0;b<c;b++)e=b+g*(a+1),f=b+1+g*(a+1),h=b+1+g*a,u.push(b+g*a,e,h),u.push(e,f,h);this.setIndex(u);this.addAttribute("position",new B(p,3));this.addAttribute("normal",new B(n,3));this.addAttribute("uv",new B(r,2))}function da(){E.call(this);this.type="Camera";this.matrixWorldInverse=new Q;this.projectionMatrix=new Q}function Ea(a,
+b,c,d){da.call(this);this.type="PerspectiveCamera";this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==c?c:.1;this.far=void 0!==d?d:2E3;this.focus=10;this.aspect=void 0!==b?b:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()}function Gb(a,b,c,d,e,f){da.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()}function Df(a){var b=
+{};return{get:function(a){a.isInterleavedBufferAttribute&&(a=a.data);return b[a.id]},remove:function(c){var d=b[c.id];d&&(a.deleteBuffer(d.buffer),delete b[c.id])},update:function(c,d){c.isInterleavedBufferAttribute&&(c=c.data);var e=b[c.id];if(void 0===e){var e=c.id,f=c,g=f.array,h=f.dynamic?a.DYNAMIC_DRAW:a.STATIC_DRAW,k=a.createBuffer();a.bindBuffer(d,k);a.bufferData(d,g,h);f.onUploadCallback();h=a.FLOAT;g instanceof Float32Array?h=a.FLOAT:g instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):
+g instanceof Uint16Array?h=a.UNSIGNED_SHORT:g instanceof Int16Array?h=a.SHORT:g instanceof Uint32Array?h=a.UNSIGNED_INT:g instanceof Int32Array?h=a.INT:g instanceof Int8Array?h=a.BYTE:g instanceof Uint8Array&&(h=a.UNSIGNED_BYTE);b[e]={buffer:k,type:h,bytesPerElement:g.BYTES_PER_ELEMENT,version:f.version}}else e.version<c.version&&(f=c,g=f.array,k=f.updateRange,a.bindBuffer(d,e.buffer),!1===f.dynamic?a.bufferData(d,g,a.STATIC_DRAW):-1===k.count?a.bufferSubData(d,0,g):0===k.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):
 (a.bufferSubData(d,k.offset*g.BYTES_PER_ELEMENT,g.subarray(k.offset,k.offset+k.count)),k.count=0),e.version=c.version)}}}function Ef(a,b,c){var d,e,f;return{setMode:function(a){d=a},setIndex:function(c){c.array instanceof Uint32Array&&b.get("OES_element_index_uint")?(e=a.UNSIGNED_INT,f=4):c.array instanceof Uint16Array?(e=a.UNSIGNED_SHORT,f=2):(e=a.UNSIGNED_BYTE,f=1)},render:function(b,h){a.drawElements(d,h,e,b*f);c.calls++;c.vertices+=h;d===a.TRIANGLES&&(c.faces+=h/3)},renderInstances:function(g,
 (a.bufferSubData(d,k.offset*g.BYTES_PER_ELEMENT,g.subarray(k.offset,k.offset+k.count)),k.count=0),e.version=c.version)}}}function Ef(a,b,c){var d,e,f;return{setMode:function(a){d=a},setIndex:function(c){c.array instanceof Uint32Array&&b.get("OES_element_index_uint")?(e=a.UNSIGNED_INT,f=4):c.array instanceof Uint16Array?(e=a.UNSIGNED_SHORT,f=2):(e=a.UNSIGNED_BYTE,f=1)},render:function(b,h){a.drawElements(d,h,e,b*f);c.calls++;c.vertices+=h;d===a.TRIANGLES&&(c.faces+=h/3)},renderInstances:function(g,
 h,k){var m=b.get("ANGLE_instanced_arrays");null===m?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(m.drawElementsInstancedANGLE(d,k,e,h*f,g.maxInstancedCount),c.calls++,c.vertices+=k*g.maxInstancedCount,d===a.TRIANGLES&&(c.faces+=g.maxInstancedCount*k/3))}}}function Ff(a,b,c){var d;return{setMode:function(a){d=a},render:function(b,f){a.drawArrays(d,b,f);c.calls++;c.vertices+=f;d===a.TRIANGLES&&(c.faces+=
 h,k){var m=b.get("ANGLE_instanced_arrays");null===m?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(m.drawElementsInstancedANGLE(d,k,e,h*f,g.maxInstancedCount),c.calls++,c.vertices+=k*g.maxInstancedCount,d===a.TRIANGLES&&(c.faces+=g.maxInstancedCount*k/3))}}}function Ff(a,b,c){var d;return{setMode:function(a){d=a},render:function(b,f){a.drawArrays(d,b,f);c.calls++;c.vertices+=f;d===a.TRIANGLES&&(c.faces+=
 f/3)},renderInstances:function(e){var f=b.get("ANGLE_instanced_arrays");if(null===f)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var g=e.attributes.position,g=g.isInterleavedBufferAttribute?g.data.count:g.count;f.drawArraysInstancedANGLE(d,0,g,e.maxInstancedCount);c.calls++;c.vertices+=g*e.maxInstancedCount;d===a.TRIANGLES&&(c.faces+=e.maxInstancedCount*g/3)}}}}function Gf(a,b,c){function d(a){a=
 f/3)},renderInstances:function(e){var f=b.get("ANGLE_instanced_arrays");if(null===f)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var g=e.attributes.position,g=g.isInterleavedBufferAttribute?g.data.count:g.count;f.drawArraysInstancedANGLE(d,0,g,e.maxInstancedCount);c.calls++;c.vertices+=g*e.maxInstancedCount;d===a.TRIANGLES&&(c.faces+=e.maxInstancedCount*g/3)}}}}function Gf(a,b,c){function d(a){a=

+ 6 - 1
build/three.module.js

@@ -8990,8 +8990,9 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
 		_lightPositionWorld = new Vector3(),
 		_lightPositionWorld = new Vector3(),
 
 
 		_MorphingFlag = 1,
 		_MorphingFlag = 1,
+		_SkinningFlag = 2,
 
 
-		_NumberOfMaterialVariants = ( _MorphingFlag ) + 1,
+		_NumberOfMaterialVariants = ( _MorphingFlag | _SkinningFlag ) + 1,
 
 
 		_depthMaterials = new Array( _NumberOfMaterialVariants ),
 		_depthMaterials = new Array( _NumberOfMaterialVariants ),
 		_distanceMaterials = new Array( _NumberOfMaterialVariants ),
 		_distanceMaterials = new Array( _NumberOfMaterialVariants ),
@@ -9025,6 +9026,7 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
 	for ( var i = 0; i !== _NumberOfMaterialVariants; ++ i ) {
 	for ( var i = 0; i !== _NumberOfMaterialVariants; ++ i ) {
 
 
 		var useMorphing = ( i & _MorphingFlag ) !== 0;
 		var useMorphing = ( i & _MorphingFlag ) !== 0;
+		var useSkinning = ( i & _SkinningFlag ) !== 0;
 
 
 		var depthMaterial = depthMaterialTemplate.clone();
 		var depthMaterial = depthMaterialTemplate.clone();
 		depthMaterial.morphTargets = useMorphing;
 		depthMaterial.morphTargets = useMorphing;
@@ -9264,9 +9266,12 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
 
 
 			}
 			}
 
 
+			var useSkinning = object.isSkinnedMesh;
+
 			var variantIndex = 0;
 			var variantIndex = 0;
 
 
 			if ( useMorphing ) variantIndex |= _MorphingFlag;
 			if ( useMorphing ) variantIndex |= _MorphingFlag;
+			if ( useSkinning ) variantIndex |= _SkinningFlag;
 
 
 			result = materialVariants[ variantIndex ];
 			result = materialVariants[ variantIndex ];