|
@@ -494,8 +494,8 @@ THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sa
|
|
|
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===T&&(a*=d,b*=d,c*=d);r.clearColor(a,b,c,d)}function c(){N.init();r.viewport(Ia,Ca,ya,Ja);b($.r,$.g,$.b,ja)}function d(){Ya=mb=null;Da="";Za=-1;gb=!0;N.reset()}function e(a){a=a.target;a.removeEventListener("dispose",e);a:{var b=aa.get(a);if(a.image&&b.__image__webglTextureCube)r.deleteTexture(b.__image__webglTextureCube);else{if(void 0===b.__webglInit)break a;r.deleteTexture(b.__webglTexture)}aa.delete(a)}Ea.textures--}function g(a){a=a.target;
|
|
|
a.removeEventListener("dispose",g);var b=aa.get(a);if(a&&void 0!==b.__webglTexture){r.deleteTexture(b.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var c=0;6>c;c++)r.deleteFramebuffer(b.__webglFramebuffer[c]),r.deleteRenderbuffer(b.__webglRenderbuffer[c]);else r.deleteFramebuffer(b.__webglFramebuffer),r.deleteRenderbuffer(b.__webglRenderbuffer);aa.delete(a)}Ea.textures--}function f(a){a=a.target;a.removeEventListener("dispose",f);h(a);aa.delete(a)}function h(a){var b=aa.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(),r.deleteProgram(b),Ea.programs=c);break}}}}function k(a,b,c,d){var e;if(c instanceof THREE.InstancedBufferGeometry&&(e=W.get("ANGLE_instanced_arrays"),null===e)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}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){N.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;r.bindBuffer(r.ARRAY_BUFFER,m);r.vertexAttribPointer(h,l,r.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.");
|
|
|
+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(),r.deleteProgram(b),Ea.programs=c);break}}}}function k(a,b,c,d){var e;if(c instanceof THREE.InstancedBufferGeometry&&(e=W.get("ANGLE_instanced_arrays"),null===e)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}N.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){N.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;r.bindBuffer(r.ARRAY_BUFFER,m);r.vertexAttribPointer(h,l,r.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(r.bindBuffer(r.ARRAY_BUFFER,m),r.vertexAttribPointer(h,l,r.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:r.vertexAttrib2fv(h,l);break;case 3:r.vertexAttrib3fv(h,l);break;case 4:r.vertexAttrib4fv(h,l);break;default:r.vertexAttrib1fv(h,l)}}}N.disableUnusedAttributes()}function l(a,b){return b[0]-a[0]}function n(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 p(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 m(a){if(!0===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)ga.push(a);else if(a instanceof THREE.Sprite)Ra.push(a);else if(a instanceof THREE.LensFlare)Sa.push(a);else if(a instanceof THREE.ImmediateRenderObject){var b=
|
|
@@ -558,19 +558,19 @@ c){var d=0;if(void 0===a||a)d|=r.COLOR_BUFFER_BIT;if(void 0===b||b)d|=r.DEPTH_BU
|
|
|
!d.__webglVertexBuffer&&(d.__webglVertexBuffer=r.createBuffer());a.hasNormals&&!d.__webglNormalBuffer&&(d.__webglNormalBuffer=r.createBuffer());a.hasUvs&&!d.__webglUvBuffer&&(d.__webglUvBuffer=r.createBuffer());a.hasColors&&!d.__webglColorBuffer&&(d.__webglColorBuffer=r.createBuffer());b=b.getAttributes();a.hasPositions&&(r.bindBuffer(r.ARRAY_BUFFER,d.__webglVertexBuffer),r.bufferData(r.ARRAY_BUFFER,a.positionArray,r.DYNAMIC_DRAW),N.enableAttribute(b.position),r.vertexAttribPointer(b.position,3,r.FLOAT,
|
|
|
!1,0,0));if(a.hasNormals){r.bindBuffer(r.ARRAY_BUFFER,d.__webglNormalBuffer);if(!1===c instanceof THREE.MeshPhongMaterial&&c.shading===THREE.FlatShading){var e,f,g,h,k,l,m,n,p,q,t,s=3*a.count;for(t=0;t<s;t+=9)q=a.normalArray,e=q[t],f=q[t+1],g=q[t+2],h=q[t+3],l=q[t+4],n=q[t+5],k=q[t+6],m=q[t+7],p=q[t+8],e=(e+h+k)/3,f=(f+l+m)/3,g=(g+n+p)/3,q[t]=e,q[t+1]=f,q[t+2]=g,q[t+3]=e,q[t+4]=f,q[t+5]=g,q[t+6]=e,q[t+7]=f,q[t+8]=g}r.bufferData(r.ARRAY_BUFFER,a.normalArray,r.DYNAMIC_DRAW);N.enableAttribute(b.normal);
|
|
|
r.vertexAttribPointer(b.normal,3,r.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(r.bindBuffer(r.ARRAY_BUFFER,d.__webglUvBuffer),r.bufferData(r.ARRAY_BUFFER,a.uvArray,r.DYNAMIC_DRAW),N.enableAttribute(b.uv),r.vertexAttribPointer(b.uv,2,r.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(r.bindBuffer(r.ARRAY_BUFFER,d.__webglColorBuffer),r.bufferData(r.ARRAY_BUFFER,a.colorArray,r.DYNAMIC_DRAW),N.enableAttribute(b.color),r.vertexAttribPointer(b.color,3,r.FLOAT,!1,0,0));N.disableUnusedAttributes();r.drawArrays(r.TRIANGLES,
|
|
|
-0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e){if(!1!==d.visible){s(d);var f=ma.geometries.get(e);a=x(a,b,c,d,e);c=!1;b=f.id+"_"+a.id+"_"+(d.wireframe?1:0);b!==Da&&(Da=b,c=!0);c&&N.initAttributes();b=e.morphTargetInfluences;if(void 0!==b){c=[];for(var g=0,h=b.length;g<h;g++){var m=b[g];c.push([m,g])}c.sort(l);8<c.length&&(c.length=8);g=0;for(h=c.length;g<h;g++)m=c[g],xa[g]=m[0],0!==m[0]?f.addAttribute("morphTarget"+g,f.morphAttributes[m[1]]):f.removeAttribute("morphTarget"+g);b=
|
|
|
-a.getUniforms();null!==b.morphTargetInfluences&&r.uniform1fv(b.morphTargetInfluences,xa);c=!0}if(e instanceof THREE.Mesh)a:{b=c;e=r.TRIANGLES;!0===d.wireframe&&(e=r.LINES,N.setLineWidth(d.wireframeLinewidth*C));var n=f.attributes.index;if(n)if(h=ma.getAttributeBuffer(n),n.array instanceof Uint32Array&&W.get("OES_element_index_uint")?(c=r.UNSIGNED_INT,g=4):(c=r.UNSIGNED_SHORT,g=2),m=f.drawcalls,0===m.length){b&&(k(d,a,f,0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h));if(f instanceof THREE.InstancedBufferGeometry&&
|
|
|
-0<f.maxInstancedCount){var p=W.get("ANGLE_instanced_arrays");if(null===p){console.error("THREE.WebGLRenderer.renderMesh: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}p.drawElementsInstancedANGLE(e,n.array.length,c,0,f.maxInstancedCount)}else r.drawElements(e,n.array.length,c,0);P.calls++;P.vertices+=n.array.length;P.faces+=n.array.length/3}else{b=!0;for(var n=0,q=m.length;n<q;n++){p=m[n].index;b&&(k(d,a,f,p),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,
|
|
|
-h));if(f instanceof THREE.InstancedBufferGeometry&&0<m[n].instances){p=W.get("ANGLE_instanced_arrays");if(null===p){console.error("THREE.WebGLRenderer.renderMesh: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}p.drawElementsInstancedANGLE(e,m[n].count,c,m[n].start*g,m[n].count,c,m[n].instances)}else r.drawElements(e,m[n].count,c,m[n].start*g);P.calls++;P.vertices+=m[n].count;P.faces+=m[n].count/3}}else if(m=f.drawcalls,0===m.length){b&&
|
|
|
-k(d,a,f,0);d=f.attributes.position;if(f instanceof THREE.InstancedBufferGeometry&&0<f.maxInstancedCount){p=W.get("ANGLE_instanced_arrays");if(null===p){console.error("THREE.WebGLRenderer.renderMesh: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}d instanceof THREE.InterleavedBufferAttribute?p.drawArraysInstancedANGLE(e,0,d.data.count,f.maxInstancedCount):p.drawArraysInstancedANGLE(e,0,d.count,f.maxInstancedCount)}else d instanceof THREE.InterleavedBufferAttribute?
|
|
|
-r.drawArrays(e,0,d.data.count):r.drawArrays(e,0,d.count);P.calls++;P.vertices+=d.count;P.faces+=d.array.length/3}else for(b&&k(d,a,f,0),n=0,q=m.length;n<q;n++){if(f instanceof THREE.InstancedBufferGeometry){console.error("THREE.WebGLRenderer.renderMesh: cannot use drawCalls with THREE.InstancedBufferGeometry.");break a}else r.drawArrays(e,m[n].start,m[n].count);P.calls++;P.vertices+=m[n].count;P.faces+=m[n].count/3}}else if(e instanceof THREE.Line)if(b=c,e=e instanceof THREE.LineSegments?r.LINES:
|
|
|
-r.LINE_STRIP,N.setLineWidth((void 0!==d.linewidth?d.linewidth:1)*C),p=f.attributes.index)if(m=ma.getAttributeBuffer(p),p.array instanceof Uint32Array&&W.get("OES_element_index_uint")?(g=r.UNSIGNED_INT,h=4):(g=r.UNSIGNED_SHORT,h=2),c=f.drawcalls,0===c.length)b&&(k(d,a,f,0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,m)),r.drawElements(e,p.array.length,g,0),P.calls++,P.vertices+=p.array.length;else for(1<c.length&&(b=!0),p=0,n=c.length;p<n;p++)q=c[p].index,b&&(k(d,a,f,q),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,
|
|
|
-m)),r.drawElements(e,c[p].count,g,c[p].start*h),P.calls++,P.vertices+=c[p].count;else if(b&&k(d,a,f,0),d=f.attributes.position,c=f.drawcalls,0===c.length)r.drawArrays(e,0,d.array.length/3),P.calls++,P.vertices+=d.array.length/3;else for(p=0,n=c.length;p<n;p++)r.drawArrays(e,c[p].index,c[p].count),P.calls++,P.vertices+=c[p].count;else if(e instanceof THREE.PointCloud)if(e=r.POINTS,p=f.attributes.index)if(m=ma.getAttributeBuffer(p),p.array instanceof Uint32Array&&W.get("OES_element_index_uint")?(g=
|
|
|
-r.UNSIGNED_INT,h=4):(g=r.UNSIGNED_SHORT,h=2),b=f.drawcalls,0===b.length)c&&(k(d,a,f,0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,m)),r.drawElements(e,p.array.length,g,0),P.calls++,P.points+=p.array.length;else for(1<b.length&&(c=!0),p=0,n=b.length;p<n;p++)q=b[p].index,c&&(k(d,a,f,q),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,m)),r.drawElements(e,b[p].count,g,b[p].start*h),P.calls++,P.points+=b[p].count;else if(c&&k(d,a,f,0),d=f.attributes.position,b=f.drawcalls,0===b.length)r.drawArrays(e,0,d.array.length/3),
|
|
|
-P.calls++,P.points+=d.array.length/3;else for(p=0,n=b.length;p<n;p++)r.drawArrays(e,b[p].index,b[p].count),P.calls++,P.points+=b[p].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="";Za=-1;Ya=null;gb=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ka.multiplyMatrices(b.projectionMatrix,
|
|
|
-b.matrixWorldInverse);$a.setFromMatrix(Ka);ga.length=0;ra.length=0;va.length=0;pa.length=0;Qa.length=0;Ra.length=0;Sa.length=0;m(a);!0===ka.sortObjects&&(ra.sort(n),va.sort(p));ma.update(ra);ma.update(va);la.render(a,b);P.calls=0;P.vertices=0;P.faces=0;P.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);a.overrideMaterial?(d=a.overrideMaterial,q(ra,b,ga,e,d),q(va,b,ga,e,d),t(pa,b,ga,e,d),t(Qa,b,ga,e,d)):(N.setBlending(THREE.NoBlending),
|
|
|
-q(ra,b,ga,e,null),t(pa,b,ga,e,null),q(va,b,ga,e,null),t(Qa,b,ga,e,null));Lb.render(a,b);Mb.render(a,b,kb,lb);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(N.bindTexture(r.TEXTURE_CUBE_MAP,aa.get(c).__webglTexture),r.generateMipmap(r.TEXTURE_CUBE_MAP),N.bindTexture(r.TEXTURE_CUBE_MAP,null)):(N.bindTexture(r.TEXTURE_2D,aa.get(c).__webglTexture),r.generateMipmap(r.TEXTURE_2D),N.bindTexture(r.TEXTURE_2D,null)));N.setDepthTest(!0);
|
|
|
-N.setDepthWrite(!0);N.setColorWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){s(d);var f=x(a,b,c,d,e);Da="";e.render(function(a){ka.renderBufferImmediate(a,f,d)})};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?N.disable(r.CULL_FACE):(b===THREE.FrontFaceDirectionCW?
|
|
|
+0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e){if(!1!==d.visible){s(d);var f=ma.geometries.get(e);a=x(a,b,c,d,e);c=!1;b=f.id+"_"+a.id+"_"+(d.wireframe?1:0);b!==Da&&(Da=b,c=!0);b=e.morphTargetInfluences;if(void 0!==b){c=[];for(var g=0,h=b.length;g<h;g++){var m=b[g];c.push([m,g])}c.sort(l);8<c.length&&(c.length=8);g=0;for(h=c.length;g<h;g++)m=c[g],xa[g]=m[0],0!==m[0]?f.addAttribute("morphTarget"+g,f.morphAttributes[m[1]]):f.removeAttribute("morphTarget"+g);b=a.getUniforms();null!==
|
|
|
+b.morphTargetInfluences&&r.uniform1fv(b.morphTargetInfluences,xa);c=!0}if(e instanceof THREE.Mesh)a:{b=c;e=r.TRIANGLES;!0===d.wireframe&&(e=r.LINES,N.setLineWidth(d.wireframeLinewidth*C));var n=f.attributes.index;if(n)if(h=ma.getAttributeBuffer(n),n.array instanceof Uint32Array&&W.get("OES_element_index_uint")?(c=r.UNSIGNED_INT,g=4):(c=r.UNSIGNED_SHORT,g=2),m=f.drawcalls,0===m.length){b&&(k(d,a,f,0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h));if(f instanceof THREE.InstancedBufferGeometry&&0<f.maxInstancedCount){var p=
|
|
|
+W.get("ANGLE_instanced_arrays");if(null===p){console.error("THREE.WebGLRenderer.renderMesh: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}p.drawElementsInstancedANGLE(e,n.array.length,c,0,f.maxInstancedCount)}else r.drawElements(e,n.array.length,c,0);P.calls++;P.vertices+=n.array.length;P.faces+=n.array.length/3}else{b=!0;for(var n=0,q=m.length;n<q;n++){p=m[n].index;b&&(k(d,a,f,p),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h));if(f instanceof
|
|
|
+THREE.InstancedBufferGeometry&&0<m[n].instances){p=W.get("ANGLE_instanced_arrays");if(null===p){console.error("THREE.WebGLRenderer.renderMesh: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}p.drawElementsInstancedANGLE(e,m[n].count,c,m[n].start*g,m[n].count,c,m[n].instances)}else r.drawElements(e,m[n].count,c,m[n].start*g);P.calls++;P.vertices+=m[n].count;P.faces+=m[n].count/3}}else if(m=f.drawcalls,0===m.length){b&&k(d,a,f,0);d=f.attributes.position;
|
|
|
+if(f instanceof THREE.InstancedBufferGeometry&&0<f.maxInstancedCount){p=W.get("ANGLE_instanced_arrays");if(null===p){console.error("THREE.WebGLRenderer.renderMesh: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}d instanceof THREE.InterleavedBufferAttribute?p.drawArraysInstancedANGLE(e,0,d.data.count,f.maxInstancedCount):p.drawArraysInstancedANGLE(e,0,d.count,f.maxInstancedCount)}else d instanceof THREE.InterleavedBufferAttribute?r.drawArrays(e,
|
|
|
+0,d.data.count):r.drawArrays(e,0,d.count);P.calls++;P.vertices+=d.count;P.faces+=d.array.length/3}else for(b&&k(d,a,f,0),n=0,q=m.length;n<q;n++){if(f instanceof THREE.InstancedBufferGeometry){console.error("THREE.WebGLRenderer.renderMesh: cannot use drawCalls with THREE.InstancedBufferGeometry.");break a}else r.drawArrays(e,m[n].start,m[n].count);P.calls++;P.vertices+=m[n].count;P.faces+=m[n].count/3}}else if(e instanceof THREE.Line)if(b=c,e=e instanceof THREE.LineSegments?r.LINES:r.LINE_STRIP,N.setLineWidth((void 0!==
|
|
|
+d.linewidth?d.linewidth:1)*C),p=f.attributes.index)if(m=ma.getAttributeBuffer(p),p.array instanceof Uint32Array&&W.get("OES_element_index_uint")?(g=r.UNSIGNED_INT,h=4):(g=r.UNSIGNED_SHORT,h=2),c=f.drawcalls,0===c.length)b&&(k(d,a,f,0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,m)),r.drawElements(e,p.array.length,g,0),P.calls++,P.vertices+=p.array.length;else for(1<c.length&&(b=!0),p=0,n=c.length;p<n;p++)q=c[p].index,b&&(k(d,a,f,q),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,m)),r.drawElements(e,c[p].count,g,c[p].start*
|
|
|
+h),P.calls++,P.vertices+=c[p].count;else if(b&&k(d,a,f,0),d=f.attributes.position,c=f.drawcalls,0===c.length)r.drawArrays(e,0,d.array.length/3),P.calls++,P.vertices+=d.array.length/3;else for(p=0,n=c.length;p<n;p++)r.drawArrays(e,c[p].index,c[p].count),P.calls++,P.vertices+=c[p].count;else if(e instanceof THREE.PointCloud)if(e=r.POINTS,p=f.attributes.index)if(m=ma.getAttributeBuffer(p),p.array instanceof Uint32Array&&W.get("OES_element_index_uint")?(g=r.UNSIGNED_INT,h=4):(g=r.UNSIGNED_SHORT,h=2),
|
|
|
+b=f.drawcalls,0===b.length)c&&(k(d,a,f,0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,m)),r.drawElements(e,p.array.length,g,0),P.calls++,P.points+=p.array.length;else for(1<b.length&&(c=!0),p=0,n=b.length;p<n;p++)q=b[p].index,c&&(k(d,a,f,q),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,m)),r.drawElements(e,b[p].count,g,b[p].start*h),P.calls++,P.points+=b[p].count;else if(c&&k(d,a,f,0),d=f.attributes.position,b=f.drawcalls,0===b.length)r.drawArrays(e,0,d.array.length/3),P.calls++,P.points+=d.array.length/3;else for(p=
|
|
|
+0,n=b.length;p<n;p++)r.drawArrays(e,b[p].index,b[p].count),P.calls++,P.points+=b[p].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="";Za=-1;Ya=null;gb=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ka.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);$a.setFromMatrix(Ka);ga.length=
|
|
|
+0;ra.length=0;va.length=0;pa.length=0;Qa.length=0;Ra.length=0;Sa.length=0;m(a);!0===ka.sortObjects&&(ra.sort(n),va.sort(p));ma.update(ra);ma.update(va);la.render(a,b);P.calls=0;P.vertices=0;P.faces=0;P.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);a.overrideMaterial?(d=a.overrideMaterial,q(ra,b,ga,e,d),q(va,b,ga,e,d),t(pa,b,ga,e,d),t(Qa,b,ga,e,d)):(N.setBlending(THREE.NoBlending),q(ra,b,ga,e,null),t(pa,b,ga,e,null),
|
|
|
+q(va,b,ga,e,null),t(Qa,b,ga,e,null));Lb.render(a,b);Mb.render(a,b,kb,lb);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(N.bindTexture(r.TEXTURE_CUBE_MAP,aa.get(c).__webglTexture),r.generateMipmap(r.TEXTURE_CUBE_MAP),N.bindTexture(r.TEXTURE_CUBE_MAP,null)):(N.bindTexture(r.TEXTURE_2D,aa.get(c).__webglTexture),r.generateMipmap(r.TEXTURE_2D),N.bindTexture(r.TEXTURE_2D,null)));N.setDepthTest(!0);N.setDepthWrite(!0);
|
|
|
+N.setColorWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){s(d);var f=x(a,b,c,d,e);Da="";e.render(function(a){ka.renderBufferImmediate(a,f,d)})};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?N.disable(r.CULL_FACE):(b===THREE.FrontFaceDirectionCW?
|
|
|
r.frontFace(r.CW):r.frontFace(r.CCW),a===THREE.CullFaceBack?r.cullFace(r.BACK):a===THREE.CullFaceFront?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK),N.enable(r.CULL_FACE))};this.setMaterialFaces=u;this.setTexture=function(a,b){var c=aa.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",e),c.__webglTexture=r.createTexture(),Ea.textures++);N.activeTexture(r.TEXTURE0+b);N.bindTexture(r.TEXTURE_2D,c.__webglTexture);r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,a.flipY);r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);r.pixelStorei(r.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=H(a.image,Jb);var f=a.image,d=THREE.Math.isPowerOfTwo(f.width)&&THREE.Math.isPowerOfTwo(f.height),g=D(a.format),
|
|
|
h=D(a.type);G(r.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++)f=k[l],N.texImage2D(r.TEXTURE_2D,l,g,f.width,f.height,0,g,h,f.data);a.generateMipmaps=!1}else N.texImage2D(r.TEXTURE_2D,0,g,f.width,f.height,0,g,h,f.data);else if(a instanceof THREE.CompressedTexture)for(l=0,m=k.length;l<m;l++)f=k[l],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<Yb().indexOf(g)?N.compressedTexImage2D(r.TEXTURE_2D,l,g,f.width,f.height,0,f.data):
|