|
@@ -245,10 +245,10 @@ isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBound
|
|
|
a.center(d);for(var f=0,e=0,g=c.length;e<g;e+=3)b.fromArray(c,e),f=Math.max(f,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(f);isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var a=this.attributes;if(a.position){var b=a.position.array;if(void 0===a.normal)this.addAttribute("normal",
|
|
|
new THREE.BufferAttribute(new Float32Array(b.length),3));else for(var c=a.normal.array,d=0,e=c.length;d<e;d++)c[d]=0;var c=a.normal.array,g,f,h,k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3;if(a.index){var q=a.index.array;0===this.drawcalls.length&&this.addDrawCall(0,q.length);for(var r=0,t=this.drawcalls.length;r<t;++r){e=this.drawcalls[r].start;g=this.drawcalls[r].count;for(var u=this.drawcalls[r].index,d=e,e=e+g;d<e;d+=3)g=3*(u+q[d]),f=3*(u+
|
|
|
q[d+1]),h=3*(u+q[d+2]),k.fromArray(b,g),l.fromArray(b,f),n.fromArray(b,h),p.subVectors(n,l),m.subVectors(k,l),p.cross(m),c[g]+=p.x,c[g+1]+=p.y,c[g+2]+=p.z,c[f]+=p.x,c[f+1]+=p.y,c[f+2]+=p.z,c[h]+=p.x,c[h+1]+=p.y,c[h+2]+=p.z}}else for(d=0,e=b.length;d<e;d+=9)k.fromArray(b,d),l.fromArray(b,d+3),n.fromArray(b,d+6),p.subVectors(n,l),m.subVectors(k,l),p.cross(m),c[d]=p.x,c[d+1]=p.y,c[d+2]=p.z,c[d+3]=p.x,c[d+4]=p.y,c[d+5]=p.z,c[d+6]=p.x,c[d+7]=p.y,c[d+8]=p.z;this.normalizeNormals();a.normal.needsUpdate=
|
|
|
-!0}},computeTangents:function(){function a(a,b,c){p.fromArray(d,3*a);m.fromArray(d,3*b);q.fromArray(d,3*c);r.fromArray(g,2*a);t.fromArray(g,2*b);u.fromArray(g,2*c);w=m.x-p.x;v=q.x-p.x;y=m.y-p.y;x=q.y-p.y;z=m.z-p.z;C=q.z-p.z;A=t.x-r.x;B=u.x-r.x;S=t.y-r.y;I=u.y-r.y;E=1/(A*I-B*S);O.set((I*w-S*v)*E,(I*y-S*x)*E,(I*z-S*C)*E);H.set((A*v-B*w)*E,(A*x-B*y)*E,(A*C-B*z)*E);k[a].add(O);k[b].add(O);k[c].add(O);l[a].add(H);l[b].add(H);l[c].add(H)}function b(a){ra.fromArray(e,3*a);ja.copy(ra);ma=k[a];T.copy(ma);
|
|
|
-T.sub(ra.multiplyScalar(ra.dot(ma))).normalize();F.crossVectors(ja,ma);ba=F.dot(l[a]);ca=0>ba?-1:1;h[4*a]=T.x;h[4*a+1]=T.y;h[4*a+2]=T.z;h[4*a+3]=ca}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,
|
|
|
+!0}},computeTangents:function(){function a(a,b,c){p.fromArray(d,3*a);m.fromArray(d,3*b);q.fromArray(d,3*c);r.fromArray(g,2*a);t.fromArray(g,2*b);u.fromArray(g,2*c);w=m.x-p.x;v=q.x-p.x;y=m.y-p.y;x=q.y-p.y;z=m.z-p.z;C=q.z-p.z;A=t.x-r.x;B=u.x-r.x;S=t.y-r.y;I=u.y-r.y;E=1/(A*I-B*S);O.set((I*w-S*v)*E,(I*y-S*x)*E,(I*z-S*C)*E);H.set((A*v-B*w)*E,(A*x-B*y)*E,(A*C-B*z)*E);k[a].add(O);k[b].add(O);k[c].add(O);l[a].add(H);l[b].add(H);l[c].add(H)}function b(a){ra.fromArray(e,3*a);ja.copy(ra);na=k[a];T.copy(na);
|
|
|
+T.sub(ra.multiplyScalar(ra.dot(na))).normalize();F.crossVectors(ja,na);ba=F.dot(l[a]);ca=0>ba?-1:1;h[4*a]=T.x;h[4*a+1]=T.y;h[4*a+2]=T.z;h[4*a+3]=ca}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,
|
|
|
g=this.attributes.uv.array,f=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*f),4));for(var h=this.attributes.tangent.array,k=[],l=[],n=0;n<f;n++)k[n]=new THREE.Vector3,l[n]=new THREE.Vector3;var p=new THREE.Vector3,m=new THREE.Vector3,q=new THREE.Vector3,r=new THREE.Vector2,t=new THREE.Vector2,u=new THREE.Vector2,w,v,y,x,z,C,A,B,S,I,E,O=new THREE.Vector3,H=new THREE.Vector3,L,J,D,N,R;0===this.drawcalls.length&&this.addDrawCall(0,
|
|
|
-c.length);var U=this.drawcalls,n=0;for(J=U.length;n<J;++n){L=U[n].start;D=U[n].count;var P=U[n].index,f=L;for(L+=D;f<L;f+=3)D=P+c[f],N=P+c[f+1],R=P+c[f+2],a(D,N,R)}var T=new THREE.Vector3,F=new THREE.Vector3,ra=new THREE.Vector3,ja=new THREE.Vector3,ca,ma,ba,n=0;for(J=U.length;n<J;++n)for(L=U[n].start,D=U[n].count,P=U[n].index,f=L,L+=D;f<L;f+=3)D=P+c[f],N=P+c[f+1],R=P+c[f+2],b(D),b(N),b(R)}},computeOffsets:function(a){void 0===a&&(a=THREE.BufferGeometry.MaxIndex);for(var b=this.attributes.index.array,
|
|
|
+c.length);var U=this.drawcalls,n=0;for(J=U.length;n<J;++n){L=U[n].start;D=U[n].count;var P=U[n].index,f=L;for(L+=D;f<L;f+=3)D=P+c[f],N=P+c[f+1],R=P+c[f+2],a(D,N,R)}var T=new THREE.Vector3,F=new THREE.Vector3,ra=new THREE.Vector3,ja=new THREE.Vector3,ca,na,ba,n=0;for(J=U.length;n<J;++n)for(L=U[n].start,D=U[n].count,P=U[n].index,f=L,L+=D;f<L;f+=3)D=P+c[f],N=P+c[f+1],R=P+c[f+2],b(D),b(N),b(R)}},computeOffsets:function(a){void 0===a&&(a=THREE.BufferGeometry.MaxIndex);for(var b=this.attributes.index.array,
|
|
|
c=this.attributes.position.array,d=b.length/3,e=new (65535<c.length/3&&65535<THREE.BufferGeometry.MaxIndex?Uint32Array:Uint16Array)(b.length),g=0,f=0,h=[{start:0,count:0,index:0}],k=h[0],l=0,n=0,p=new Int32Array(6),m=new Int32Array(c.length),q=new Int32Array(c.length),r=0;r<c.length;r++)m[r]=-1,q[r]=-1;for(c=0;c<d;c++){for(var t=n=0;3>t;t++)r=b[3*c+t],-1===m[r]?(p[2*t]=r,p[2*t+1]=-1,n++):m[r]<k.index?(p[2*t]=r,p[2*t+1]=-1,l++):(p[2*t]=r,p[2*t+1]=m[r]);if(f+n>k.index+a)for(k={start:g,count:0,index:f},
|
|
|
h.push(k),n=0;6>n;n+=2)t=p[n+1],-1<t&&t<k.index&&(p[n+1]=-1);for(n=0;6>n;n+=2)r=p[n],t=p[n+1],-1===t&&(t=f++),m[r]=t,q[t]=r,e[g++]=t-k.index,k.count++}this.reorderBuffers(e,q,f);this.clearDrawCalls();for(a=0;a<h.length;a++)b=h[a],this.addDrawCall(b.start,b.count,b.index)},merge:function(a,b){if(!1===a instanceof THREE.BufferGeometry)console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",a);else{void 0===b&&(b=0);var c=this.attributes,d;for(d in c)if(void 0!==
|
|
|
a.attributes[d])for(var e=c[d].array,g=a.attributes[d],f=g.array,h=0,g=g.itemSize*b;h<f.length;h++,g++)e[g]=f[h];return this}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,g=a.length;e<g;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},reorderBuffers:function(a,b,c){var d={},e;for(e in this.attributes)"index"!==e&&(d[e]=new this.attributes[e].array.constructor(this.attributes[e].itemSize*c));for(var g=0;g<c;g++){var f=b[g];for(e in this.attributes)if("index"!==
|
|
@@ -486,22 +486,22 @@ tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.Sh
|
|
|
THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\nvec3 direction = normalize( vWorldPosition );\nvec2 sampleUV;\nsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\nsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\ngl_FragColor = texture2D( tEquirect, sampleUV );",THREE.ShaderChunk.logdepthbuf_fragment,
|
|
|
"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {",
|
|
|
THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")}};
|
|
|
-THREE.WebGLRenderer=function(a){function b(a,b,c,d){!0===F&&(a*=d,b*=d,c*=d);s.clearColor(a,b,c,d)}function c(){K.init();s.viewport(Ja,Ca,ya,Ka);b(ca.r,ca.g,ca.b,ma)}function d(){Xa=nb=null;Da="";Ya=-1;hb=!0;K.reset()}function e(a){a.preventDefault();d();c();na.clear();$.clear()}function g(a){a=a.target;a.removeEventListener("dispose",g);a:{var b=$.get(a);if(a.image&&b.__image__webglTextureCube)s.deleteTexture(b.__image__webglTextureCube);else{if(void 0===b.__webglInit)break a;s.deleteTexture(b.__webglTexture)}$.delete(a)}Ea.textures--}
|
|
|
+THREE.WebGLRenderer=function(a){function b(a,b,c,d){!0===F&&(a*=d,b*=d,c*=d);s.clearColor(a,b,c,d)}function c(){K.init();s.viewport(Ja,Ca,ya,Ka);b(ca.r,ca.g,ca.b,na)}function d(){Xa=nb=null;Da="";Ya=-1;hb=!0;K.reset()}function e(a){a.preventDefault();d();c();ma.clear();$.clear()}function g(a){a=a.target;a.removeEventListener("dispose",g);a:{var b=$.get(a);if(a.image&&b.__image__webglTextureCube)s.deleteTexture(b.__image__webglTextureCube);else{if(void 0===b.__webglInit)break a;s.deleteTexture(b.__webglTexture)}$.delete(a)}Ea.textures--}
|
|
|
function f(a){a=a.target;a.removeEventListener("dispose",f);var b=$.get(a);if(a&&void 0!==b.__webglTexture){s.deleteTexture(b.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var c=0;6>c;c++)s.deleteFramebuffer(b.__webglFramebuffer[c]),s.deleteRenderbuffer(b.__webglRenderbuffer[c]);else s.deleteFramebuffer(b.__webglFramebuffer),s.deleteRenderbuffer(b.__webglRenderbuffer);$.delete(a)}Ea.textures--}function h(a){a=a.target;a.removeEventListener("dispose",h);k(a);$.delete(a)}function k(a){var b=
|
|
|
$.get(a).program.program;if(void 0!==b){a.program=void 0;a=0;for(var c=wa.length;a!==c;++a){var d=wa[a];if(d.program===b){0===--d.usedTimes&&(c-=1,wa[a]=wa[c],wa.pop(),s.deleteProgram(b),Ea.programs=c);break}}}}function l(a,b,c,d){var e;if(c instanceof THREE.InstancedBufferGeometry&&(e=X.get("ANGLE_instanced_arrays"),null===e)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}K.initAttributes();
|
|
|
-var f=c.attributes;b=b.getAttributes();a=a.defaultAttributeValues;for(var g in b){var h=b[g];if(0<=h){var k=f[g];if(void 0!==k){K.enableAttribute(h);var l=k.itemSize,m=na.getAttributeBuffer(k);if(k instanceof THREE.InterleavedBufferAttribute){var n=k.data,p=n.stride,k=k.offset;s.bindBuffer(s.ARRAY_BUFFER,m);s.vertexAttribPointer(h,l,s.FLOAT,!1,p*n.array.BYTES_PER_ELEMENT,(d*p+k)*n.array.BYTES_PER_ELEMENT);if(n instanceof THREE.InstancedInterleavedBuffer){if(null===e){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");
|
|
|
+var f=c.attributes;b=b.getAttributes();a=a.defaultAttributeValues;for(var g in b){var h=b[g];if(0<=h){var k=f[g];if(void 0!==k){K.enableAttribute(h);var l=k.itemSize,m=ma.getAttributeBuffer(k);if(k instanceof THREE.InterleavedBufferAttribute){var n=k.data,p=n.stride,k=k.offset;s.bindBuffer(s.ARRAY_BUFFER,m);s.vertexAttribPointer(h,l,s.FLOAT,!1,p*n.array.BYTES_PER_ELEMENT,(d*p+k)*n.array.BYTES_PER_ELEMENT);if(n instanceof THREE.InstancedInterleavedBuffer){if(null===e){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");
|
|
|
return}e.vertexAttribDivisorANGLE(h,n.meshPerAttribute);void 0===c.maxInstancedCount&&(c.maxInstancedCount=n.meshPerAttribute*n.count)}}else if(s.bindBuffer(s.ARRAY_BUFFER,m),s.vertexAttribPointer(h,l,s.FLOAT,!1,0,d*l*4),k instanceof THREE.InstancedBufferAttribute){if(null===e){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");return}e.vertexAttribDivisorANGLE(h,k.meshPerAttribute);void 0===
|
|
|
c.maxInstancedCount&&(c.maxInstancedCount=k.meshPerAttribute*k.count)}}else if(void 0!==a&&(l=a[g],void 0!==l))switch(l.length){case 2:s.vertexAttrib2fv(h,l);break;case 3:s.vertexAttrib3fv(h,l);break;case 4:s.vertexAttrib4fv(h,l);break;default:s.vertexAttrib1fv(h,l)}}}K.disableUnusedAttributes()}function n(a,b){return b[0]-a[0]}function p(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.object.material.id!==b.object.material.id?a.object.material.id-
|
|
|
-b.object.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function m(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function q(a){if(!1!==a.visible){if(!(a instanceof THREE.Scene||a instanceof THREE.Group))if(a instanceof THREE.SkinnedMesh&&a.skeleton.update(),na.init(a),a instanceof THREE.Light)ba.push(a);else if(a instanceof THREE.Sprite)Za.push(a);else if(a instanceof THREE.LensFlare)Ra.push(a);else if(a instanceof THREE.ImmediateRenderObject){var b=
|
|
|
-a.material;b.transparent?sa.push(a):qa.push(a)}else{var c=na.objects[a.id];!c||!1!==a.frustumCulled&&!0!==$a.intersectsObject(a)||(b=a.material,null!==b&&!0===b.visible&&($.get(b)&&(b.program=$.get(b).program),b.transparent?Ba.push(c):xa.push(c),!0===ka.sortObjects&&(la.setFromMatrixPosition(a.matrixWorld),la.applyProjection(La),c.z=la.z)))}a=a.children;b=0;for(c=a.length;b<c;b++)q(a[b])}}function r(a,b,c,d,e){for(var f=e,g=0,h=a.length;g<h;g++){var k=a[g].object;x(k,b);void 0===e&&(f=k.material);
|
|
|
+b.object.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function m(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function q(a){if(!1!==a.visible){if(!(a instanceof THREE.Scene||a instanceof THREE.Group))if(a instanceof THREE.SkinnedMesh&&a.skeleton.update(),ma.init(a),a instanceof THREE.Light)ba.push(a);else if(a instanceof THREE.Sprite)Za.push(a);else if(a instanceof THREE.LensFlare)Ra.push(a);else if(a instanceof THREE.ImmediateRenderObject){var b=
|
|
|
+a.material;b.transparent?sa.push(a):qa.push(a)}else{var c=ma.objects[a.id];!c||!1!==a.frustumCulled&&!0!==$a.intersectsObject(a)||(b=a.material,null!==b&&!0===b.visible&&($.get(b)&&(b.program=$.get(b).program),b.transparent?Ba.push(c):xa.push(c),!0===ka.sortObjects&&(la.setFromMatrixPosition(a.matrixWorld),la.applyProjection(La),c.z=la.z)))}a=a.children;b=0;for(c=a.length;b<c;b++)q(a[b])}}function r(a,b,c,d,e){for(var f=e,g=0,h=a.length;g<h;g++){var k=a[g].object;x(k,b);void 0===e&&(f=k.material);
|
|
|
ka.renderBufferDirect(b,c,d,f,k)}}function t(a,b,c,d,e){for(var f=e,g=0,h=a.length;g<h;g++){var k=a[g];x(k,b);void 0===e&&(f=k.material);u(f);var l=w(b,c,d,f,k);Da="";k.render(function(a){ka.renderBufferImmediate(a,l,f)})}}function u(a){a.side!==THREE.DoubleSide?K.enable(s.CULL_FACE):K.disable(s.CULL_FACE);K.setFlipSided(a.side===THREE.BackSide);!0===a.transparent?K.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst,a.blendEquationAlpha,a.blendSrcAlpha,a.blendDstAlpha):K.setBlending(THREE.NoBlending);
|
|
|
K.setDepthFunc(a.depthFunc);K.setDepthTest(a.depthTest);K.setDepthWrite(a.depthWrite);K.setColorWrite(a.colorWrite);K.setPolygonOffset(a.polygonOffset,a.polygonOffsetFactor,a.polygonOffsetUnits)}function w(a,b,c,d,e){var f,l,m,n;ib=0;var p=$.get(d);if(d.needsUpdate||!p.program){a:{for(var q=$.get(d),r=Zb[d.type],t=0,w=0,u=0,x=0,S=0,B=b.length;S<B;S++){var I=b[S];I.onlyShadow||!1===I.visible||(I instanceof THREE.DirectionalLight&&t++,I instanceof THREE.PointLight&&w++,I instanceof THREE.SpotLight&&
|
|
|
-u++,I instanceof THREE.HemisphereLight&&x++)}f=t;l=w;m=u;n=x;for(var D,J=0,H=0,F=b.length;H<F;H++){var R=b[H];R.castShadow&&(R instanceof THREE.SpotLight&&J++,R instanceof THREE.DirectionalLight&&J++)}D=J;var L;if(ob&&e&&e.skeleton&&e.skeleton.useVertexTexture)L=1024;else{var ma=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),P=Math.floor((ma-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(P=Math.min(e.skeleton.bones.length,P),P<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+
|
|
|
+u++,I instanceof THREE.HemisphereLight&&x++)}f=t;l=w;m=u;n=x;for(var D,J=0,H=0,F=b.length;H<F;H++){var R=b[H];R.castShadow&&(R instanceof THREE.SpotLight&&J++,R instanceof THREE.DirectionalLight&&J++)}D=J;var L;if(ob&&e&&e.skeleton&&e.skeleton.useVertexTexture)L=1024;else{var na=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),P=Math.floor((na-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(P=Math.min(e.skeleton.bones.length,P),P<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+
|
|
|
e.skeleton.bones.length+", this GPU supports just "+P+" (try OpenGL instead of ANGLE)"));L=P}var U=N;null!==d.precision&&(U=K.getMaxPrecision(d.precision),U!==d.precision&&console.warn("THREE.WebGLRenderer.initMaterial:",d.precision,"not supported, using",U,"instead."));var Q={precision:U,supportsVertexTextures:pb,map:!!d.map,envMap:!!d.envMap,envMapMode:d.envMap&&d.envMap.mapping,lightMap:!!d.lightMap,aoMap:!!d.aoMap,emissiveMap:!!d.emissiveMap,bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,specularMap:!!d.specularMap,
|
|
|
alphaMap:!!d.alphaMap,combine:d.combine,vertexColors:d.vertexColors,fog:c,useFog:d.fog,fogExp:c instanceof THREE.FogExp2,flatShading:d.shading===THREE.FlatShading,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:ja,skinning:d.skinning,maxBones:L,useVertexTexture:ob&&e&&e.skeleton&&e.skeleton.useVertexTexture,morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:ka.maxMorphTargets,maxMorphNormals:ka.maxMorphNormals,maxDirLights:f,maxPointLights:l,maxSpotLights:m,maxHemiLights:n,
|
|
|
maxShadows:D,shadowMapEnabled:oa.enabled&&e.receiveShadow&&0<D,shadowMapType:oa.type,shadowMapDebug:oa.debug,alphaTest:d.alphaTest,metal:d.metal,doubleSided:d.side===THREE.DoubleSide,flipSided:d.side===THREE.BackSide},ba=[];r?ba.push(r):(ba.push(d.fragmentShader),ba.push(d.vertexShader));if(void 0!==d.defines)for(var T in d.defines)ba.push(T),ba.push(d.defines[T]);for(T in Q)ba.push(T),ba.push(Q[T]);var X=ba.join(),Ba=!0;if(q.program)if(q.program.code!==X)k(d);else if(void 0!==r)break a;else Ba=!1;
|
|
|
else d.addEventListener("dispose",h);if(r){var xa=THREE.ShaderLib[r];q.__webglShader={name:d.type,uniforms:THREE.UniformsUtils.clone(xa.uniforms),vertexShader:xa.vertexShader,fragmentShader:xa.fragmentShader}}else q.__webglShader={name:d.type,uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader};for(var qa,ca=0,Za=wa.length;ca<Za;ca++){var gb=wa[ca];if(gb.code===X){qa=gb;Ba&&qa.usedTimes++;break}}void 0===qa&&(d.__webglShader=q.__webglShader,qa=new THREE.WebGLProgram(ka,
|
|
|
-X,d,Q),wa.push(qa),Ea.programs=wa.length);q.program=qa;var Ra=qa.getAttributes();if(d.morphTargets)for(var sa=d.numSupportedMorphTargets=0;sa<ka.maxMorphTargets;sa++)0<=Ra["morphTarget"+sa]&&d.numSupportedMorphTargets++;if(d.morphNormals)for(sa=d.numSupportedMorphNormals=0;sa<ka.maxMorphNormals;sa++)0<=Ra["morphNormal"+sa]&&d.numSupportedMorphNormals++;q.uniformsList=[];var ra=q.program.getUniforms(),na;for(na in q.__webglShader.uniforms){var Da=ra[na];Da&&q.uniformsList.push([q.__webglShader.uniforms[na],
|
|
|
+X,d,Q),wa.push(qa),Ea.programs=wa.length);q.program=qa;var Ra=qa.getAttributes();if(d.morphTargets)for(var sa=d.numSupportedMorphTargets=0;sa<ka.maxMorphTargets;sa++)0<=Ra["morphTarget"+sa]&&d.numSupportedMorphTargets++;if(d.morphNormals)for(sa=d.numSupportedMorphNormals=0;sa<ka.maxMorphNormals;sa++)0<=Ra["morphNormal"+sa]&&d.numSupportedMorphNormals++;q.uniformsList=[];var ra=q.program.getUniforms(),ma;for(ma in q.__webglShader.uniforms){var Da=ra[ma];Da&&q.uniformsList.push([q.__webglShader.uniforms[ma],
|
|
|
Da])}}d.needsUpdate=!1}var Ja=!1,Ca=!1,ya=!1,ab=p.program,da=ab.getUniforms(),G=p.__webglShader.uniforms;ab.id!==nb&&(s.useProgram(ab.program),nb=ab.id,ya=Ca=Ja=!0);d.id!==Ya&&(-1===Ya&&(ya=!0),Ya=d.id,Ca=!0);if(Ja||a!==Xa)s.uniformMatrix4fv(da.projectionMatrix,!1,a.projectionMatrix.elements),ja&&s.uniform1f(da.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==Xa&&(Xa=a),(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&void 0!==da.cameraPosition&&(la.setFromMatrixPosition(a.matrixWorld),
|
|
|
s.uniform3f(da.cameraPosition,la.x,la.y,la.z)),(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshBasicMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&void 0!==da.viewMatrix&&s.uniformMatrix4fv(da.viewMatrix,!1,a.matrixWorldInverse.elements);if(d.skinning)if(e.bindMatrix&&void 0!==da.bindMatrix&&s.uniformMatrix4fv(da.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&void 0!==da.bindMatrixInverse&&s.uniformMatrix4fv(da.bindMatrixInverse,
|
|
|
!1,e.bindMatrixInverse.elements),ob&&e.skeleton&&e.skeleton.useVertexTexture){if(void 0!==da.boneTexture){var Ka=y();s.uniform1i(da.boneTexture,Ka);ka.setTexture(e.skeleton.boneTexture,Ka)}void 0!==da.boneTextureWidth&&s.uniform1i(da.boneTextureWidth,e.skeleton.boneTextureWidth);void 0!==da.boneTextureHeight&&s.uniform1i(da.boneTextureHeight,e.skeleton.boneTextureHeight)}else e.skeleton&&e.skeleton.boneMatrices&&void 0!==da.boneGlobalMatrices&&s.uniformMatrix4fv(da.boneGlobalMatrices,!1,e.skeleton.boneMatrices);
|
|
@@ -538,44 +538,45 @@ THREE.AddEquation)return s.FUNC_ADD;if(a===THREE.SubtractEquation)return s.FUNC_
|
|
|
if(a===THREE.OneMinusDstAlphaFactor)return s.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return s.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return s.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return s.SRC_ALPHA_SATURATE;b=X.get("WEBGL_compressed_texture_s3tc");if(null!==b){if(a===THREE.RGB_S3TC_DXT1_Format)return b.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
|
|
if(a===THREE.RGBA_S3TC_DXT5_Format)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}b=X.get("WEBGL_compressed_texture_pvrtc");if(null!==b){if(a===THREE.RGB_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===THREE.RGB_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}b=X.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT;
|
|
|
if(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var O=void 0!==a.canvas?a.canvas:document.createElement("canvas"),H=void 0!==a.context?a.context:null,L=O.width,J=O.height,D=1,N=void 0!==a.precision?a.precision:"highp",R=void 0!==a.alpha?a.alpha:!1,U=void 0!==a.depth?a.depth:!0,P=void 0!==a.stencil?a.stencil:!0,T=void 0!==a.antialias?a.antialias:!1,F=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ra=void 0!==a.preserveDrawingBuffer?
|
|
|
-a.preserveDrawingBuffer:!1,ja=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,ca=new THREE.Color(0),ma=0,ba=[],xa=[],Ba=[],qa=[],sa=[],gb=new Float32Array(8),Za=[],Ra=[];this.domElement=O;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.gammaFactor=2;this.gammaOutput=this.gammaInput=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;var ka=this,wa=[],nb=null,Ia=null,Ya=-1,Da="",Xa=null,ib=
|
|
|
+a.preserveDrawingBuffer:!1,ja=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,ca=new THREE.Color(0),na=0,ba=[],xa=[],Ba=[],qa=[],sa=[],gb=new Float32Array(8),Za=[],Ra=[];this.domElement=O;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.gammaFactor=2;this.gammaOutput=this.gammaInput=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;var ka=this,wa=[],nb=null,Ia=null,Ya=-1,Da="",Xa=null,ib=
|
|
|
0,Ja=0,Ca=0,ya=O.width,Ka=O.height,lb=0,mb=0,$a=new THREE.Frustum,La=new THREE.Matrix4,la=new THREE.Vector3,ga=new THREE.Vector3,hb=!0,Ob={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},Ea={programs:0,geometries:0,textures:0},Q={calls:0,vertices:0,faces:0,points:0};
|
|
|
this.info={render:Q,memory:Ea,programs:wa};var s;try{a={alpha:R,depth:U,stencil:P,antialias:T,premultipliedAlpha:F,preserveDrawingBuffer:ra};s=H||O.getContext("webgl",a)||O.getContext("experimental-webgl",a);if(null===s){if(null!==O.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}O.addEventListener("webglcontextlost",e,!1)}catch(Jb){console.error("THREE.WebGLRenderer: "+Jb)}var X=new THREE.WebGLExtensions(s);X.get("OES_texture_float");
|
|
|
-X.get("OES_texture_float_linear");X.get("OES_texture_half_float");X.get("OES_texture_half_float_linear");X.get("OES_standard_derivatives");X.get("ANGLE_instanced_arrays");X.get("OES_element_index_uint")&&(THREE.BufferGeometry.MaxIndex=4294967296);ja&&X.get("EXT_frag_depth");var K=new THREE.WebGLState(s,X,E),$=new THREE.WebGLProperties,na=new THREE.WebGLObjects(s,$,this.info);c();this.context=s;this.extensions=X;this.state=K;var oa=new THREE.WebGLShadowMap(this,ba,na);this.shadowMap=oa;var fb=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),
|
|
|
+X.get("OES_texture_float_linear");X.get("OES_texture_half_float");X.get("OES_texture_half_float_linear");X.get("OES_standard_derivatives");X.get("ANGLE_instanced_arrays");X.get("OES_element_index_uint")&&(THREE.BufferGeometry.MaxIndex=4294967296);ja&&X.get("EXT_frag_depth");var K=new THREE.WebGLState(s,X,E),$=new THREE.WebGLProperties,ma=new THREE.WebGLObjects(s,$,this.info);c();this.context=s;this.extensions=X;this.state=K;var oa=new THREE.WebGLShadowMap(this,ba,ma);this.shadowMap=oa;var fb=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),
|
|
|
H=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Kb=s.getParameter(s.MAX_TEXTURE_SIZE),ac=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),pb=0<H,ob=pb&&X.get("OES_texture_float"),Lb=X.get("ANGLE_instanced_arrays"),H=K.getMaxPrecision(N);H!==N&&(console.warn("THREE.WebGLRenderer:",N,"not supported, using",H,"instead."),N=H);var Mb=new THREE.SpritePlugin(this,Za),Nb=new THREE.LensFlarePlugin(this,Ra);this.getContext=function(){return s};this.getContextAttributes=function(){return s.getContextAttributes()};
|
|
|
this.forceContextLoss=function(){X.get("WEBGL_lose_context").loseContext()};this.supportsVertexTextures=function(){return pb};this.supportsInstancedArrays=function(){return Lb};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=X.get("EXT_texture_filter_anisotropic");return a=null!==b?s.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return N};this.getPixelRatio=function(){return D};this.setPixelRatio=function(a){void 0!==a&&(D=
|
|
|
-a)};this.getSize=function(){return{width:L,height:J}};this.setSize=function(a,b,c){L=a;J=b;O.width=a*D;O.height=b*D;!1!==c&&(O.style.width=a+"px",O.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){Ja=a*D;Ca=b*D;ya=c*D;Ka=d*D;s.viewport(Ja,Ca,ya,Ka)};this.setScissor=function(a,b,c,d){s.scissor(a*D,b*D,c*D,d*D)};this.enableScissorTest=function(a){K.setScissorTest(a)};this.getClearColor=function(){return ca};this.setClearColor=function(a,c){ca.set(a);ma=void 0!==c?c:
|
|
|
-1;b(ca.r,ca.g,ca.b,ma)};this.getClearAlpha=function(){return ma};this.setClearAlpha=function(a){ma=a;b(ca.r,ca.g,ca.b,ma)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=s.COLOR_BUFFER_BIT;if(void 0===b||b)d|=s.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=s.STENCIL_BUFFER_BIT;s.clear(d)};this.clearColor=function(){s.clear(s.COLOR_BUFFER_BIT)};this.clearDepth=function(){s.clear(s.DEPTH_BUFFER_BIT)};this.clearStencil=function(){s.clear(s.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);
|
|
|
+a)};this.getSize=function(){return{width:L,height:J}};this.setSize=function(a,b,c){L=a;J=b;O.width=a*D;O.height=b*D;!1!==c&&(O.style.width=a+"px",O.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){Ja=a*D;Ca=b*D;ya=c*D;Ka=d*D;s.viewport(Ja,Ca,ya,Ka)};this.setScissor=function(a,b,c,d){s.scissor(a*D,b*D,c*D,d*D)};this.enableScissorTest=function(a){K.setScissorTest(a)};this.getClearColor=function(){return ca};this.setClearColor=function(a,c){ca.set(a);na=void 0!==c?c:
|
|
|
+1;b(ca.r,ca.g,ca.b,na)};this.getClearAlpha=function(){return na};this.setClearAlpha=function(a){na=a;b(ca.r,ca.g,ca.b,na)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=s.COLOR_BUFFER_BIT;if(void 0===b||b)d|=s.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=s.STENCIL_BUFFER_BIT;s.clear(d)};this.clearColor=function(){s.clear(s.COLOR_BUFFER_BIT)};this.clearDepth=function(){s.clear(s.DEPTH_BUFFER_BIT)};this.clearStencil=function(){s.clear(s.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);
|
|
|
this.clear(b,c,d)};this.resetGLState=d;this.dispose=function(){O.removeEventListener("webglcontextlost",e,!1)};this.renderBufferImmediate=function(a,b,c){K.initAttributes();var d=$.get(a);a.hasPositions&&!d.position&&(d.position=s.createBuffer());a.hasNormals&&!d.normal&&(d.normal=s.createBuffer());a.hasUvs&&!d.uv&&(d.uv=s.createBuffer());a.hasColors&&!d.color&&(d.color=s.createBuffer());b=b.getAttributes();a.hasPositions&&(s.bindBuffer(s.ARRAY_BUFFER,d.position),s.bufferData(s.ARRAY_BUFFER,a.positionArray,
|
|
|
s.DYNAMIC_DRAW),K.enableAttribute(b.position),s.vertexAttribPointer(b.position,3,s.FLOAT,!1,0,0));if(a.hasNormals){s.bindBuffer(s.ARRAY_BUFFER,d.normal);if(!1===c instanceof THREE.MeshPhongMaterial&&c.shading===THREE.FlatShading){var e,f,g,h,k,l,m,n,p,q,r,t=3*a.count;for(r=0;r<t;r+=9)q=a.normalArray,e=q[r],f=q[r+1],g=q[r+2],h=q[r+3],l=q[r+4],n=q[r+5],k=q[r+6],m=q[r+7],p=q[r+8],e=(e+h+k)/3,f=(f+l+m)/3,g=(g+n+p)/3,q[r]=e,q[r+1]=f,q[r+2]=g,q[r+3]=e,q[r+4]=f,q[r+5]=g,q[r+6]=e,q[r+7]=f,q[r+8]=g}s.bufferData(s.ARRAY_BUFFER,
|
|
|
a.normalArray,s.DYNAMIC_DRAW);K.enableAttribute(b.normal);s.vertexAttribPointer(b.normal,3,s.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(s.bindBuffer(s.ARRAY_BUFFER,d.uv),s.bufferData(s.ARRAY_BUFFER,a.uvArray,s.DYNAMIC_DRAW),K.enableAttribute(b.uv),s.vertexAttribPointer(b.uv,2,s.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(s.bindBuffer(s.ARRAY_BUFFER,d.color),s.bufferData(s.ARRAY_BUFFER,a.colorArray,s.DYNAMIC_DRAW),K.enableAttribute(b.color),s.vertexAttribPointer(b.color,3,s.FLOAT,!1,0,0));K.disableUnusedAttributes();
|
|
|
-s.drawArrays(s.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d instanceof THREE.MeshFaceMaterial){var g=d.materials,h=0;for(f=g.length;h<f;h++)d=g[h],null!==d&&!1!==d.visible&&ka.renderBufferDirect(a,b,c,d,e,h)}else{u(d);g=na.update(e);a=w(a,b,c,d,e);h=!1;b=g.id+"_"+a.id+"_"+(d.wireframe?1:0);b!==Da&&(Da=b,h=!0);var k=e.morphTargetInfluences;if(void 0!==k){b=[];h=0;for(c=k.length;h<c;h++){var m=k[h];b.push([m,h])}b.sort(n);8<b.length&&(b.length=8);k=g.morphAttributes;
|
|
|
-h=0;for(c=b.length;h<c;h++)m=b[h],gb[h]=m[0],0!==m[0]?(m=m[1],!0===d.morphTargets&&g.addAttribute("morphTarget"+h,k.position[m]),!0===d.morphNormals&&g.addAttribute("morphNormal"+h,k.normal[m])):(!0===d.morphTargets&&g.removeAttribute("morphTarget"+h),!0===d.morphNormals&&g.removeAttribute("morphNormal"+h));h=a.getUniforms();null!==h.morphTargetInfluences&&s.uniform1fv(h.morphTargetInfluences,gb);h=!0}if(e instanceof THREE.Mesh)a:{e=d;d=s.TRIANGLES;!0===e.wireframe&&(d=s.LINES,K.setLineWidth(e.wireframeLinewidth*
|
|
|
-D));var p=g.attributes.index;if(p)if(k=na.getAttributeBuffer(p),p.array instanceof Uint32Array&&X.get("OES_element_index_uint")?(b=s.UNSIGNED_INT,c=4):(b=s.UNSIGNED_SHORT,c=2),m=g.drawcalls,0===m.length){h&&(l(e,a,g,0),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,k));if(g instanceof THREE.InstancedBufferGeometry&&0<g.maxInstancedCount){var q=X.get("ANGLE_instanced_arrays");if(null===q){console.error("THREE.WebGLRenderer.renderMesh: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
|
|
|
-break a}q.drawElementsInstancedANGLE(d,p.array.length,b,0,g.maxInstancedCount)}else s.drawElements(d,p.array.length,b,0);Q.calls++;Q.vertices+=p.array.length;Q.faces+=p.array.length/3}else for(var h=!0,p=0,r=m.length;p<r;p++){if(q=m[p].index,void 0===f||m[p].materialIndex===f){h&&(l(e,a,g,q),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,k));if(g instanceof THREE.InstancedBufferGeometry&&0<m[p].instances){q=X.get("ANGLE_instanced_arrays");if(null===q){console.error("THREE.WebGLRenderer.renderMesh: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
|
|
|
-break a}q.drawElementsInstancedANGLE(d,m[p].count,b,m[p].start*c,m[p].count,b,m[p].instances)}else s.drawElements(d,m[p].count,b,m[p].start*c);Q.calls++;Q.vertices+=m[p].count;Q.faces+=m[p].count/3}}else if(m=g.drawcalls,0===m.length){h&&l(e,a,g,0);f=g.attributes.position;if(g instanceof THREE.InstancedBufferGeometry&&0<g.maxInstancedCount){q=X.get("ANGLE_instanced_arrays");if(null===q){console.error("THREE.WebGLRenderer.renderMesh: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
|
|
|
-break a}f instanceof THREE.InterleavedBufferAttribute?q.drawArraysInstancedANGLE(d,0,f.data.count,g.maxInstancedCount):q.drawArraysInstancedANGLE(d,0,f.count,g.maxInstancedCount)}else f instanceof THREE.InterleavedBufferAttribute?s.drawArrays(d,0,f.data.count):s.drawArrays(d,0,f.count);Q.calls++;Q.vertices+=f.count;Q.faces+=f.array.length/3}else for(h&&l(e,a,g,0),p=0,r=m.length;p<r;p++)if(void 0===f||m[p].materialIndex===f){if(g instanceof THREE.InstancedBufferGeometry){console.error("THREE.WebGLRenderer.renderMesh: cannot use drawCalls with THREE.InstancedBufferGeometry.");
|
|
|
-break a}else s.drawArrays(d,m[p].start,m[p].count);Q.calls++;Q.vertices+=m[p].count;Q.faces+=m[p].count/3}}else if(e instanceof THREE.Line)if(e=e instanceof THREE.LineSegments?s.LINES:s.LINE_STRIP,K.setLineWidth((void 0!==d.linewidth?d.linewidth:1)*D),q=g.attributes.index)if(m=na.getAttributeBuffer(q),q.array instanceof Uint32Array&&X.get("OES_element_index_uint")?(c=s.UNSIGNED_INT,k=4):(c=s.UNSIGNED_SHORT,k=2),b=g.drawcalls,0===b.length)h&&(l(d,a,g,0),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,m)),s.drawElements(e,
|
|
|
-q.array.length,c,0),Q.calls++,Q.vertices+=q.array.length;else for(1<b.length&&(h=!0),q=0,p=b.length;q<p;q++){if(r=b[q].index,void 0===f||b[q].materialIndex!==f)h&&(l(d,a,g,r),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,m)),s.drawElements(e,b[q].count,c,b[q].start*k),Q.calls++,Q.vertices+=b[q].count}else if(h&&l(d,a,g,0),a=g.attributes.position,b=g.drawcalls,0===b.length)s.drawArrays(e,0,a.array.length/3),Q.calls++,Q.vertices+=a.array.length/3;else for(q=0,p=b.length;q<p;q++){if(void 0===f||b[q].materialIndex===
|
|
|
-f)s.drawArrays(e,b[q].index,b[q].count),Q.calls++,Q.vertices+=b[q].count}else if(e instanceof THREE.PointCloud)if(e=d,b=h,d=s.POINTS,q=g.attributes.index)if(m=na.getAttributeBuffer(q),q.array instanceof Uint32Array&&X.get("OES_element_index_uint")?(c=s.UNSIGNED_INT,k=4):(c=s.UNSIGNED_SHORT,k=2),h=g.drawcalls,0===h.length)b&&(l(e,a,g,0),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,m)),s.drawElements(d,q.array.length,c,0),Q.calls++,Q.points+=q.array.length;else for(1<h.length&&(b=!0),q=0,p=h.length;q<p;q++){if(r=
|
|
|
-h[q].index,void 0===f||h[q].materialIndex===f)b&&(l(e,a,g,r),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,m)),s.drawElements(d,h[q].count,c,h[q].start*k),Q.calls++,Q.points+=h[q].count}else if(b&&l(e,a,g,0),a=g.attributes.position,h=g.drawcalls,0===h.length)s.drawArrays(d,0,a.array.length/3),Q.calls++,Q.points+=a.array.length/3;else for(q=0,p=h.length;q<p;q++)if(void 0===f||h[q].materialIndex===f)s.drawArrays(d,h[q].index,h[q].count),Q.calls++,Q.points+=h[q].count}};this.render=function(a,b,c,d){if(!1===b instanceof
|
|
|
-THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e=a.fog;Da="";Ya=-1;Xa=null;hb=!0;!0===a.autoUpdate&&a.updateMatrixWorld();null===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);La.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);$a.setFromMatrix(La);ba.length=0;xa.length=0;Ba.length=0;qa.length=0;sa.length=0;Za.length=0;Ra.length=0;q(a);!0===ka.sortObjects&&(xa.sort(p),Ba.sort(m));oa.render(a,b);
|
|
|
-Q.calls=0;Q.vertices=0;Q.faces=0;Q.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);a.overrideMaterial?(d=a.overrideMaterial,r(xa,b,ba,e,d),r(Ba,b,ba,e,d),t(qa,b,ba,e,d),t(sa,b,ba,e,d)):(K.setBlending(THREE.NoBlending),r(xa,b,ba,e),t(qa,b,ba,e),r(Ba,b,ba,e),t(sa,b,ba,e));Mb.render(a,b);Nb.render(a,b,lb,mb);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?
|
|
|
-(K.bindTexture(s.TEXTURE_CUBE_MAP,$.get(c).__webglTexture),s.generateMipmap(s.TEXTURE_CUBE_MAP),K.bindTexture(s.TEXTURE_CUBE_MAP,null)):(K.bindTexture(s.TEXTURE_2D,$.get(c).__webglTexture),s.generateMipmap(s.TEXTURE_2D),K.bindTexture(s.TEXTURE_2D,null)));K.setDepthTest(!0);K.setDepthWrite(!0);K.setColorWrite(!0)}};var Zb={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",
|
|
|
-PointCloudMaterial:"particle_basic"};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?K.disable(s.CULL_FACE):(b===THREE.FrontFaceDirectionCW?s.frontFace(s.CW):s.frontFace(s.CCW),a===THREE.CullFaceBack?s.cullFace(s.BACK):a===THREE.CullFaceFront?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK),K.enable(s.CULL_FACE))};this.setTexture=function(a,b){var c=$.get(a);if(0<a.version&&c.__version!==a.version){var d=a.image;if(void 0===d)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",
|
|
|
-a);else if(!1===d.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",a);else{void 0===c.__webglInit&&(c.__webglInit=!0,a.__webglInit=!0,a.addEventListener("dispose",g),c.__webglTexture=s.createTexture(),Ea.textures++);K.activeTexture(s.TEXTURE0+b);K.bindTexture(s.TEXTURE_2D,c.__webglTexture);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,a.flipY);s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);s.pixelStorei(s.UNPACK_ALIGNMENT,a.unpackAlignment);
|
|
|
-a.image=A(a.image,Kb);var e=a.image,d=THREE.Math.isPowerOfTwo(e.width)&&THREE.Math.isPowerOfTwo(e.height),f=E(a.format),h=E(a.type);C(s.TEXTURE_2D,a,d);var k=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<k.length&&d){for(var l=0,m=k.length;l<m;l++)e=k[l],K.texImage2D(s.TEXTURE_2D,l,f,e.width,e.height,0,f,h,e.data);a.generateMipmaps=!1}else K.texImage2D(s.TEXTURE_2D,0,f,e.width,e.height,0,f,h,e.data);else if(a instanceof THREE.CompressedTexture)for(l=0,m=k.length;l<m;l++)e=k[l],a.format!==THREE.RGBAFormat&&
|
|
|
-a.format!==THREE.RGBFormat?-1<K.getCompressedTextureFormats().indexOf(f)?K.compressedTexImage2D(s.TEXTURE_2D,l,f,e.width,e.height,0,e.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):K.texImage2D(s.TEXTURE_2D,l,f,e.width,e.height,0,f,h,e.data);else if(0<k.length&&d){l=0;for(m=k.length;l<m;l++)e=k[l],K.texImage2D(s.TEXTURE_2D,l,f,f,h,e);a.generateMipmaps=!1}else K.texImage2D(s.TEXTURE_2D,0,f,f,h,a.image);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_2D);
|
|
|
-c.__version=a.version;if(a.onUpdate)a.onUpdate(a)}}else K.activeTexture(s.TEXTURE0+b),K.bindTexture(s.TEXTURE_2D,c.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===$.get(a).__webglFramebuffer){var c=$.get(a);void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",f);c.__webglTexture=s.createTexture();Ea.textures++;var d=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),
|
|
|
-e=E(a.format),g=E(a.type);if(b){c.__webglFramebuffer=[];c.__webglRenderbuffer=[];K.bindTexture(s.TEXTURE_CUBE_MAP,c.__webglTexture);C(s.TEXTURE_CUBE_MAP,a,d);for(var h=0;6>h;h++)c.__webglFramebuffer[h]=s.createFramebuffer(),c.__webglRenderbuffer[h]=s.createRenderbuffer(),K.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,e,a.width,a.height,0,e,g,null),B(c.__webglFramebuffer[h],a,s.TEXTURE_CUBE_MAP_POSITIVE_X+h),S(c.__webglRenderbuffer[h],a);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_CUBE_MAP)}else c.__webglFramebuffer=
|
|
|
-s.createFramebuffer(),c.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:s.createRenderbuffer(),K.bindTexture(s.TEXTURE_2D,c.__webglTexture),C(s.TEXTURE_2D,a,d),K.texImage2D(s.TEXTURE_2D,0,e,a.width,a.height,0,e,g,null),B(c.__webglFramebuffer,a,s.TEXTURE_2D),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&s.framebufferRenderbuffer(s.FRAMEBUFFER,
|
|
|
-s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):S(c.__webglRenderbuffer,a),a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_2D);b?K.bindTexture(s.TEXTURE_CUBE_MAP,null):K.bindTexture(s.TEXTURE_2D,null);s.bindRenderbuffer(s.RENDERBUFFER,null);s.bindFramebuffer(s.FRAMEBUFFER,null)}a?(c=$.get(a),b=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=ya,a=Ka,d=Ja,e=Ca);b!==Ia&&(s.bindFramebuffer(s.FRAMEBUFFER,b),s.viewport(d,e,c,a),Ia=b);
|
|
|
-lb=c;mb=a};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!(a instanceof THREE.WebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else if($.get(a).__webglFramebuffer)if(a.format!==THREE.RGBAFormat)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");else{var g=!1;$.get(a).__webglFramebuffer!==Ia&&(s.bindFramebuffer(s.FRAMEBUFFER,$.get(a).__webglFramebuffer),
|
|
|
-g=!0);s.checkFramebufferStatus(s.FRAMEBUFFER)===s.FRAMEBUFFER_COMPLETE?s.readPixels(b,c,d,e,s.RGBA,s.UNSIGNED_BYTE,f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.");g&&s.bindFramebuffer(s.FRAMEBUFFER,Ia)}};this.supportsFloatTextures=function(){console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' ).");return X.get("OES_texture_float")};this.supportsHalfFloatTextures=function(){console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' ).");
|
|
|
-return X.get("OES_texture_half_float")};this.supportsStandardDerivatives=function(){console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' ).");return X.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' ).");return X.get("WEBGL_compressed_texture_s3tc")};this.supportsCompressedTexturePVRTC=
|
|
|
-function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' ).");return X.get("WEBGL_compressed_texture_pvrtc")};this.supportsBlendMinMax=function(){console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).");return X.get("EXT_blend_minmax")};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};this.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};
|
|
|
-this.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};this.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Object.defineProperties(this,{shadowMapEnabled:{get:function(){return oa.enabled},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.");oa.enabled=a}},shadowMapType:{get:function(){return oa.type},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.");
|
|
|
-oa.type=a}},shadowMapCullFace:{get:function(){return oa.cullFace},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.");oa.cullFace=a}},shadowMapDebug:{get:function(){return oa.debug},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug.");oa.debug=a}}})};
|
|
|
+s.drawArrays(s.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d instanceof THREE.MeshFaceMaterial){f=d.materials;for(var g=0,h=f.length;g<h;g++)d=f[g],null!==d&&!1!==d.visible&&ka.renderBufferDirect(a,b,c,d,e,g)}else{u(d);h=ma.update(e);a=w(a,b,c,d,e);g=!1;b=h.id+"_"+a.id+"_"+d.wireframe;b!==Da&&(Da=b,g=!0);var k=e.morphTargetInfluences;if(void 0!==k){b=[];g=0;for(c=k.length;g<c;g++){var m=k[g];b.push([m,g])}b.sort(n);8<b.length&&(b.length=8);k=h.morphAttributes;
|
|
|
+g=0;for(c=b.length;g<c;g++)m=b[g],gb[g]=m[0],0!==m[0]?(m=m[1],!0===d.morphTargets&&h.addAttribute("morphTarget"+g,k.position[m]),!0===d.morphNormals&&h.addAttribute("morphNormal"+g,k.normal[m])):(!0===d.morphTargets&&h.removeAttribute("morphTarget"+g),!0===d.morphNormals&&h.removeAttribute("morphNormal"+g));g=a.getUniforms();null!==g.morphTargetInfluences&&s.uniform1fv(g.morphTargetInfluences,gb);g=!0}if(e instanceof THREE.Mesh)a:{e=d;d=s.TRIANGLES;!0===e.wireframe&&(d=s.LINES,K.setLineWidth(e.wireframeLinewidth*
|
|
|
+D),void 0===h._wireframe&&(h._wireframe=new THREE.WireframeGeometry(h),ma.updateAttribute(h._wireframe.attributes.position)),h=h._wireframe);var p=h.attributes.index;if(p)if(k=ma.getAttributeBuffer(p),p.array instanceof Uint32Array&&X.get("OES_element_index_uint")?(b=s.UNSIGNED_INT,c=4):(b=s.UNSIGNED_SHORT,c=2),m=h.drawcalls,0===m.length){g&&(l(e,a,h,0),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,k));if(h instanceof THREE.InstancedBufferGeometry&&0<h.maxInstancedCount){var q=X.get("ANGLE_instanced_arrays");
|
|
|
+if(null===q){console.error("THREE.WebGLRenderer.renderMesh: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}q.drawElementsInstancedANGLE(d,p.array.length,b,0,h.maxInstancedCount)}else s.drawElements(d,p.array.length,b,0);Q.calls++;Q.vertices+=p.array.length;Q.faces+=p.array.length/3}else for(var g=!0,p=0,r=m.length;p<r;p++){if(q=m[p].index,void 0===f||m[p].materialIndex===f){g&&(l(e,a,h,q),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,k));if(h instanceof
|
|
|
+THREE.InstancedBufferGeometry&&0<m[p].instances){q=X.get("ANGLE_instanced_arrays");if(null===q){console.error("THREE.WebGLRenderer.renderMesh: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}q.drawElementsInstancedANGLE(d,m[p].count,b,m[p].start*c,m[p].count,b,m[p].instances)}else s.drawElements(d,m[p].count,b,m[p].start*c);Q.calls++;Q.vertices+=m[p].count;Q.faces+=m[p].count/3}}else if(m=h.drawcalls,0===m.length){g&&l(e,a,h,0);f=h.attributes.position;
|
|
|
+if(h instanceof THREE.InstancedBufferGeometry&&0<h.maxInstancedCount){q=X.get("ANGLE_instanced_arrays");if(null===q){console.error("THREE.WebGLRenderer.renderMesh: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}f instanceof THREE.InterleavedBufferAttribute?q.drawArraysInstancedANGLE(d,0,f.data.count,h.maxInstancedCount):q.drawArraysInstancedANGLE(d,0,f.count,h.maxInstancedCount)}else f instanceof THREE.InterleavedBufferAttribute?s.drawArrays(d,
|
|
|
+0,f.data.count):s.drawArrays(d,0,f.count);Q.calls++;Q.vertices+=f.count;Q.faces+=f.array.length/3}else for(g&&l(e,a,h,0),p=0,r=m.length;p<r;p++)if(void 0===f||m[p].materialIndex===f){if(h instanceof THREE.InstancedBufferGeometry){console.error("THREE.WebGLRenderer.renderMesh: cannot use drawCalls with THREE.InstancedBufferGeometry.");break a}else s.drawArrays(d,m[p].start,m[p].count);Q.calls++;Q.vertices+=m[p].count;Q.faces+=m[p].count/3}}else if(e instanceof THREE.Line)if(e=e instanceof THREE.LineSegments?
|
|
|
+s.LINES:s.LINE_STRIP,K.setLineWidth((void 0!==d.linewidth?d.linewidth:1)*D),q=h.attributes.index)if(m=ma.getAttributeBuffer(q),q.array instanceof Uint32Array&&X.get("OES_element_index_uint")?(c=s.UNSIGNED_INT,k=4):(c=s.UNSIGNED_SHORT,k=2),b=h.drawcalls,0===b.length)g&&(l(d,a,h,0),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,m)),s.drawElements(e,q.array.length,c,0),Q.calls++,Q.vertices+=q.array.length;else for(1<b.length&&(g=!0),q=0,p=b.length;q<p;q++){if(r=b[q].index,void 0===f||b[q].materialIndex!==f)g&&
|
|
|
+(l(d,a,h,r),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,m)),s.drawElements(e,b[q].count,c,b[q].start*k),Q.calls++,Q.vertices+=b[q].count}else if(g&&l(d,a,h,0),a=h.attributes.position,b=h.drawcalls,0===b.length)s.drawArrays(e,0,a.array.length/3),Q.calls++,Q.vertices+=a.array.length/3;else for(q=0,p=b.length;q<p;q++){if(void 0===f||b[q].materialIndex===f)s.drawArrays(e,b[q].index,b[q].count),Q.calls++,Q.vertices+=b[q].count}else if(e instanceof THREE.PointCloud)if(e=d,b=g,d=s.POINTS,q=h.attributes.index)if(m=
|
|
|
+ma.getAttributeBuffer(q),q.array instanceof Uint32Array&&X.get("OES_element_index_uint")?(c=s.UNSIGNED_INT,k=4):(c=s.UNSIGNED_SHORT,k=2),g=h.drawcalls,0===g.length)b&&(l(e,a,h,0),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,m)),s.drawElements(d,q.array.length,c,0),Q.calls++,Q.points+=q.array.length;else for(1<g.length&&(b=!0),q=0,p=g.length;q<p;q++){if(r=g[q].index,void 0===f||g[q].materialIndex===f)b&&(l(e,a,h,r),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,m)),s.drawElements(d,g[q].count,c,g[q].start*k),Q.calls++,
|
|
|
+Q.points+=g[q].count}else if(b&&l(e,a,h,0),a=h.attributes.position,g=h.drawcalls,0===g.length)s.drawArrays(d,0,a.array.length/3),Q.calls++,Q.points+=a.array.length/3;else for(q=0,p=g.length;q<p;q++)if(void 0===f||g[q].materialIndex===f)s.drawArrays(d,g[q].index,g[q].count),Q.calls++,Q.points+=g[q].count}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e=a.fog;Da="";Ya=-1;Xa=null;hb=!0;
|
|
|
+!0===a.autoUpdate&&a.updateMatrixWorld();null===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);La.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);$a.setFromMatrix(La);ba.length=0;xa.length=0;Ba.length=0;qa.length=0;sa.length=0;Za.length=0;Ra.length=0;q(a);!0===ka.sortObjects&&(xa.sort(p),Ba.sort(m));oa.render(a,b);Q.calls=0;Q.vertices=0;Q.faces=0;Q.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
+a.overrideMaterial?(d=a.overrideMaterial,r(xa,b,ba,e,d),r(Ba,b,ba,e,d),t(qa,b,ba,e,d),t(sa,b,ba,e,d)):(K.setBlending(THREE.NoBlending),r(xa,b,ba,e),t(qa,b,ba,e),r(Ba,b,ba,e),t(sa,b,ba,e));Mb.render(a,b);Nb.render(a,b,lb,mb);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(K.bindTexture(s.TEXTURE_CUBE_MAP,$.get(c).__webglTexture),s.generateMipmap(s.TEXTURE_CUBE_MAP),K.bindTexture(s.TEXTURE_CUBE_MAP,null)):(K.bindTexture(s.TEXTURE_2D,
|
|
|
+$.get(c).__webglTexture),s.generateMipmap(s.TEXTURE_2D),K.bindTexture(s.TEXTURE_2D,null)));K.setDepthTest(!0);K.setDepthWrite(!0);K.setColorWrite(!0)}};var Zb={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?K.disable(s.CULL_FACE):(b===THREE.FrontFaceDirectionCW?s.frontFace(s.CW):
|
|
|
+s.frontFace(s.CCW),a===THREE.CullFaceBack?s.cullFace(s.BACK):a===THREE.CullFaceFront?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK),K.enable(s.CULL_FACE))};this.setTexture=function(a,b){var c=$.get(a);if(0<a.version&&c.__version!==a.version){var d=a.image;if(void 0===d)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",a);else if(!1===d.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",a);else{void 0===c.__webglInit&&
|
|
|
+(c.__webglInit=!0,a.__webglInit=!0,a.addEventListener("dispose",g),c.__webglTexture=s.createTexture(),Ea.textures++);K.activeTexture(s.TEXTURE0+b);K.bindTexture(s.TEXTURE_2D,c.__webglTexture);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,a.flipY);s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);s.pixelStorei(s.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=A(a.image,Kb);var e=a.image,d=THREE.Math.isPowerOfTwo(e.width)&&THREE.Math.isPowerOfTwo(e.height),f=E(a.format),h=E(a.type);C(s.TEXTURE_2D,
|
|
|
+a,d);var k=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<k.length&&d){for(var l=0,m=k.length;l<m;l++)e=k[l],K.texImage2D(s.TEXTURE_2D,l,f,e.width,e.height,0,f,h,e.data);a.generateMipmaps=!1}else K.texImage2D(s.TEXTURE_2D,0,f,e.width,e.height,0,f,h,e.data);else if(a instanceof THREE.CompressedTexture)for(l=0,m=k.length;l<m;l++)e=k[l],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<K.getCompressedTextureFormats().indexOf(f)?K.compressedTexImage2D(s.TEXTURE_2D,l,f,e.width,e.height,0,e.data):
|
|
|
+console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):K.texImage2D(s.TEXTURE_2D,l,f,e.width,e.height,0,f,h,e.data);else if(0<k.length&&d){l=0;for(m=k.length;l<m;l++)e=k[l],K.texImage2D(s.TEXTURE_2D,l,f,f,h,e);a.generateMipmaps=!1}else K.texImage2D(s.TEXTURE_2D,0,f,f,h,a.image);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_2D);c.__version=a.version;if(a.onUpdate)a.onUpdate(a)}}else K.activeTexture(s.TEXTURE0+b),K.bindTexture(s.TEXTURE_2D,
|
|
|
+c.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===$.get(a).__webglFramebuffer){var c=$.get(a);void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",f);c.__webglTexture=s.createTexture();Ea.textures++;var d=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),e=E(a.format),g=E(a.type);if(b){c.__webglFramebuffer=[];c.__webglRenderbuffer=[];K.bindTexture(s.TEXTURE_CUBE_MAP,
|
|
|
+c.__webglTexture);C(s.TEXTURE_CUBE_MAP,a,d);for(var h=0;6>h;h++)c.__webglFramebuffer[h]=s.createFramebuffer(),c.__webglRenderbuffer[h]=s.createRenderbuffer(),K.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,e,a.width,a.height,0,e,g,null),B(c.__webglFramebuffer[h],a,s.TEXTURE_CUBE_MAP_POSITIVE_X+h),S(c.__webglRenderbuffer[h],a);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_CUBE_MAP)}else c.__webglFramebuffer=s.createFramebuffer(),c.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:
|
|
|
+s.createRenderbuffer(),K.bindTexture(s.TEXTURE_2D,c.__webglTexture),C(s.TEXTURE_2D,a,d),K.texImage2D(s.TEXTURE_2D,0,e,a.width,a.height,0,e,g,null),B(c.__webglFramebuffer,a,s.TEXTURE_2D),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):S(c.__webglRenderbuffer,a),a.generateMipmaps&&
|
|
|
+d&&s.generateMipmap(s.TEXTURE_2D);b?K.bindTexture(s.TEXTURE_CUBE_MAP,null):K.bindTexture(s.TEXTURE_2D,null);s.bindRenderbuffer(s.RENDERBUFFER,null);s.bindFramebuffer(s.FRAMEBUFFER,null)}a?(c=$.get(a),b=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=ya,a=Ka,d=Ja,e=Ca);b!==Ia&&(s.bindFramebuffer(s.FRAMEBUFFER,b),s.viewport(d,e,c,a),Ia=b);lb=c;mb=a};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!(a instanceof THREE.WebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");
|
|
|
+else if($.get(a).__webglFramebuffer)if(a.format!==THREE.RGBAFormat)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");else{var g=!1;$.get(a).__webglFramebuffer!==Ia&&(s.bindFramebuffer(s.FRAMEBUFFER,$.get(a).__webglFramebuffer),g=!0);s.checkFramebufferStatus(s.FRAMEBUFFER)===s.FRAMEBUFFER_COMPLETE?s.readPixels(b,c,d,e,s.RGBA,s.UNSIGNED_BYTE,f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.");
|
|
|
+g&&s.bindFramebuffer(s.FRAMEBUFFER,Ia)}};this.supportsFloatTextures=function(){console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' ).");return X.get("OES_texture_float")};this.supportsHalfFloatTextures=function(){console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' ).");return X.get("OES_texture_half_float")};this.supportsStandardDerivatives=function(){console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' ).");
|
|
|
+return X.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' ).");return X.get("WEBGL_compressed_texture_s3tc")};this.supportsCompressedTexturePVRTC=function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' ).");return X.get("WEBGL_compressed_texture_pvrtc")};this.supportsBlendMinMax=
|
|
|
+function(){console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).");return X.get("EXT_blend_minmax")};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};this.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};this.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};this.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};
|
|
|
+Object.defineProperties(this,{shadowMapEnabled:{get:function(){return oa.enabled},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.");oa.enabled=a}},shadowMapType:{get:function(){return oa.type},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.");oa.type=a}},shadowMapCullFace:{get:function(){return oa.cullFace},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.");oa.cullFace=
|
|
|
+a}},shadowMapDebug:{get:function(){return oa.debug},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug.");oa.debug=a}}})};
|
|
|
THREE.WebGLRenderTarget=function(a,b,c){this.uuid=THREE.Math.generateUUID();this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,
|
|
|
1);this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=void 0!==c.shareDepthFrom?c.shareDepthFrom:null};
|
|
|
THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose()},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.wrapS=a.wrapS;this.wrapT=a.wrapT;this.magFilter=a.magFilter;this.minFilter=a.minFilter;this.anisotropy=a.anisotropy;this.offset.copy(a.offset);this.repeat.copy(a.repeat);this.format=a.format;this.type=a.type;this.depthBuffer=
|
|
@@ -588,7 +589,8 @@ d);b instanceof THREE.BufferGeometry?e[b.id]=b:b instanceof THREE.Geometry&&(voi
|
|
|
THREE.WebGLObjects=function(a,b,c){function d(a){a.target.traverse(function(a){a.removeEventListener("remove",d);(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)&&delete g[a.id];delete a._modelViewMatrix;delete a._normalMatrix;b.delete(a)})}function e(c,d){var e="index"===d?a.ELEMENT_ARRAY_BUFFER:a.ARRAY_BUFFER,f=c instanceof THREE.InterleavedBufferAttribute?c.data:c,g=b.get(f);if(void 0===g.__webglBuffer){g.__webglBuffer=a.createBuffer();a.bindBuffer(e,g.__webglBuffer);
|
|
|
var m=a.STATIC_DRAW;if(f instanceof THREE.DynamicBufferAttribute||f instanceof THREE.InstancedBufferAttribute&&!0===f.dynamic||f instanceof THREE.InterleavedBuffer&&!0===f.dynamic)m=a.DYNAMIC_DRAW;a.bufferData(e,f.array,m);g.version=f.version}else g.version!==f.version&&(a.bindBuffer(e,g.__webglBuffer),void 0===f.updateRange||-1===f.updateRange.count?a.bufferSubData(e,0,f.array):0===f.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: using updateRange for THREE.DynamicBufferAttribute and marked as needsUpdate but count is 0, ensure you are using set methods or updating manually."):
|
|
|
(a.bufferSubData(e,f.updateRange.offset*f.array.BYTES_PER_ELEMENT,f.array.subarray(f.updateRange.offset,f.updateRange.offset+f.updateRange.count)),f.updateRange.count=0),g.version=f.version)}var g={},f=new THREE.WebGLGeometries(a,b,c);this.objects=g;this.init=function(a){var c=b.get(a);void 0===c.__webglInit&&(c.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,a.addEventListener("removed",d));void 0===c.__webglActive&&(c.__webglActive=!0,a instanceof THREE.Mesh||
|
|
|
-a instanceof THREE.Line||a instanceof THREE.PointCloud)&&(g[a.id]={id:a.id,object:a,z:0})};this.update=function(a){var b=f.get(a);a.geometry instanceof THREE.Geometry&&b.updateFromObject(a);a=b.attributes;for(var c in a)e(a[c],c);a=b.morphAttributes;for(c in a)for(var d=a[c],g=0,m=d.length;g<m;g++)e(d[g],g);return b};this.getAttributeBuffer=function(a){return a instanceof THREE.InterleavedBufferAttribute?b.get(a.data).__webglBuffer:b.get(a).__webglBuffer};this.clear=function(){g={}}};
|
|
|
+a instanceof THREE.Line||a instanceof THREE.PointCloud)&&(g[a.id]={id:a.id,object:a,z:0})};this.getAttributeBuffer=function(a){return a instanceof THREE.InterleavedBufferAttribute?b.get(a.data).__webglBuffer:b.get(a).__webglBuffer};this.update=function(a){var b=f.get(a);a.geometry instanceof THREE.Geometry&&b.updateFromObject(a);a=b.attributes;for(var c in a)e(a[c],c);a=b.morphAttributes;for(c in a)for(var d=a[c],g=0,m=d.length;g<m;g++)e(d[g],g);return b};this.updateAttribute=e;this.clear=function(){g=
|
|
|
+{}}};
|
|
|
THREE.WebGLProgram=function(){function a(a){var b=[],c;for(c in a){var f=a[c];!1!==f&&b.push("#define "+c+" "+f)}return b.join("\n")}function b(a){return""!==a}var c=0;return function(d,e,g,f){var h=d.context,k=g.defines,l=g.__webglShader.vertexShader,n=g.__webglShader.fragmentShader,p="SHADOWMAP_TYPE_BASIC";f.shadowMapType===THREE.PCFShadowMap?p="SHADOWMAP_TYPE_PCF":f.shadowMapType===THREE.PCFSoftShadowMap&&(p="SHADOWMAP_TYPE_PCF_SOFT");var m="ENVMAP_TYPE_CUBE",q="ENVMAP_MODE_REFLECTION",r="ENVMAP_BLENDING_MULTIPLY";
|
|
|
if(f.envMap){switch(g.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:m="ENVMAP_TYPE_CUBE";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:m="ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:m="ENVMAP_TYPE_SPHERE"}switch(g.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:q="ENVMAP_MODE_REFRACTION"}switch(g.combine){case THREE.MultiplyOperation:r="ENVMAP_BLENDING_MULTIPLY";
|
|
|
break;case THREE.MixOperation:r="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:r="ENVMAP_BLENDING_ADD"}}var t=0<d.gammaFactor?d.gammaFactor:1,u=a(k),w=h.createProgram();g instanceof THREE.RawShaderMaterial?d=k="":(k=["precision "+f.precision+" float;","precision "+f.precision+" int;","#define SHADER_NAME "+g.__webglShader.name,u,f.supportsVertexTextures?"#define VERTEX_TEXTURES":"",d.gammaInput?"#define GAMMA_INPUT":"",d.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+t,"#define MAX_DIR_LIGHTS "+
|