|
@@ -468,7 +468,7 @@ g in n||(l={id:ib++,faces3:[],materialIndex:t,vertices:0,numMorphTargets:k,numMo
|
|
|
a,q.DYNAMIC_DRAW,!c.dynamic,h)}c.verticesNeedUpdate=!1;c.morphTargetsNeedUpdate=!1;c.elementsNeedUpdate=!1;c.uvsNeedUpdate=!1;c.normalsNeedUpdate=!1;c.colorsNeedUpdate=!1;c.tangentsNeedUpdate=!1;h.attributes&&t(h)}else a instanceof THREE.Line?(h=b(a,c),k=h.attributes&&r(h),(c.verticesNeedUpdate||c.colorsNeedUpdate||c.lineDistancesNeedUpdate||k)&&za.setLineBuffers(c,q.DYNAMIC_DRAW),c.verticesNeedUpdate=!1,c.colorsNeedUpdate=!1,c.lineDistancesNeedUpdate=!1,h.attributes&&t(h)):a instanceof THREE.PointCloud&&
|
|
|
(h=b(a,c),k=h.attributes&&r(h),(c.verticesNeedUpdate||c.colorsNeedUpdate||k)&&za.setPointCloudBuffers(c,q.DYNAMIC_DRAW,a),c.verticesNeedUpdate=!1,c.colorsNeedUpdate=!1,h.attributes&&t(h))}function r(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function s(a){!0===a.transparent?U.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst,a.blendEquationAlpha,a.blendSrcAlpha,a.blendDstAlpha):U.setBlending(THREE.NoBlending);
|
|
|
U.setDepthTest(a.depthTest);U.setDepthWrite(a.depthWrite);U.setColorWrite(a.colorWrite);U.setPolygonOffset(a.polygonOffset,a.polygonOffsetFactor,a.polygonOffsetUnits)}function u(a,b,c,d,e){var f,g,h,k;jb=0;if(d.needsUpdate){d.program&&Mb(d);d.addEventListener("dispose",Nb);var m=Wb[d.type];if(m){var l=THREE.ShaderLib[m];d.__webglShader={uniforms:THREE.UniformsUtils.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}}else d.__webglShader={uniforms:d.uniforms,vertexShader:d.vertexShader,
|
|
|
-fragmentShader:d.fragmentShader};for(var n=0,p=0,r=0,s=0,t=0,u=b.length;t<u;t++){var z=b[t];z.onlyShadow||!1===z.visible||(z instanceof THREE.DirectionalLight&&n++,z instanceof THREE.PointLight&&p++,z instanceof THREE.SpotLight&&r++,z instanceof THREE.HemisphereLight&&s++)}f=n;g=p;h=r;k=s;for(var y,A=0,B=0,F=b.length;B<F;B++){var D=b[B];D.castShadow&&(D instanceof THREE.SpotLight&&A++,D instanceof THREE.DirectionalLight&&!D.shadowCascade&&A++)}y=A;var M;if(rb&&e&&e.skeleton&&e.skeleton.useVertexTexture)M=
|
|
|
+fragmentShader:d.fragmentShader};for(var n=0,p=0,r=0,t=0,s=0,u=b.length;s<u;s++){var z=b[s];z.onlyShadow||!1===z.visible||(z instanceof THREE.DirectionalLight&&n++,z instanceof THREE.PointLight&&p++,z instanceof THREE.SpotLight&&r++,z instanceof THREE.HemisphereLight&&t++)}f=n;g=p;h=r;k=t;for(var y,A=0,B=0,F=b.length;B<F;B++){var D=b[B];D.castShadow&&(D instanceof THREE.SpotLight&&A++,D instanceof THREE.DirectionalLight&&!D.shadowCascade&&A++)}y=A;var M;if(rb&&e&&e.skeleton&&e.skeleton.useVertexTexture)M=
|
|
|
1024;else{var J=q.getParameter(q.MAX_VERTEX_UNIFORM_VECTORS),N=Math.floor((J-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(N=Math.min(e.skeleton.bones.length,N),N<e.skeleton.bones.length&&THREE.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+N+" (try OpenGL instead of ANGLE)"));M=N}var O={precision:G,supportsVertexTextures:sb,map:!!d.map,envMap:!!d.envMap,envMapMode:d.envMap&&d.envMap.mapping,lightMap:!!d.lightMap,aoMap:!!d.aoMap,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:na,skinning:d.skinning,maxBones:M,useVertexTexture:rb&&e&&e.skeleton&&e.skeleton.useVertexTexture,morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:Q.maxMorphTargets,maxMorphNormals:Q.maxMorphNormals,maxDirLights:f,
|
|
|
maxPointLights:g,maxSpotLights:h,maxHemiLights:k,maxShadows:y,shadowMapEnabled:oa.enabled&&e.receiveShadow&&0<y,shadowMapType:oa.type,shadowMapDebug:oa.debug,shadowMapCascade:oa.cascade,alphaTest:d.alphaTest,metal:d.metal,wrapAround:d.wrapAround,doubleSided:d.side===THREE.DoubleSide,flipSided:d.side===THREE.BackSide},K=[];m?K.push(m):(K.push(d.fragmentShader),K.push(d.vertexShader));if(void 0!==d.defines)for(var L in d.defines)K.push(L),K.push(d.defines[L]);for(L in O)K.push(L),K.push(O[L]);for(var P=
|
|
@@ -526,7 +526,7 @@ delete e.__webglMorphTargetsBuffers}if(void 0!==e.numMorphNormals){f=0;for(g=e.n
|
|
|
delete a.__webglInit);Q.info.memory.textures--},qb=function(a){a=a.target;a.removeEventListener("dispose",qb);if(a&&void 0!==a.__webglTexture){q.deleteTexture(a.__webglTexture);delete a.__webglTexture;if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)q.deleteFramebuffer(a.__webglFramebuffer[b]),q.deleteRenderbuffer(a.__webglRenderbuffer[b]);else q.deleteFramebuffer(a.__webglFramebuffer),q.deleteRenderbuffer(a.__webglRenderbuffer);delete a.__webglFramebuffer;delete a.__webglRenderbuffer}Q.info.memory.textures--},
|
|
|
Nb=function(a){a=a.target;a.removeEventListener("dispose",Nb);Mb(a)},Mb=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=va.length;a<c;a++)if(d=va[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=va.length;a<c;a++)d=va[a],d.program!==b&&e.push(d);va=e;q.deleteProgram(b);Q.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){U.initAttributes();a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=
|
|
|
q.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=q.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=q.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=q.createBuffer());a.hasPositions&&(q.bindBuffer(q.ARRAY_BUFFER,a.__webglVertexBuffer),q.bufferData(q.ARRAY_BUFFER,a.positionArray,q.DYNAMIC_DRAW),U.enableAttribute(b.attributes.position),q.vertexAttribPointer(b.attributes.position,3,q.FLOAT,!1,0,0));if(a.hasNormals){q.bindBuffer(q.ARRAY_BUFFER,
|
|
|
-a.__webglNormalBuffer);if(!1===c instanceof THREE.MeshPhongMaterial&&c.shading===THREE.FlatShading){var d,e,f,g,h,k,m,l,n,p,r,s=3*a.count;for(r=0;r<s;r+=9)p=a.normalArray,d=p[r],e=p[r+1],f=p[r+2],g=p[r+3],k=p[r+4],l=p[r+5],h=p[r+6],m=p[r+7],n=p[r+8],d=(d+g+h)/3,e=(e+k+m)/3,f=(f+l+n)/3,p[r]=d,p[r+1]=e,p[r+2]=f,p[r+3]=d,p[r+4]=e,p[r+5]=f,p[r+6]=d,p[r+7]=e,p[r+8]=f}q.bufferData(q.ARRAY_BUFFER,a.normalArray,q.DYNAMIC_DRAW);U.enableAttribute(b.attributes.normal);q.vertexAttribPointer(b.attributes.normal,
|
|
|
+a.__webglNormalBuffer);if(!1===c instanceof THREE.MeshPhongMaterial&&c.shading===THREE.FlatShading){var d,e,f,g,h,k,m,l,n,p,r,t=3*a.count;for(r=0;r<t;r+=9)p=a.normalArray,d=p[r],e=p[r+1],f=p[r+2],g=p[r+3],k=p[r+4],l=p[r+5],h=p[r+6],m=p[r+7],n=p[r+8],d=(d+g+h)/3,e=(e+k+m)/3,f=(f+l+n)/3,p[r]=d,p[r+1]=e,p[r+2]=f,p[r+3]=d,p[r+4]=e,p[r+5]=f,p[r+6]=d,p[r+7]=e,p[r+8]=f}q.bufferData(q.ARRAY_BUFFER,a.normalArray,q.DYNAMIC_DRAW);U.enableAttribute(b.attributes.normal);q.vertexAttribPointer(b.attributes.normal,
|
|
|
3,q.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(q.bindBuffer(q.ARRAY_BUFFER,a.__webglUvBuffer),q.bufferData(q.ARRAY_BUFFER,a.uvArray,q.DYNAMIC_DRAW),U.enableAttribute(b.attributes.uv),q.vertexAttribPointer(b.attributes.uv,2,q.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(q.bindBuffer(q.ARRAY_BUFFER,a.__webglColorBuffer),q.bufferData(q.ARRAY_BUFFER,a.colorArray,q.DYNAMIC_DRAW),U.enableAttribute(b.attributes.color),q.vertexAttribPointer(b.attributes.color,3,q.FLOAT,!1,0,0));U.disableUnusedAttributes();
|
|
|
q.drawArrays(q.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,d,e,f,g){if(!1!==e.visible)if(m(g),a=u(a,b,d,e,g),b=!1,d="direct_"+f.id+"_"+a.id+"_"+(e.wireframe?1:0),d!==ma&&(ma=d,b=!0),b&&U.initAttributes(),g instanceof THREE.Mesh){g=!0===e.wireframe?q.LINES:q.TRIANGLES;var h=f.attributes.index;if(h){var k,l;h.array instanceof Uint32Array&&ba.get("OES_element_index_uint")?(k=q.UNSIGNED_INT,l=4):(k=q.UNSIGNED_SHORT,l=2);d=f.offsets;if(0===d.length)b&&(c(e,a,f,0),q.bindBuffer(q.ELEMENT_ARRAY_BUFFER,
|
|
|
h.buffer)),q.drawElements(g,h.array.length,k,0),Q.info.render.calls++,Q.info.render.vertices+=h.array.length,Q.info.render.faces+=h.array.length/3;else{b=!0;for(var n=0,p=d.length;n<p;n++){var r=d[n].index;b&&(c(e,a,f,r),q.bindBuffer(q.ELEMENT_ARRAY_BUFFER,h.buffer));q.drawElements(g,d[n].count,k,d[n].start*l);Q.info.render.calls++;Q.info.render.vertices+=d[n].count;Q.info.render.faces+=d[n].count/3}}}else b&&c(e,a,f,0),e=f.attributes.position,q.drawArrays(g,0,e.array.length/e.itemSize),Q.info.render.calls++,
|
|
@@ -553,9 +553,9 @@ g.length&&d){for(var h=0,k=g.length;h<k;h++)c=g[h],q.texImage2D(q.TEXTURE_2D,h,e
|
|
|
q.texImage2D(q.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);else if(0<g.length&&d){h=0;for(k=g.length;h<k;h++)c=g[h],q.texImage2D(q.TEXTURE_2D,h,e,e,f,c);a.generateMipmaps=!1}else q.texImage2D(q.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&q.generateMipmap(q.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate(a)};this.setTexture=function(a,b){!0===a.needsUpdate?!1===a.image.complete?THREE.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",a):Q.uploadTexture(a,b):
|
|
|
(q.activeTexture(q.TEXTURE0+b),q.bindTexture(q.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",qb);a.__webglTexture=q.createTexture();Q.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=E(a.format),e=E(a.type);if(b){a.__webglFramebuffer=
|
|
|
[];a.__webglRenderbuffer=[];q.bindTexture(q.TEXTURE_CUBE_MAP,a.__webglTexture);I(q.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=q.createFramebuffer();a.__webglRenderbuffer[f]=q.createRenderbuffer();q.texImage2D(q.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=q.TEXTURE_CUBE_MAP_POSITIVE_X+f;q.bindFramebuffer(q.FRAMEBUFFER,a.__webglFramebuffer[f]);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,h,g.__webglTexture,0);y(a.__webglRenderbuffer[f],
|
|
|
-a)}c&&q.generateMipmap(q.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=q.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:q.createRenderbuffer(),q.bindTexture(q.TEXTURE_2D,a.__webglTexture),I(q.TEXTURE_2D,a,c),q.texImage2D(q.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=q.TEXTURE_2D,q.bindFramebuffer(q.FRAMEBUFFER,a.__webglFramebuffer),q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?
|
|
|
-q.framebufferRenderbuffer(q.FRAMEBUFFER,q.DEPTH_ATTACHMENT,q.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&q.framebufferRenderbuffer(q.FRAMEBUFFER,q.DEPTH_STENCIL_ATTACHMENT,q.RENDERBUFFER,a.__webglRenderbuffer):y(a.__webglRenderbuffer,a),c&&q.generateMipmap(q.TEXTURE_2D);b?q.bindTexture(q.TEXTURE_CUBE_MAP,null):q.bindTexture(q.TEXTURE_2D,null);q.bindRenderbuffer(q.RENDERBUFFER,null);q.bindFramebuffer(q.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,
|
|
|
-c=a.width,a=a.height,e=d=0):(b=null,c=Ra,a=Sa,d=Ha,e=Ia);b!==ta&&(q.bindFramebuffer(q.FRAMEBUFFER,b),q.viewport(d,e,c,a),ta=b);ob=c;pb=a};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!(a instanceof THREE.WebGLRenderTarget))THREE.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else if(a.__webglFramebuffer)if(a.format!==THREE.RGBAFormat)THREE.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");
|
|
|
+a)}a.generateMipmaps&&c&&q.generateMipmap(q.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=q.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:q.createRenderbuffer(),q.bindTexture(q.TEXTURE_2D,a.__webglTexture),I(q.TEXTURE_2D,a,c),q.texImage2D(q.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=q.TEXTURE_2D,q.bindFramebuffer(q.FRAMEBUFFER,a.__webglFramebuffer),q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&
|
|
|
+!a.stencilBuffer?q.framebufferRenderbuffer(q.FRAMEBUFFER,q.DEPTH_ATTACHMENT,q.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&q.framebufferRenderbuffer(q.FRAMEBUFFER,q.DEPTH_STENCIL_ATTACHMENT,q.RENDERBUFFER,a.__webglRenderbuffer):y(a.__webglRenderbuffer,a),a.generateMipmaps&&c&&q.generateMipmap(q.TEXTURE_2D);b?q.bindTexture(q.TEXTURE_CUBE_MAP,null):q.bindTexture(q.TEXTURE_2D,null);q.bindRenderbuffer(q.RENDERBUFFER,null);q.bindFramebuffer(q.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:
|
|
|
+a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Ra,a=Sa,d=Ha,e=Ia);b!==ta&&(q.bindFramebuffer(q.FRAMEBUFFER,b),q.viewport(d,e,c,a),ta=b);ob=c;pb=a};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!(a instanceof THREE.WebGLRenderTarget))THREE.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else if(a.__webglFramebuffer)if(a.format!==THREE.RGBAFormat)THREE.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");
|
|
|
else{var g=!1;a.__webglFramebuffer!==ta&&(q.bindFramebuffer(q.FRAMEBUFFER,a.__webglFramebuffer),g=!0);q.checkFramebufferStatus(q.FRAMEBUFFER)===q.FRAMEBUFFER_COMPLETE?q.readPixels(b,c,d,e,q.RGBA,q.UNSIGNED_BYTE,f):THREE.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.");g&&q.bindFramebuffer(q.FRAMEBUFFER,ta)}};this.initMaterial=function(){THREE.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};this.addPrePlugin=function(){THREE.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};
|
|
|
this.addPostPlugin=function(){THREE.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};this.updateShadowMap=function(){THREE.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Object.defineProperties(this,{shadowMapEnabled:{get:function(){return oa.enabled},set:function(a){THREE.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.");oa.enabled=a}},shadowMapType:{get:function(){return oa.type},set:function(a){THREE.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.");
|
|
|
oa.type=a}},shadowMapCullFace:{get:function(){return oa.cullFace},set:function(a){THREE.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.");oa.cullFace=a}},shadowMapDebug:{get:function(){return oa.debug},set:function(a){THREE.warn("THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug.");oa.debug=a}},shadowMapCascade:{get:function(){return oa.cascade},set:function(a){THREE.warn("THREE.WebGLRenderer: .shadowMapCascade is now .shadowMap.cascade.");oa.cascade=a}}})};
|
|
@@ -618,8 +618,8 @@ B.lookAt(n);B.updateMatrixWorld();B.matrixWorldInverse.getInverse(B.matrixWorld)
|
|
|
THREE.MeshFaceMaterial?E.material.materials[0]:E.material,N=void 0!==E.geometry.morphTargets&&0<E.geometry.morphTargets.length&&J.morphTargets,G=E instanceof THREE.SkinnedMesh&&J.skinning,N=E.customDepthMaterial?E.customDepthMaterial:G?N?v:u:N?s:t,a.setMaterialFaces(J),C instanceof THREE.BufferGeometry?a.renderBufferDirect(B,b,null,N,C,E):a.renderBuffer(B,b,null,N,C,E);y=0;for(F=d.length;y<F;y++)C=d[y],E=C.object,E.visible&&E.castShadow&&(E._modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,E.matrixWorld),
|
|
|
a.renderImmediateObject(B,b,null,t,E))}r=a.getClearColor();H=a.getClearAlpha();f.clearColor(r.r,r.g,r.b,H);f.enable(f.BLEND);x.cullFace===THREE.CullFaceFront&&f.cullFace(f.BACK);a.resetGLState()}}};
|
|
|
THREE.WebGLState=function(a,b){var c=new Uint8Array(16),d=new Uint8Array(16),e=null,f=null,g=null,h=null,k=null,l=null,n=null,p=null,m=null,r=null,t=null,s=null,u=null,v=null,x=null,z=null;this.initAttributes=function(){for(var a=0,b=c.length;a<b;a++)c[a]=0};this.enableAttribute=function(b){c[b]=1;0===d[b]&&(a.enableVertexAttribArray(b),d[b]=1)};this.disableUnusedAttributes=function(){for(var b=0,e=d.length;b<e;b++)d[b]!==c[b]&&(a.disableVertexAttribArray(b),d[b]=0)};this.setBlending=function(c,d,
|
|
|
-m,p,r,s,t){c!==e&&(c===THREE.NoBlending?a.disable(a.BLEND):c===THREE.AdditiveBlending?(a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):c===THREE.SubtractiveBlending?(a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):c===THREE.MultiplyBlending?(a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):c===THREE.CustomBlending?a.enable(a.BLEND):(a.enable(a.BLEND),a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),
|
|
|
-a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)),e=c);if(c===THREE.CustomBlending){r=r||d;s=s||m;t=t||p;if(d!==f||r!==k)a.blendEquationSeparate(b(d),b(r)),f=d,k=r;if(m!==g||p!==h||s!==l||t!==n)a.blendFuncSeparate(b(m),b(p),b(s),b(t)),g=m,h=p,l=s,n=t}else n=l=k=h=g=f=null};this.setDepthTest=function(b){p!==b&&(b?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),p=b)};this.setDepthWrite=function(b){m!==b&&(a.depthMask(b),m=b)};this.setColorWrite=function(b){r!==b&&(a.colorMask(b,
|
|
|
+m,p,r,t,s){c!==e&&(c===THREE.NoBlending?a.disable(a.BLEND):c===THREE.AdditiveBlending?(a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):c===THREE.SubtractiveBlending?(a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):c===THREE.MultiplyBlending?(a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):c===THREE.CustomBlending?a.enable(a.BLEND):(a.enable(a.BLEND),a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),
|
|
|
+a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)),e=c);if(c===THREE.CustomBlending){r=r||d;t=t||m;s=s||p;if(d!==f||r!==k)a.blendEquationSeparate(b(d),b(r)),f=d,k=r;if(m!==g||p!==h||t!==l||s!==n)a.blendFuncSeparate(b(m),b(p),b(t),b(s)),g=m,h=p,l=t,n=s}else n=l=k=h=g=f=null};this.setDepthTest=function(b){p!==b&&(b?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),p=b)};this.setDepthWrite=function(b){m!==b&&(a.depthMask(b),m=b)};this.setColorWrite=function(b){r!==b&&(a.colorMask(b,
|
|
|
b,b,b),r=b)};this.setDoubleSided=function(b){t!==b&&(b?a.disable(a.CULL_FACE):a.enable(a.CULL_FACE),t=b)};this.setFlipSided=function(b){s!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),s=b)};this.setLineWidth=function(b){b!==u&&(a.lineWidth(b),u=b)};this.setPolygonOffset=function(b,c,d){v!==b&&(b?a.enable(a.POLYGON_OFFSET_FILL):a.disable(a.POLYGON_OFFSET_FILL),v=b);!b||x===c&&z===d||(a.polygonOffset(c,d),x=c,z=d)};this.reset=function(){for(var a=0;a<d.length;a++)d[a]=0;s=t=r=m=p=e=null}};
|
|
|
THREE.LensFlarePlugin=function(a,b){var c,d,e,f,g,h,k,l,n,p,m=a.context,r,t,s,u,v,x;this.render=function(z,w,I,H){if(0!==b.length){z=new THREE.Vector3;var y=H/I,F=.5*I,B=.5*H,E=16/H,C=new THREE.Vector2(E*y,E),N=new THREE.Vector3(1,1,0),K=new THREE.Vector2(1,1);if(void 0===s){var E=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),L=new Uint16Array([0,1,2,0,2,3]);r=m.createBuffer();t=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,r);m.bufferData(m.ARRAY_BUFFER,E,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,
|
|
|
t);m.bufferData(m.ELEMENT_ARRAY_BUFFER,L,m.STATIC_DRAW);v=m.createTexture();x=m.createTexture();m.bindTexture(m.TEXTURE_2D,v);m.texImage2D(m.TEXTURE_2D,0,m.RGB,16,16,0,m.RGB,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST);m.bindTexture(m.TEXTURE_2D,x);m.texImage2D(m.TEXTURE_2D,0,
|
|
@@ -742,10 +742,12 @@ THREE.CylinderGeometry=function(a,b,c,d,e,f,g,h){THREE.Geometry.call(this);this.
|
|
|
g);x.y=-s*c+k;x.z=u*Math.cos(v*h+g);this.vertices.push(x);r.push(this.vertices.length-1);t.push(new THREE.Vector2(v,1-s))}p.push(r);m.push(t)}c=(b-a)/c;for(l=0;l<d;l++)for(0!==a?(g=this.vertices[p[0][l]].clone(),h=this.vertices[p[0][l+1]].clone()):(g=this.vertices[p[1][l]].clone(),h=this.vertices[p[1][l+1]].clone()),g.setY(Math.sqrt(g.x*g.x+g.z*g.z)*c).normalize(),h.setY(Math.sqrt(h.x*h.x+h.z*h.z)*c).normalize(),n=0;n<e;n++){var r=p[n][l],t=p[n+1][l],s=p[n+1][l+1],u=p[n][l+1],v=g.clone(),x=g.clone(),
|
|
|
z=h.clone(),w=h.clone(),I=m[n][l].clone(),H=m[n+1][l].clone(),y=m[n+1][l+1].clone(),F=m[n][l+1].clone();this.faces.push(new THREE.Face3(r,t,u,[v,x,w]));this.faceVertexUvs[0].push([I,H,F]);this.faces.push(new THREE.Face3(t,s,u,[x.clone(),z,w.clone()]));this.faceVertexUvs[0].push([H.clone(),y,F.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,k,0)),l=0;l<d;l++)r=p[0][l],t=p[0][l+1],s=this.vertices.length-1,v=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,
|
|
|
1,0),I=m[0][l].clone(),H=m[0][l+1].clone(),y=new THREE.Vector2(H.x,0),this.faces.push(new THREE.Face3(r,t,s,[v,x,z])),this.faceVertexUvs[0].push([I,H,y]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-k,0)),l=0;l<d;l++)r=p[e][l+1],t=p[e][l],s=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),I=m[e][l+1].clone(),H=m[e][l].clone(),y=new THREE.Vector2(H.x,1),this.faces.push(new THREE.Face3(r,t,s,[v,x,z])),this.faceVertexUvs[0].push([I,
|
|
|
-H,y]);this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",a=a instanceof Array?a:[a],this.addShapeList(a,b),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
-THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
-THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||THREE.error("THREE.ExtrudeGeometry: vec does not exist");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=1,d=a.x-b.x,e=a.y-b.y,f=c.x-a.x,g=c.y-a.y,h=d*d+e*e;if(1E-10<Math.abs(d*g-e*f)){var k=Math.sqrt(h),m=Math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/m-h)*g-(c.y+f/m-b)*f)/(d*g-e*f);c=h+d*f-a.x;a=b+e*f-a.y;d=c*c+a*a;if(2>=d)return new THREE.Vector2(c,a);d=Math.sqrt(d/2)}else a=!1,1E-10<d?1E-10<f&&(a=!0):
|
|
|
--1E-10>d?-1E-10>f&&(a=!0):Math.sign(e)==Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(P=a.length;0<=--P;){c=P;d=P-1;0>d&&(d=a.length-1);for(var e=0,f=r+2*n,e=0;e<f;e++){var g=D*e,h=D*(e+1),k=b+c+g,g=b+d+g,m=b+d+h,h=b+c+h,k=k+N,g=g+N,m=m+N,h=h+N;C.faces.push(new THREE.Face3(k,g,h,null,null,x));C.faces.push(new THREE.Face3(g,m,h,null,null,x));k=z.generateSideWallUV(C,k,g,m,h);C.faceVertexUvs[0].push([k[0],k[1],
|
|
|
+H,y]);this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.EdgesGeometry=function(a,b){THREE.BufferGeometry.call(this);var c=Math.cos(THREE.Math.degToRad(void 0!==b?b:1)),d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h;a instanceof THREE.BufferGeometry?(h=new THREE.Geometry,h.fromBufferGeometry(a)):h=a.clone();h.mergeVertices();h.computeFaceNormals();var k=h.vertices;h=h.faces;for(var l=0,n=0,p=h.length;n<p;n++)for(var m=h[n],r=0;3>r;r++){d[0]=m[g[r]];d[1]=m[g[(r+1)%3]];d.sort(f);var t=d.toString();void 0===e[t]?(e[t]={vert1:d[0],vert2:d[1],
|
|
|
+face1:n,face2:void 0},l++):e[t].face2=n}d=new Float32Array(6*l);f=0;for(t in e)if(g=e[t],void 0===g.face2||h[g.face1].normal.dot(h[g.face2].normal)<=c)l=k[g.vert1],d[f++]=l.x,d[f++]=l.y,d[f++]=l.z,l=k[g.vert2],d[f++]=l.x,d[f++]=l.y,d[f++]=l.z;this.addAttribute("position",new THREE.BufferAttribute(d,3))};THREE.EdgesGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.EdgesGeometry.prototype.constructor=THREE.EdgesGeometry;
|
|
|
+THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",a=a instanceof Array?a:[a],this.addShapeList(a,b),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
+THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||THREE.error("THREE.ExtrudeGeometry: vec does not exist");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=1,d=a.x-b.x,e=a.y-b.y,f=c.x-a.x,g=c.y-a.y,h=d*d+e*e;if(1E-10<Math.abs(d*g-e*f)){var k=Math.sqrt(h),l=Math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/l-h)*g-(c.y+f/l-b)*f)/(d*g-e*f);c=h+d*f-a.x;a=b+e*f-a.y;d=c*c+a*a;if(2>=d)return new THREE.Vector2(c,a);d=Math.sqrt(d/2)}else a=!1,1E-10<d?1E-10<f&&(a=!0):
|
|
|
+-1E-10>d?-1E-10>f&&(a=!0):Math.sign(e)==Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(P=a.length;0<=--P;){c=P;d=P-1;0>d&&(d=a.length-1);for(var e=0,f=r+2*n,e=0;e<f;e++){var g=D*e,h=D*(e+1),k=b+c+g,g=b+d+g,l=b+d+h,h=b+c+h,k=k+N,g=g+N,l=l+N,h=h+N;C.faces.push(new THREE.Face3(k,g,h,null,null,x));C.faces.push(new THREE.Face3(g,l,h,null,null,x));k=z.generateSideWallUV(C,k,g,l,h);C.faceVertexUvs[0].push([k[0],k[1],
|
|
|
k[3]]);C.faceVertexUvs[0].push([k[1],k[2],k[3]])}}}function f(a,b,c){C.vertices.push(new THREE.Vector3(a,b,c))}function g(a,b,c){a+=N;b+=N;c+=N;C.faces.push(new THREE.Face3(a,b,c,null,null,v));a=z.generateTopUV(C,a,b,c);C.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:k-2,n=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:
|
|
|
12,r=void 0!==b.steps?b.steps:1,t=b.extrudePath,s,u=!1,v=b.material,x=b.extrudeMaterial,z=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,I,H,y;t&&(s=t.getSpacedPoints(r),u=!0,p=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,r,!1),I=new THREE.Vector3,H=new THREE.Vector3,y=new THREE.Vector3);p||(l=k=n=0);var F,B,E,C=this,N=this.vertices.length,t=a.extractPoints(m),m=t.shape,K=t.holes;if(t=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();B=0;for(E=
|
|
|
K.length;B<E;B++)F=K[B],THREE.Shape.Utils.isClockWise(F)&&(K[B]=F.reverse());t=!1}var L=THREE.Shape.Utils.triangulateShape(m,K),J=m;B=0;for(E=K.length;B<E;B++)F=K[B],m=m.concat(F);var G,A,M,R,O,D=m.length,$,na=L.length,t=[],P=0;M=J.length;G=M-1;for(A=P+1;P<M;P++,G++,A++)G===M&&(G=0),A===M&&(A=0),t[P]=d(J[P],J[G],J[A]);var ea=[],W,Y=t.concat();B=0;for(E=K.length;B<E;B++){F=K[B];W=[];P=0;M=F.length;G=M-1;for(A=P+1;P<M;P++,G++,A++)G===M&&(G=0),A===M&&(A=0),W[P]=d(F[P],F[G],F[A]);ea.push(W);Y=Y.concat(W)}for(G=
|
|
@@ -781,7 +783,7 @@ f,l)),this.faceVertexUvs[0].push([v.clone(),x,h.clone()]);this.computeFaceNormal
|
|
|
THREE.TubeGeometry.FrenetFrames=function(a,b,c){var d=new THREE.Vector3,e=[],f=[],g=[],h=new THREE.Vector3,k=new THREE.Matrix4;b+=1;var l,n,p;this.tangents=e;this.normals=f;this.binormals=g;for(l=0;l<b;l++)n=l/(b-1),e[l]=a.getTangentAt(n),e[l].normalize();f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;l=Math.abs(e[0].x);n=Math.abs(e[0].y);p=Math.abs(e[0].z);l<=a&&(a=l,d.set(1,0,0));n<=a&&(a=n,d.set(0,1,0));p<=a&&d.set(0,0,1);h.crossVectors(e[0],d).normalize();f[0].crossVectors(e[0],
|
|
|
h);g[0].crossVectors(e[0],f[0]);for(l=1;l<b;l++)f[l]=f[l-1].clone(),g[l]=g[l-1].clone(),h.crossVectors(e[l-1],e[l]),1E-4<h.length()&&(h.normalize(),d=Math.acos(THREE.Math.clamp(e[l-1].dot(e[l]),-1,1)),f[l].applyMatrix4(k.makeRotationAxis(h,d))),g[l].crossVectors(e[l],f[l]);if(c)for(d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1)),d/=b-1,0<e[0].dot(h.crossVectors(f[0],f[b-1]))&&(d=-d),l=1;l<b;l++)f[l].applyMatrix4(k.makeRotationAxis(e[l],d*l)),g[l].crossVectors(e[l],f[l])};
|
|
|
THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=k.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+.5;a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c){var d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);k.faces.push(d);u.copy(a).add(b).add(c).divideScalar(3);d=Math.atan2(u.z,-u.x);k.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}function g(a,
|
|
|
-b){for(var c=Math.pow(2,b),d=e(k.vertices[a.a]),g=e(k.vertices[a.b]),h=e(k.vertices[a.c]),m=[],l=0;l<=c;l++){m[l]=[];for(var n=e(d.clone().lerp(h,l/c)),p=e(g.clone().lerp(h,l/c)),r=c-l,s=0;s<=r;s++)m[l][s]=0==s&&l==c?n:e(n.clone().lerp(p,s/r))}for(l=0;l<c;l++)for(s=0;s<2*(c-l)-1;s++)d=Math.floor(s/2),0==s%2?f(m[l][d+1],m[l+1][d],m[l][d]):f(m[l][d+1],m[l+1][d+1],m[l+1][d])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+.5,a.y));return a.clone()}
|
|
|
+b){for(var c=Math.pow(2,b),d=e(k.vertices[a.a]),g=e(k.vertices[a.b]),h=e(k.vertices[a.c]),l=[],m=0;m<=c;m++){l[m]=[];for(var n=e(d.clone().lerp(h,m/c)),p=e(g.clone().lerp(h,m/c)),r=c-m,s=0;s<=r;s++)l[m][s]=0==s&&m==c?n:e(n.clone().lerp(p,s/r))}for(m=0;m<c;m++)for(s=0;s<2*(c-m)-1;s++)d=Math.floor(s/2),0==s%2?f(l[m][d+1],l[m+1][d],l[m][d]):f(l[m][d+1],l[m+1][d+1],l[m+1][d])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+.5,a.y));return a.clone()}
|
|
|
THREE.Geometry.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;for(var k=this,l=0,n=a.length;l<n;l+=3)e(new THREE.Vector3(a[l],a[l+1],a[l+2]));a=this.vertices;for(var p=[],m=l=0,n=b.length;l<n;l+=3,m++){var r=a[b[l]],t=a[b[l+1]],s=a[b[l+2]];p[m]=new THREE.Face3(r.index,t.index,s.index,[r.clone(),t.clone(),s.clone()])}for(var u=new THREE.Vector3,l=0,n=p.length;l<n;l++)g(p[l],d);l=0;for(n=this.faceVertexUvs[0].length;l<n;l++)b=this.faceVertexUvs[0][l],
|
|
|
d=b[0].x,a=b[1].x,p=b[2].x,m=Math.max(d,Math.max(a,p)),r=Math.min(d,Math.min(a,p)),.9<m&&.1>r&&(.2>d&&(b[0].x+=1),.2>a&&(b[1].x+=1),.2>p&&(b[2].x+=1));l=0;for(n=this.vertices.length;l<n;l++)this.vertices[l].multiplyScalar(c);this.mergeVertices();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
|
|
|
THREE.DodecahedronGeometry=function(a,b){this.parameters={radius:a,detail:b};var c=(1+Math.sqrt(5))/2,d=1/c;THREE.PolyhedronGeometry.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,
|
|
@@ -812,9 +814,7 @@ THREE.DirectionalLightHelper=function(a,b){THREE.Object3D.call(this);this.light=
|
|
|
c=new THREE.Geometry;c.vertices.push(new THREE.Vector3,new THREE.Vector3);d=new THREE.LineBasicMaterial({fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine=new THREE.Line(c,d);this.add(this.targetLine);this.update()};THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.DirectionalLightHelper.prototype.constructor=THREE.DirectionalLightHelper;
|
|
|
THREE.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose();this.lightPlane.material.dispose();this.targetLine.geometry.dispose();this.targetLine.material.dispose()};
|
|
|
THREE.DirectionalLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(){a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(b,a);this.lightPlane.lookAt(c);this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.vertices[1].copy(c);this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.lightPlane.material.color)}}();
|
|
|
-THREE.EdgesHelper=function(a,b,c){b=void 0!==b?b:16777215;c=Math.cos(THREE.Math.degToRad(void 0!==c?c:1));var d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry,k;a.geometry instanceof THREE.BufferGeometry?(k=new THREE.Geometry,k.fromBufferGeometry(a.geometry)):k=a.geometry.clone();k.mergeVertices();k.computeFaceNormals();var l=k.vertices;k=k.faces;for(var n=0,p=0,m=k.length;p<m;p++)for(var r=k[p],t=0;3>t;t++){d[0]=r[g[t]];d[1]=r[g[(t+1)%3]];d.sort(f);var s=d.toString();
|
|
|
-void 0===e[s]?(e[s]={vert1:d[0],vert2:d[1],face1:p,face2:void 0},n++):e[s].face2=p}d=new Float32Array(6*n);f=0;for(s in e)if(g=e[s],void 0===g.face2||k[g.face1].normal.dot(k[g.face2].normal)<=c)n=l[g.vert1],d[f++]=n.x,d[f++]=n.y,d[f++]=n.z,n=l[g.vert2],d[f++]=n.x,d[f++]=n.y,d[f++]=n.z;h.addAttribute("position",new THREE.BufferAttribute(d,3));THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:b}),THREE.LinePieces);this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1};
|
|
|
-THREE.EdgesHelper.prototype=Object.create(THREE.Line.prototype);THREE.EdgesHelper.prototype.constructor=THREE.EdgesHelper;
|
|
|
+THREE.EdgesHelper=function(a,b,c){b=void 0!==b?b:16777215;THREE.Line.call(this,new THREE.EdgesGeometry(a.geometry,c),new THREE.LineBasicMaterial({color:b}),THREE.LinePieces);this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1};THREE.EdgesHelper.prototype=Object.create(THREE.Line.prototype);THREE.EdgesHelper.prototype.constructor=THREE.EdgesHelper;
|
|
|
THREE.FaceNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16776960;d=void 0!==d?d:1;b=new THREE.Geometry;c=0;for(var e=this.object.geometry.faces.length;c<e;c++)b.vertices.push(new THREE.Vector3,new THREE.Vector3);THREE.Line.call(this,b,new THREE.LineBasicMaterial({color:a,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.normalMatrix=new THREE.Matrix3;this.update()};THREE.FaceNormalsHelper.prototype=Object.create(THREE.Line.prototype);
|
|
|
THREE.FaceNormalsHelper.prototype.constructor=THREE.FaceNormalsHelper;
|
|
|
THREE.FaceNormalsHelper.prototype.update=function(){var a=this.geometry.vertices,b=this.object,c=b.geometry.vertices,d=b.geometry.faces,e=b.matrixWorld;b.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(e);for(var f=b=0,g=d.length;b<g;b++,f+=2){var h=d[b];a[f].copy(c[h.a]).add(c[h.b]).add(c[h.c]).divideScalar(3).applyMatrix4(e);a[f+1].copy(h.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size).add(a[f])}this.geometry.verticesNeedUpdate=!0;return this};
|