|
@@ -516,51 +516,51 @@ a.canvas?a.canvas:document.createElement("canvas"),sa=void 0!==a.context?a.conte
|
|
|
jb=[];this.domElement=P;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=
|
|
|
4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var J=this,Wa=[],vb=null,Zb=null,tb=-1,Ia=null,Vb=null,fc=0,Kb=-1,mb=-1,nb=-1,Db=-1,Eb=-1,Xb=-1,Fb=-1,Yb=-1,Nc=null,Oc=null,Pc=null,Mc=null,mc=0,ob=0,ib=P.width,Lb=P.height,Gc=0,Hc=0,Mb=new Uint8Array(16),Gb=new Uint8Array(16),zc=new THREE.Frustum,xc=new THREE.Matrix4,Cc=new THREE.Matrix4,Qa=new THREE.Vector3,ya=new THREE.Vector3,
|
|
|
Wb=!0,Kc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},l,sb,tc,lb,Fa,Ra,ub,Za;(function(){try{var a={alpha:Y,depth:ga,stencil:ua,antialias:N,premultipliedAlpha:ka,preserveDrawingBuffer:xa};l=sa||P.getContext("webgl",a)||P.getContext("experimental-webgl",a);if(null===l)throw"Error creating WebGL context.";
|
|
|
-}catch(b){console.error(b)}sb=l.getExtension("OES_texture_float");l.getExtension("OES_texture_float_linear");tc=l.getExtension("OES_standard_derivatives");lb=l.getExtension("EXT_texture_filter_anisotropic")||l.getExtension("MOZ_EXT_texture_filter_anisotropic")||l.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Fa=l.getExtension("WEBGL_compressed_texture_s3tc")||l.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||l.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Ra=l.getExtension("WEBGL_compressed_texture_pvrtc")||
|
|
|
-l.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");ub=l.getExtension("OES_element_index_uint");Za=l.getExtension("EXT_blend_minmax");null===sb&&console.log("THREE.WebGLRenderer: Float textures not supported.");null===tc&&console.log("THREE.WebGLRenderer: Standard derivatives not supported.");null===lb&&console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");null===Fa&&console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");null===Ra&&console.log("THREE.WebGLRenderer: PVRTC compressed textures not supported.");
|
|
|
-null===ub&&console.log("THREE.WebGLRenderer: elementindex as unsigned integer not supported.");null===Za&&console.log("THREE.WebGLRenderer: min max blend equations not supported.");void 0===l.getShaderPrecisionFormat&&(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});Ja&&l.getExtension("EXT_frag_depth")})();l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);
|
|
|
-l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.viewport(mc,ob,ib,Lb);l.clearColor(la.r,la.g,la.b,Ka);this.context=l;var Lc=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),Xc=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Yc=l.getParameter(l.MAX_TEXTURE_SIZE),Wc=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),Qc=lb?l.getParameter(lb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,hc=0<Xc,gc=hc&&sb,lc=[];if(Ra||Fa)for(var Rc=l.getParameter(l.COMPRESSED_TEXTURE_FORMATS),uc=
|
|
|
-0;uc<Rc.length;uc++)lc.push(Rc[uc]);var Zc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.HIGH_FLOAT),$c=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);var ad=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT),bd=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);var cd=0<Zc.precision&&0<ad.precision,Sc=0<$c.precision&&0<bd.precision;"highp"!==L||cd||(Sc?(L=
|
|
|
-"mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(L="lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")));"mediump"!==L||Sc||(L="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));this.getContext=function(){return l};this.supportsVertexTextures=function(){return hc};this.supportsFloatTextures=function(){return sb};this.supportsStandardDerivatives=function(){return tc};this.supportsCompressedTextureS3TC=
|
|
|
-function(){return Fa};this.supportsCompressedTexturePVRTC=function(){return Ra};this.supportsBlendMinMax=function(){return Za};this.getMaxAnisotropy=function(){return Qc};this.getPrecision=function(){return L};this.setSize=function(a,b,c){P.width=a*this.devicePixelRatio;P.height=b*this.devicePixelRatio;!1!==c&&(P.style.width=a+"px",P.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){mc=a*this.devicePixelRatio;ob=b*this.devicePixelRatio;ib=c*this.devicePixelRatio;Lb=
|
|
|
-d*this.devicePixelRatio;l.viewport(mc,ob,ib,Lb)};this.setScissor=function(a,b,c,d){l.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColor=function(a,b){la.set(a);Ka=void 0!==b?b:1;l.clearColor(la.r,la.g,la.b,Ka)};this.setClearColorHex=function(a,b){console.warn("THREE.WebGLRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");
|
|
|
-this.setClearColor(a,b)};this.getClearColor=function(){return la};this.getClearAlpha=function(){return Ka};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=l.COLOR_BUFFER_BIT;if(void 0===b||b)d|=l.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearColor=function(){l.clear(l.COLOR_BUFFER_BIT)};this.clearDepth=function(){l.clear(l.DEPTH_BUFFER_BIT)};this.clearStencil=function(){l.clear(l.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);
|
|
|
-this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this,Da,ab,Ga);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this,Da,ab,Ga);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){vb=null;tb=Ia=Yb=Fb=nb=-1;Wb=!0;mb=Kb=-1;this.shadowMapPlugin.update(a,b)};var Dc=function(a){a.target.traverse(function(a){a.removeEventListener("remove",Dc);if(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)delete ab[a.id];else if(a instanceof THREE.ImmediateRenderObject||
|
|
|
-a.immediateRenderCallback)for(var b=Ga,c=b.length-1;0<=c;c--)b[c].object===a&&b.splice(c,1);delete a.__webglInit;delete a._modelViewMatrix;delete a._normalMatrix;delete a.__webglActive})},Ec=function(a){a=a.target;a.removeEventListener("dispose",Ec);delete a.__webglInit;if(a instanceof THREE.BufferGeometry){for(var b in a.attributes){var c=a.attributes[b];void 0!==c.buffer&&(l.deleteBuffer(c.buffer),delete c.buffer)}J.info.memory.geometries--}else if(void 0!==a.geometryGroups)for(b=0,c=a.geometryGroupsList.length;b<
|
|
|
-c;b++){var d=a.geometryGroupsList[b];if(void 0!==d.numMorphTargets){for(var e=0,f=d.numMorphTargets;e<f;e++)l.deleteBuffer(d.__webglMorphTargetsBuffers[e]);delete d.__webglMorphTargetsBuffers}if(void 0!==d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)l.deleteBuffer(d.__webglMorphNormalsBuffers[e]);delete d.__webglMorphNormalsBuffers}Tc(d)}else Tc(a);Ia=-1},kc=function(a){a=a.target;a.removeEventListener("dispose",kc);a.image&&a.image.__webglTextureCube?(l.deleteTexture(a.image.__webglTextureCube),
|
|
|
-delete a.image.__webglTextureCube):void 0!==a.__webglInit&&(l.deleteTexture(a.__webglTexture),delete a.__webglTexture,delete a.__webglInit);J.info.memory.textures--},Uc=function(a){a=a.target;a.removeEventListener("dispose",Uc);if(a&&void 0!==a.__webglTexture){l.deleteTexture(a.__webglTexture);delete a.__webglTexture;if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)l.deleteFramebuffer(a.__webglFramebuffer[b]),l.deleteRenderbuffer(a.__webglRenderbuffer[b]);else l.deleteFramebuffer(a.__webglFramebuffer),
|
|
|
-l.deleteRenderbuffer(a.__webglRenderbuffer);delete a.__webglFramebuffer;delete a.__webglRenderbuffer}J.info.memory.textures--},Jc=function(a){a=a.target;a.removeEventListener("dispose",Jc);Ic(a)},Tc=function(a){for(var b="__webglVertexBuffer __webglNormalBuffer __webglTangentBuffer __webglColorBuffer __webglUVBuffer __webglUV2Buffer __webglSkinIndicesBuffer __webglSkinWeightsBuffer __webglFaceBuffer __webglLineBuffer __webglLineDistanceBuffer".split(" "),c=0,d=b.length;c<d;c++){var e=b[c];void 0!==
|
|
|
-a[e]&&(l.deleteBuffer(a[e]),delete a[e])}if(void 0!==a.__webglCustomAttributesList){for(e in a.__webglCustomAttributesList)l.deleteBuffer(a.__webglCustomAttributesList[e].buffer);delete a.__webglCustomAttributesList}J.info.memory.geometries--},Ic=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=Wa.length;a<c;a++)if(d=Wa[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Wa.length;a<c;a++)d=Wa[a],d.program!==b&&e.push(d);
|
|
|
-Wa=e;l.deleteProgram(b);J.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){g();a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=l.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=l.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=l.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=l.createBuffer());a.hasPositions&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,a.positionArray,
|
|
|
-l.DYNAMIC_DRAW),f(b.attributes.position),l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormals){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,k,m,n,p,q,s,t,r,u,w=3*a.count;for(u=0;u<w;u+=9)r=a.normalArray,d=r[u],e=r[u+1],k=r[u+2],m=r[u+3],p=r[u+4],s=r[u+5],n=r[u+6],q=r[u+7],t=r[u+8],d=(d+m+n)/3,e=(e+p+q)/3,k=(k+s+t)/3,r[u]=d,r[u+1]=e,r[u+2]=k,r[u+3]=d,r[u+4]=e,r[u+5]=k,r[u+6]=d,r[u+7]=e,r[u+8]=k}l.bufferData(l.ARRAY_BUFFER,a.normalArray,
|
|
|
-l.DYNAMIC_DRAW);f(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglUvBuffer),l.bufferData(l.ARRAY_BUFFER,a.uvArray,l.DYNAMIC_DRAW),f(b.attributes.uv),l.vertexAttribPointer(b.attributes.uv,2,l.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,a.colorArray,l.DYNAMIC_DRAW),f(b.attributes.color),l.vertexAttribPointer(b.attributes.color,
|
|
|
-3,l.FLOAT,!1,0,0));h();l.drawArrays(l.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,h){if(!1!==d.visible)if(a=x(a,b,c,d,h),b=!1,c=16777215*f.id+2*a.id+(d.wireframe?1:0),c!==Ia&&(Ia=c,b=!0),b&&g(),h instanceof THREE.Mesh)if(h=!0===d.wireframe?l.LINES:l.TRIANGLES,c=f.attributes.index){var k,m;c.array instanceof Uint32Array?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2);var n=f.offsets;if(0===n.length)b&&(e(d,a,f,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,
|
|
|
-c.array.length,k,0),J.info.render.calls++,J.info.render.vertices+=c.array.length,J.info.render.faces+=c.array.length/3;else{b=!0;for(var p=0,q=n.length;p<q;p++){var s=n[p].index;b&&(e(d,a,f,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer));l.drawElements(h,n[p].count,k,n[p].start*m);J.info.render.calls++;J.info.render.vertices+=n[p].count;J.info.render.faces+=n[p].count/3}}}else b&&e(d,a,f,0),d=f.attributes.position,l.drawArrays(h,0,d.array.length/3),J.info.render.calls++,J.info.render.vertices+=
|
|
|
-d.array.length/3,J.info.render.faces+=d.array.length/9;else if(h instanceof THREE.PointCloud)b&&e(d,a,f,0),d=f.attributes.position,l.drawArrays(l.POINTS,0,d.array.length/3),J.info.render.calls++,J.info.render.points+=d.array.length/3;else if(h instanceof THREE.Line)if(h=h.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,R(d.linewidth),c=f.attributes.index)if(c.array instanceof Uint32Array?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2),n=f.offsets,0===n.length)b&&(e(d,a,f,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,
|
|
|
-c.buffer)),l.drawElements(h,c.array.length,k,0),J.info.render.calls++,J.info.render.vertices+=c.array.length;else for(1<n.length&&(b=!0),p=0,q=n.length;p<q;p++)s=n[p].index,b&&(e(d,a,f,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),J.info.render.calls++,J.info.render.vertices+=n[p].count;else b&&e(d,a,f,0),d=f.attributes.position,l.drawArrays(h,0,d.array.length/3),J.info.render.calls++,J.info.render.points+=d.array.length/3};this.renderBuffer=function(a,
|
|
|
-b,c,d,e,k){if(!1!==d.visible){var m,n;c=x(a,b,c,d,k);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Ia&&(Ia=c,a=!0);a&&g();if(!d.morphTargets&&0<=b.position)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),f(b.position),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(k.morphTargetBase){c=d.program.attributes;-1!==k.morphTargetBase&&0<=c.position?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k.morphTargetBase]),f(c.position),l.vertexAttribPointer(c.position,
|
|
|
-3,l.FLOAT,!1,0,0)):0<=c.position&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),f(c.position),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length){var q=0;n=k.morphTargetForcedOrder;for(m=k.morphTargetInfluences;q<d.numSupportedMorphTargets&&q<n.length;)0<=c["morphTarget"+q]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n[q]]),f(c["morphTarget"+q]),l.vertexAttribPointer(c["morphTarget"+q],3,l.FLOAT,!1,0,0)),0<=c["morphNormal"+q]&&d.morphNormals&&
|
|
|
-(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n[q]]),f(c["morphNormal"+q]),l.vertexAttribPointer(c["morphNormal"+q],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[q]=m[n[q]],q++}else{n=[];m=k.morphTargetInfluences;var s,r=m.length;for(s=0;s<r;s++)q=m[s],0<q&&n.push([q,s]);n.length>d.numSupportedMorphTargets?(n.sort(p),n.length=d.numSupportedMorphTargets):n.length>d.numSupportedMorphNormals?n.sort(p):0===n.length&&n.push([0,0]);for(q=0;q<d.numSupportedMorphTargets;)n[q]?(s=n[q][1],0<=
|
|
|
-c["morphTarget"+q]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[s]),f(c["morphTarget"+q]),l.vertexAttribPointer(c["morphTarget"+q],3,l.FLOAT,!1,0,0)),0<=c["morphNormal"+q]&&d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[s]),f(c["morphNormal"+q]),l.vertexAttribPointer(c["morphNormal"+q],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[q]=m[s]):k.__webglMorphTargetInfluences[q]=0,q++}null!==d.program.uniforms.morphTargetInfluences&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,
|
|
|
-k.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(m=0,n=e.__webglCustomAttributesList.length;m<n;m++)c=e.__webglCustomAttributesList[m],0<=b[c.buffer.belongsToAttribute]&&(l.bindBuffer(l.ARRAY_BUFFER,c.buffer),f(b[c.buffer.belongsToAttribute]),l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,!1,0,0));0<=b.color&&(0<k.geometry.colors.length||0<k.geometry.faces.length?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),f(b.color),l.vertexAttribPointer(b.color,
|
|
|
-3,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib3fv(b.color,d.defaultAttributeValues.color));0<=b.normal&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),f(b.normal),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));0<=b.tangent&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglTangentBuffer),f(b.tangent),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));0<=b.uv&&(k.geometry.faceVertexUvs[0]?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer),f(b.uv),l.vertexAttribPointer(b.uv,2,l.FLOAT,
|
|
|
-!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv,d.defaultAttributeValues.uv));0<=b.uv2&&(k.geometry.faceVertexUvs[1]?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer),f(b.uv2),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv2,d.defaultAttributeValues.uv2));d.skinning&&0<=b.skinIndex&&0<=b.skinWeight&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),f(b.skinIndex),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,
|
|
|
-e.__webglSkinWeightsBuffer),f(b.skinWeight),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0));0<=b.lineDistance&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglLineDistanceBuffer),f(b.lineDistance),l.vertexAttribPointer(b.lineDistance,1,l.FLOAT,!1,0,0))}h();k instanceof THREE.Mesh?(k=e.__typeArray===Uint32Array?l.UNSIGNED_INT:l.UNSIGNED_SHORT,d.wireframe?(R(d.wireframeLinewidth),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,k,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,
|
|
|
-e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,k,0)),J.info.render.calls++,J.info.render.vertices+=e.__webglFaceCount,J.info.render.faces+=e.__webglFaceCount/3):k instanceof THREE.Line?(k=k.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,R(d.linewidth),l.drawArrays(k,0,e.__webglLineCount),J.info.render.calls++):k instanceof THREE.PointCloud&&(l.drawArrays(l.POINTS,0,e.__webglParticleCount),J.info.render.calls++,J.info.render.points+=e.__webglParticleCount)}};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,f,g,h=a.fog;tb=-1;Vb=null;Wb=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();a.traverse(function(a){a instanceof THREE.SkinnedMesh&&a.skeleton.update()});b.matrixWorldInverse.getInverse(b.matrixWorld);xc.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);zc.setFromMatrix(xc);Da.length=0;$a.length=0;jb.length=0;m(a,a);
|
|
|
-!0===J.sortObjects&&($a.sort(k),jb.sort(n));q(this.renderPluginsPre,a,b);J.info.render.calls=0;J.info.render.vertices=0;J.info.render.faces=0;J.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=0;for(e=Ga.length;d<e;d++)f=Ga[d],g=f.object,g.visible&&(B(g,b),r(f));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),
|
|
|
-I(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),t($a,b,Da,h,!0,d),t(jb,b,Da,h,!0,d),s(Ga,"",b,Da,h,!1,d)):(d=null,this.setBlending(THREE.NoBlending),t($a,b,Da,h,!1,d),s(Ga,"opaque",b,Da,h,!1,d),t(jb,b,Da,h,!0,d),s(Ga,"transparent",b,Da,h,!0,d));q(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&U(c);this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=x(a,b,c,d,e);Ia=
|
|
|
--1;J.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,l,zc):e.render(function(a){J.renderBufferImmediate(a,f,d)})};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?l.disable(l.CULL_FACE):(b===THREE.FrontFaceDirectionCW?l.frontFace(l.CW):l.frontFace(l.CCW),a===THREE.CullFaceBack?l.cullFace(l.BACK):a===THREE.CullFaceFront?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),
|
|
|
-l.enable(l.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide;a=a.side===THREE.BackSide;Kb!==b&&(b?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),Kb=b);mb!==a&&(a?l.frontFace(l.CW):l.frontFace(l.CCW),mb=a)};this.setDepthTest=function(a){Fb!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),Fb=a)};this.setDepthWrite=function(a){Yb!==a&&(l.depthMask(a),Yb=a)};this.setBlending=function(a,b,c,d){a!==nb&&(a===THREE.NoBlending?l.disable(l.BLEND):a===THREE.AdditiveBlending?
|
|
|
-(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.SRC_ALPHA,l.ONE)):a===THREE.SubtractiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.SRC_COLOR)):a===THREE.CustomBlending?l.enable(l.BLEND):(l.enable(l.BLEND),l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)),nb=
|
|
|
-a);if(a===THREE.CustomBlending){if(b!==Db&&(l.blendEquation(V(b)),Db=b),c!==Eb||d!==Xb)l.blendFunc(V(c),V(d)),Eb=c,Xb=d}else Xb=Eb=Db=null};this.uploadTexture=function(a){void 0===a.__webglInit&&(a.__webglInit=!0,a.addEventListener("dispose",kc),a.__webglTexture=l.createTexture(),J.info.memory.textures++);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);l.pixelStorei(l.UNPACK_ALIGNMENT,a.unpackAlignment);
|
|
|
-a.image=C(a.image,Yc);var b=a.image,c=THREE.Math.isPowerOfTwo(b.width)&&THREE.Math.isPowerOfTwo(b.height),d=V(a.format),e=V(a.type);O(l.TEXTURE_2D,a,c);var f=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<f.length&&c){for(var g=0,h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,b.width,b.height,0,d,e,b.data);else if(a instanceof THREE.CompressedTexture)for(g=0,h=f.length;g<h;g++)b=f[g],a.format!==THREE.RGBAFormat&&
|
|
|
-a.format!==THREE.RGBFormat?-1<lc.indexOf(d)?l.compressedTexImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,b.data):console.warn("Attempt to load unsupported compressed texture format"):l.texImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);else if(0<f.length&&c){g=0;for(h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,d,e,b);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,d,e,a.image);a.generateMipmaps&&c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()};
|
|
|
-this.setTexture=function(a,b){l.activeTexture(l.TEXTURE0+b);a.needsUpdate?J.uploadTexture(a):l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Uc);a.__webglTexture=l.createTexture();J.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),
|
|
|
-d=V(a.format),e=V(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);O(l.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=l.createFramebuffer();a.__webglRenderbuffer[f]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=l.TEXTURE_CUBE_MAP_POSITIVE_X+f;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[f]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,
|
|
|
-h,g.__webglTexture,0);W(a.__webglRenderbuffer[f],a)}c&&l.generateMipmap(l.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),O(l.TEXTURE_2D,a,c),l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,
|
|
|
-0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):W(a.__webglRenderbuffer,a),c&&l.generateMipmap(l.TEXTURE_2D);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?
|
|
|
-(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=ib,a=Lb,d=mc,e=ob);b!==Zb&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),Zb=b);Gc=c;Hc=a};this.resetGLState=function(){Vb=vb=null;tb=Ia=mb=Kb=Yb=Fb=nb=-1;Wb=!0};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
|
|
|
+}catch(b){console.error(b)}sb=l.getExtension("OES_texture_float");l.getExtension("OES_texture_float_linear");null===sb&&console.log("THREE.WebGLRenderer: Float textures not supported.");tc=l.getExtension("OES_standard_derivatives");null===tc&&console.log("THREE.WebGLRenderer: Standard derivatives not supported.");lb=l.getExtension("EXT_texture_filter_anisotropic")||l.getExtension("MOZ_EXT_texture_filter_anisotropic")||l.getExtension("WEBKIT_EXT_texture_filter_anisotropic");null===lb&&console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
|
|
|
+Fa=l.getExtension("WEBGL_compressed_texture_s3tc")||l.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||l.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");null===Fa&&console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");Ra=l.getExtension("WEBGL_compressed_texture_pvrtc")||l.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");null===Ra&&console.log("THREE.WebGLRenderer: PVRTC compressed textures not supported.");ub=l.getExtension("OES_element_index_uint");null===ub&&console.log("THREE.WebGLRenderer: elementindex as unsigned integer not supported.");
|
|
|
+Za=l.getExtension("EXT_blend_minmax");null===Za&&console.log("THREE.WebGLRenderer: min max blend equations not supported.");void 0===l.getShaderPrecisionFormat&&(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});Ja&&l.getExtension("EXT_frag_depth")})();l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,
|
|
|
+l.ONE_MINUS_SRC_ALPHA);l.viewport(mc,ob,ib,Lb);l.clearColor(la.r,la.g,la.b,Ka);this.context=l;var Lc=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),Xc=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Yc=l.getParameter(l.MAX_TEXTURE_SIZE),Wc=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),Qc=lb?l.getParameter(lb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,hc=0<Xc,gc=hc&&sb,lc=[];if(Ra||Fa)for(var Rc=l.getParameter(l.COMPRESSED_TEXTURE_FORMATS),uc=0;uc<Rc.length;uc++)lc.push(Rc[uc]);var Zc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,
|
|
|
+l.HIGH_FLOAT),$c=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);var ad=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT),bd=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);var cd=0<Zc.precision&&0<ad.precision,Sc=0<$c.precision&&0<bd.precision;"highp"!==L||cd||(Sc?(L="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(L=
|
|
|
+"lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")));"mediump"!==L||Sc||(L="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));this.getContext=function(){return l};this.supportsVertexTextures=function(){return hc};this.supportsFloatTextures=function(){return sb};this.supportsStandardDerivatives=function(){return tc};this.supportsCompressedTextureS3TC=function(){return Fa};this.supportsCompressedTexturePVRTC=function(){return Ra};this.supportsBlendMinMax=
|
|
|
+function(){return Za};this.getMaxAnisotropy=function(){return Qc};this.getPrecision=function(){return L};this.setSize=function(a,b,c){P.width=a*this.devicePixelRatio;P.height=b*this.devicePixelRatio;!1!==c&&(P.style.width=a+"px",P.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){mc=a*this.devicePixelRatio;ob=b*this.devicePixelRatio;ib=c*this.devicePixelRatio;Lb=d*this.devicePixelRatio;l.viewport(mc,ob,ib,Lb)};this.setScissor=function(a,b,c,d){l.scissor(a*this.devicePixelRatio,
|
|
|
+b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColor=function(a,b){la.set(a);Ka=void 0!==b?b:1;l.clearColor(la.r,la.g,la.b,Ka)};this.setClearColorHex=function(a,b){console.warn("THREE.WebGLRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return la};this.getClearAlpha=function(){return Ka};
|
|
|
+this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=l.COLOR_BUFFER_BIT;if(void 0===b||b)d|=l.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearColor=function(){l.clear(l.COLOR_BUFFER_BIT)};this.clearDepth=function(){l.clear(l.DEPTH_BUFFER_BIT)};this.clearStencil=function(){l.clear(l.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this,Da,ab,Ga);this.renderPluginsPost.push(a)};
|
|
|
+this.addPrePlugin=function(a){a.init(this,Da,ab,Ga);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){vb=null;tb=Ia=Yb=Fb=nb=-1;Wb=!0;mb=Kb=-1;this.shadowMapPlugin.update(a,b)};var Dc=function(a){a.target.traverse(function(a){a.removeEventListener("remove",Dc);if(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)delete ab[a.id];else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var b=Ga,c=b.length-1;0<=c;c--)b[c].object===
|
|
|
+a&&b.splice(c,1);delete a.__webglInit;delete a._modelViewMatrix;delete a._normalMatrix;delete a.__webglActive})},Ec=function(a){a=a.target;a.removeEventListener("dispose",Ec);delete a.__webglInit;if(a instanceof THREE.BufferGeometry){for(var b in a.attributes){var c=a.attributes[b];void 0!==c.buffer&&(l.deleteBuffer(c.buffer),delete c.buffer)}J.info.memory.geometries--}else if(void 0!==a.geometryGroups)for(b=0,c=a.geometryGroupsList.length;b<c;b++){var d=a.geometryGroupsList[b];if(void 0!==d.numMorphTargets){for(var e=
|
|
|
+0,f=d.numMorphTargets;e<f;e++)l.deleteBuffer(d.__webglMorphTargetsBuffers[e]);delete d.__webglMorphTargetsBuffers}if(void 0!==d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)l.deleteBuffer(d.__webglMorphNormalsBuffers[e]);delete d.__webglMorphNormalsBuffers}Tc(d)}else Tc(a);Ia=-1},kc=function(a){a=a.target;a.removeEventListener("dispose",kc);a.image&&a.image.__webglTextureCube?(l.deleteTexture(a.image.__webglTextureCube),delete a.image.__webglTextureCube):void 0!==a.__webglInit&&(l.deleteTexture(a.__webglTexture),
|
|
|
+delete a.__webglTexture,delete a.__webglInit);J.info.memory.textures--},Uc=function(a){a=a.target;a.removeEventListener("dispose",Uc);if(a&&void 0!==a.__webglTexture){l.deleteTexture(a.__webglTexture);delete a.__webglTexture;if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)l.deleteFramebuffer(a.__webglFramebuffer[b]),l.deleteRenderbuffer(a.__webglRenderbuffer[b]);else l.deleteFramebuffer(a.__webglFramebuffer),l.deleteRenderbuffer(a.__webglRenderbuffer);delete a.__webglFramebuffer;delete a.__webglRenderbuffer}J.info.memory.textures--},
|
|
|
+Jc=function(a){a=a.target;a.removeEventListener("dispose",Jc);Ic(a)},Tc=function(a){for(var b="__webglVertexBuffer __webglNormalBuffer __webglTangentBuffer __webglColorBuffer __webglUVBuffer __webglUV2Buffer __webglSkinIndicesBuffer __webglSkinWeightsBuffer __webglFaceBuffer __webglLineBuffer __webglLineDistanceBuffer".split(" "),c=0,d=b.length;c<d;c++){var e=b[c];void 0!==a[e]&&(l.deleteBuffer(a[e]),delete a[e])}if(void 0!==a.__webglCustomAttributesList){for(e in a.__webglCustomAttributesList)l.deleteBuffer(a.__webglCustomAttributesList[e].buffer);
|
|
|
+delete a.__webglCustomAttributesList}J.info.memory.geometries--},Ic=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=Wa.length;a<c;a++)if(d=Wa[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Wa.length;a<c;a++)d=Wa[a],d.program!==b&&e.push(d);Wa=e;l.deleteProgram(b);J.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){g();a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=l.createBuffer());
|
|
|
+a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=l.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=l.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=l.createBuffer());a.hasPositions&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,a.positionArray,l.DYNAMIC_DRAW),f(b.attributes.position),l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormals){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);
|
|
|
+if(c.shading===THREE.FlatShading){var d,e,k,m,n,p,q,s,t,r,u,w=3*a.count;for(u=0;u<w;u+=9)r=a.normalArray,d=r[u],e=r[u+1],k=r[u+2],m=r[u+3],p=r[u+4],s=r[u+5],n=r[u+6],q=r[u+7],t=r[u+8],d=(d+m+n)/3,e=(e+p+q)/3,k=(k+s+t)/3,r[u]=d,r[u+1]=e,r[u+2]=k,r[u+3]=d,r[u+4]=e,r[u+5]=k,r[u+6]=d,r[u+7]=e,r[u+8]=k}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);f(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglUvBuffer),
|
|
|
+l.bufferData(l.ARRAY_BUFFER,a.uvArray,l.DYNAMIC_DRAW),f(b.attributes.uv),l.vertexAttribPointer(b.attributes.uv,2,l.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,a.colorArray,l.DYNAMIC_DRAW),f(b.attributes.color),l.vertexAttribPointer(b.attributes.color,3,l.FLOAT,!1,0,0));h();l.drawArrays(l.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,h){if(!1!==d.visible)if(a=x(a,b,c,d,h),b=
|
|
|
+!1,c=16777215*f.id+2*a.id+(d.wireframe?1:0),c!==Ia&&(Ia=c,b=!0),b&&g(),h instanceof THREE.Mesh)if(h=!0===d.wireframe?l.LINES:l.TRIANGLES,c=f.attributes.index){var k,m;c.array instanceof Uint32Array?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2);var n=f.offsets;if(0===n.length)b&&(e(d,a,f,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),J.info.render.calls++,J.info.render.vertices+=c.array.length,J.info.render.faces+=c.array.length/3;else{b=!0;for(var p=0,q=n.length;p<
|
|
|
+q;p++){var s=n[p].index;b&&(e(d,a,f,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer));l.drawElements(h,n[p].count,k,n[p].start*m);J.info.render.calls++;J.info.render.vertices+=n[p].count;J.info.render.faces+=n[p].count/3}}}else b&&e(d,a,f,0),d=f.attributes.position,l.drawArrays(h,0,d.array.length/3),J.info.render.calls++,J.info.render.vertices+=d.array.length/3,J.info.render.faces+=d.array.length/9;else if(h instanceof THREE.PointCloud)b&&e(d,a,f,0),d=f.attributes.position,l.drawArrays(l.POINTS,0,
|
|
|
+d.array.length/3),J.info.render.calls++,J.info.render.points+=d.array.length/3;else if(h instanceof THREE.Line)if(h=h.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,R(d.linewidth),c=f.attributes.index)if(c.array instanceof Uint32Array?(k=l.UNSIGNED_INT,m=4):(k=l.UNSIGNED_SHORT,m=2),n=f.offsets,0===n.length)b&&(e(d,a,f,0),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,c.array.length,k,0),J.info.render.calls++,J.info.render.vertices+=c.array.length;else for(1<n.length&&(b=!0),p=0,q=n.length;p<
|
|
|
+q;p++)s=n[p].index,b&&(e(d,a,f,s),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,c.buffer)),l.drawElements(h,n[p].count,k,n[p].start*m),J.info.render.calls++,J.info.render.vertices+=n[p].count;else b&&e(d,a,f,0),d=f.attributes.position,l.drawArrays(h,0,d.array.length/3),J.info.render.calls++,J.info.render.points+=d.array.length/3};this.renderBuffer=function(a,b,c,d,e,k){if(!1!==d.visible){var m,n;c=x(a,b,c,d,k);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Ia&&(Ia=c,a=!0);a&&g();if(!d.morphTargets&&
|
|
|
+0<=b.position)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),f(b.position),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(k.morphTargetBase){c=d.program.attributes;-1!==k.morphTargetBase&&0<=c.position?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k.morphTargetBase]),f(c.position),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0)):0<=c.position&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),f(c.position),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length){var q=
|
|
|
+0;n=k.morphTargetForcedOrder;for(m=k.morphTargetInfluences;q<d.numSupportedMorphTargets&&q<n.length;)0<=c["morphTarget"+q]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n[q]]),f(c["morphTarget"+q]),l.vertexAttribPointer(c["morphTarget"+q],3,l.FLOAT,!1,0,0)),0<=c["morphNormal"+q]&&d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n[q]]),f(c["morphNormal"+q]),l.vertexAttribPointer(c["morphNormal"+q],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[q]=m[n[q]],q++}else{n=
|
|
|
+[];m=k.morphTargetInfluences;var s,r=m.length;for(s=0;s<r;s++)q=m[s],0<q&&n.push([q,s]);n.length>d.numSupportedMorphTargets?(n.sort(p),n.length=d.numSupportedMorphTargets):n.length>d.numSupportedMorphNormals?n.sort(p):0===n.length&&n.push([0,0]);for(q=0;q<d.numSupportedMorphTargets;)n[q]?(s=n[q][1],0<=c["morphTarget"+q]&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[s]),f(c["morphTarget"+q]),l.vertexAttribPointer(c["morphTarget"+q],3,l.FLOAT,!1,0,0)),0<=c["morphNormal"+q]&&d.morphNormals&&
|
|
|
+(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[s]),f(c["morphNormal"+q]),l.vertexAttribPointer(c["morphNormal"+q],3,l.FLOAT,!1,0,0)),k.__webglMorphTargetInfluences[q]=m[s]):k.__webglMorphTargetInfluences[q]=0,q++}null!==d.program.uniforms.morphTargetInfluences&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(m=0,n=e.__webglCustomAttributesList.length;m<n;m++)c=e.__webglCustomAttributesList[m],0<=b[c.buffer.belongsToAttribute]&&
|
|
|
+(l.bindBuffer(l.ARRAY_BUFFER,c.buffer),f(b[c.buffer.belongsToAttribute]),l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,!1,0,0));0<=b.color&&(0<k.geometry.colors.length||0<k.geometry.faces.length?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),f(b.color),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib3fv(b.color,d.defaultAttributeValues.color));0<=b.normal&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),f(b.normal),l.vertexAttribPointer(b.normal,
|
|
|
+3,l.FLOAT,!1,0,0));0<=b.tangent&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglTangentBuffer),f(b.tangent),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));0<=b.uv&&(k.geometry.faceVertexUvs[0]?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer),f(b.uv),l.vertexAttribPointer(b.uv,2,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv,d.defaultAttributeValues.uv));0<=b.uv2&&(k.geometry.faceVertexUvs[1]?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer),f(b.uv2),l.vertexAttribPointer(b.uv2,
|
|
|
+2,l.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&l.vertexAttrib2fv(b.uv2,d.defaultAttributeValues.uv2));d.skinning&&0<=b.skinIndex&&0<=b.skinWeight&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),f(b.skinIndex),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),f(b.skinWeight),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0));0<=b.lineDistance&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglLineDistanceBuffer),f(b.lineDistance),l.vertexAttribPointer(b.lineDistance,
|
|
|
+1,l.FLOAT,!1,0,0))}h();k instanceof THREE.Mesh?(k=e.__typeArray===Uint32Array?l.UNSIGNED_INT:l.UNSIGNED_SHORT,d.wireframe?(R(d.wireframeLinewidth),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,k,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,k,0)),J.info.render.calls++,J.info.render.vertices+=e.__webglFaceCount,J.info.render.faces+=e.__webglFaceCount/3):k instanceof THREE.Line?(k=
|
|
|
+k.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,R(d.linewidth),l.drawArrays(k,0,e.__webglLineCount),J.info.render.calls++):k instanceof THREE.PointCloud&&(l.drawArrays(l.POINTS,0,e.__webglParticleCount),J.info.render.calls++,J.info.render.points+=e.__webglParticleCount)}};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,f,g,h=a.fog;tb=-1;Vb=null;Wb=!0;!0===a.autoUpdate&&a.updateMatrixWorld();
|
|
|
+void 0===b.parent&&b.updateMatrixWorld();a.traverse(function(a){a instanceof THREE.SkinnedMesh&&a.skeleton.update()});b.matrixWorldInverse.getInverse(b.matrixWorld);xc.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);zc.setFromMatrix(xc);Da.length=0;$a.length=0;jb.length=0;m(a,a);!0===J.sortObjects&&($a.sort(k),jb.sort(n));q(this.renderPluginsPre,a,b);J.info.render.calls=0;J.info.render.vertices=0;J.info.render.faces=0;J.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
|
|
|
+this.autoClearDepth,this.autoClearStencil);d=0;for(e=Ga.length;d<e;d++)f=Ga[d],g=f.object,g.visible&&(B(g,b),r(f));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),I(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),t($a,b,Da,h,!0,d),t(jb,b,Da,h,!0,d),s(Ga,"",b,Da,h,!1,d)):(d=null,this.setBlending(THREE.NoBlending),t($a,b,Da,h,!1,d),s(Ga,"opaque",b,Da,h,!1,d),t(jb,b,
|
|
|
+Da,h,!0,d),s(Ga,"transparent",b,Da,h,!0,d));q(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&U(c);this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=x(a,b,c,d,e);Ia=-1;J.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,l,zc):e.render(function(a){J.renderBufferImmediate(a,f,d)})};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};
|
|
|
+this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?l.disable(l.CULL_FACE):(b===THREE.FrontFaceDirectionCW?l.frontFace(l.CW):l.frontFace(l.CCW),a===THREE.CullFaceBack?l.cullFace(l.BACK):a===THREE.CullFaceFront?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide;a=a.side===THREE.BackSide;Kb!==b&&(b?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),Kb=b);mb!==a&&(a?l.frontFace(l.CW):l.frontFace(l.CCW),mb=a)};this.setDepthTest=
|
|
|
+function(a){Fb!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),Fb=a)};this.setDepthWrite=function(a){Yb!==a&&(l.depthMask(a),Yb=a)};this.setBlending=function(a,b,c,d){a!==nb&&(a===THREE.NoBlending?l.disable(l.BLEND):a===THREE.AdditiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.SRC_ALPHA,l.ONE)):a===THREE.SubtractiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),
|
|
|
+l.blendFunc(l.ZERO,l.SRC_COLOR)):a===THREE.CustomBlending?l.enable(l.BLEND):(l.enable(l.BLEND),l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)),nb=a);if(a===THREE.CustomBlending){if(b!==Db&&(l.blendEquation(V(b)),Db=b),c!==Eb||d!==Xb)l.blendFunc(V(c),V(d)),Eb=c,Xb=d}else Xb=Eb=Db=null};this.uploadTexture=function(a){void 0===a.__webglInit&&(a.__webglInit=!0,a.addEventListener("dispose",kc),a.__webglTexture=l.createTexture(),
|
|
|
+J.info.memory.textures++);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);l.pixelStorei(l.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=C(a.image,Yc);var b=a.image,c=THREE.Math.isPowerOfTwo(b.width)&&THREE.Math.isPowerOfTwo(b.height),d=V(a.format),e=V(a.type);O(l.TEXTURE_2D,a,c);var f=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<f.length&&c){for(var g=0,h=f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,
|
|
|
+g,d,b.width,b.height,0,d,e,b.data);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,b.width,b.height,0,d,e,b.data);else if(a instanceof THREE.CompressedTexture)for(g=0,h=f.length;g<h;g++)b=f[g],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<lc.indexOf(d)?l.compressedTexImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,b.data):console.warn("Attempt to load unsupported compressed texture format"):l.texImage2D(l.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);else if(0<f.length&&c){g=0;for(h=
|
|
|
+f.length;g<h;g++)b=f[g],l.texImage2D(l.TEXTURE_2D,g,d,d,e,b);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,d,d,e,a.image);a.generateMipmaps&&c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()};this.setTexture=function(a,b){l.activeTexture(l.TEXTURE0+b);a.needsUpdate?J.uploadTexture(a):l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===a.__webglFramebuffer){void 0===a.depthBuffer&&
|
|
|
+(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Uc);a.__webglTexture=l.createTexture();J.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=V(a.format),e=V(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);O(l.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=l.createFramebuffer();a.__webglRenderbuffer[f]=l.createRenderbuffer();
|
|
|
+l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=l.TEXTURE_CUBE_MAP_POSITIVE_X+f;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[f]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,h,g.__webglTexture,0);W(a.__webglRenderbuffer[f],a)}c&&l.generateMipmap(l.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),
|
|
|
+O(l.TEXTURE_2D,a,c),l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):
|
|
|
+W(a.__webglRenderbuffer,a),c&&l.generateMipmap(l.TEXTURE_2D);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=ib,a=Lb,d=mc,e=ob);b!==Zb&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),Zb=b);Gc=c;Hc=a};this.resetGLState=function(){Vb=vb=null;tb=Ia=mb=Kb=Yb=Fb=nb=-1;Wb=!0};this.shadowMapPlugin=
|
|
|
+new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
|
|
|
THREE.WebGLRenderTarget=function(a,b,c){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=null};
|
|
|
THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(a,b){this.width=a;this.height=b},clone:function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;
|