|
@@ -365,8 +365,9 @@ THREE.ParticleSystemMaterial=function(a){console.warn("THREE.ParticleSystemMater
|
|
|
THREE.ShaderMaterial=function(a){THREE.Material.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";this.shading=THREE.SmoothShading;this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.vertexColors=THREE.NoColors;this.derivatives=this.morphNormals=
|
|
|
this.morphTargets=this.skinning=!1;this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName=void 0;void 0!==a&&(void 0!==a.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(a))};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
|
|
|
THREE.ShaderMaterial.prototype.copy=function(a){THREE.Material.prototype.copy.call(this,a);this.fragmentShader=a.fragmentShader;this.vertexShader=a.vertexShader;this.uniforms=THREE.UniformsUtils.clone(a.uniforms);this.attributes=a.attributes;this.defines=a.defines;this.shading=a.shading;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.fog=a.fog;this.lights=a.lights;this.vertexColors=a.vertexColors;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=
|
|
|
-a.morphNormals;return this};THREE.ShaderMaterial.prototype.toJSON=function(a){a=THREE.Material.prototype.toJSON.call(this,a);a.uniforms=this.uniforms;a.attributes=this.attributes;a.vertexShader=this.vertexShader;a.fragmentShader=this.fragmentShader;return a};THREE.RawShaderMaterial=function(a){THREE.ShaderMaterial.call(this,a);this.type="RawShaderMaterial"};THREE.RawShaderMaterial.prototype=Object.create(THREE.ShaderMaterial.prototype);THREE.RawShaderMaterial.prototype.constructor=THREE.RawShaderMaterial;
|
|
|
-THREE.SpriteMaterial=function(a){THREE.Material.call(this);this.type="SpriteMaterial";this.color=new THREE.Color(16777215);this.map=null;this.rotation=0;this.fog=!1;this.setValues(a)};THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype);THREE.SpriteMaterial.prototype.constructor=THREE.SpriteMaterial;THREE.SpriteMaterial.prototype.copy=function(a){THREE.Material.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.rotation=a.rotation;this.fog=a.fog;return this};
|
|
|
+a.morphNormals;this.derivatives=a.derivatives;return this};THREE.ShaderMaterial.prototype.toJSON=function(a){a=THREE.Material.prototype.toJSON.call(this,a);a.uniforms=this.uniforms;a.attributes=this.attributes;a.vertexShader=this.vertexShader;a.fragmentShader=this.fragmentShader;return a};THREE.RawShaderMaterial=function(a){THREE.ShaderMaterial.call(this,a);this.type="RawShaderMaterial"};THREE.RawShaderMaterial.prototype=Object.create(THREE.ShaderMaterial.prototype);
|
|
|
+THREE.RawShaderMaterial.prototype.constructor=THREE.RawShaderMaterial;THREE.SpriteMaterial=function(a){THREE.Material.call(this);this.type="SpriteMaterial";this.color=new THREE.Color(16777215);this.map=null;this.rotation=0;this.fog=!1;this.setValues(a)};THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype);THREE.SpriteMaterial.prototype.constructor=THREE.SpriteMaterial;
|
|
|
+THREE.SpriteMaterial.prototype.copy=function(a){THREE.Material.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.rotation=a.rotation;this.fog=a.fog;return this};
|
|
|
THREE.Texture=function(a,b,c,d,e,g,f,h,k){Object.defineProperty(this,"id",{value:THREE.TextureIdCount++});this.uuid=THREE.Math.generateUUID();this.sourceFile=this.name="";this.image=void 0!==a?a:THREE.Texture.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=void 0!==b?b:THREE.Texture.DEFAULT_MAPPING;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==g?g:THREE.LinearMipMapLinearFilter;
|
|
|
this.anisotropy=void 0!==k?k:1;this.format=void 0!==f?f:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.version=0;this.onUpdate=null};THREE.Texture.DEFAULT_IMAGE=void 0;THREE.Texture.DEFAULT_MAPPING=THREE.UVMapping;
|
|
|
THREE.Texture.prototype={constructor:THREE.Texture,set needsUpdate(a){!0===a&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.image=a.image;this.mipmaps=a.mipmaps.slice(0);this.mapping=a.mapping;this.wrapS=a.wrapS;this.wrapT=a.wrapT;this.magFilter=a.magFilter;this.minFilter=a.minFilter;this.anisotropy=a.anisotropy;this.format=a.format;this.type=a.type;this.offset.copy(a.offset);this.repeat.copy(a.repeat);this.generateMipmaps=a.generateMipmaps;this.premultiplyAlpha=
|
|
@@ -547,13 +548,13 @@ this.getClearColor=function(){return Z};this.setClearColor=function(a,c){Z.set(a
|
|
|
function(){t.clear(t.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=d;this.dispose=function(){C.removeEventListener("webglcontextlost",e,!1)};this.renderBufferImmediate=function(a,b,c){K.initAttributes();var d=$.get(a);a.hasPositions&&!d.position&&(d.position=t.createBuffer());a.hasNormals&&!d.normal&&(d.normal=t.createBuffer());a.hasUvs&&!d.uv&&(d.uv=t.createBuffer());a.hasColors&&!d.color&&(d.color=t.createBuffer());b=b.getAttributes();
|
|
|
a.hasPositions&&(t.bindBuffer(t.ARRAY_BUFFER,d.position),t.bufferData(t.ARRAY_BUFFER,a.positionArray,t.DYNAMIC_DRAW),K.enableAttribute(b.position),t.vertexAttribPointer(b.position,3,t.FLOAT,!1,0,0));if(a.hasNormals){t.bindBuffer(t.ARRAY_BUFFER,d.normal);if("MeshPhongMaterial"!==c.type&&c.shading===THREE.FlatShading)for(var e=0,f=3*a.count;e<f;e+=9){var g=a.normalArray,h=(g[e+0]+g[e+3]+g[e+6])/3,k=(g[e+1]+g[e+4]+g[e+7])/3,l=(g[e+2]+g[e+5]+g[e+8])/3;g[e+0]=h;g[e+1]=k;g[e+2]=l;g[e+3]=h;g[e+4]=k;g[e+
|
|
|
5]=l;g[e+6]=h;g[e+7]=k;g[e+8]=l}t.bufferData(t.ARRAY_BUFFER,a.normalArray,t.DYNAMIC_DRAW);K.enableAttribute(b.normal);t.vertexAttribPointer(b.normal,3,t.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(t.bindBuffer(t.ARRAY_BUFFER,d.uv),t.bufferData(t.ARRAY_BUFFER,a.uvArray,t.DYNAMIC_DRAW),K.enableAttribute(b.uv),t.vertexAttribPointer(b.uv,2,t.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(t.bindBuffer(t.ARRAY_BUFFER,d.color),t.bufferData(t.ARRAY_BUFFER,a.colorArray,t.DYNAMIC_DRAW),K.enableAttribute(b.color),
|
|
|
-t.vertexAttribPointer(b.color,3,t.FLOAT,!1,0,0));K.disableUnusedAttributes();t.drawArrays(t.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f,g){u(e);var h=x(a,b,c,e,f),k=!1;a=d.id+"_"+h.id+"_"+e.wireframe;a!==Ia&&(Ia=a,k=!0);a=f.morphTargetInfluences;if(void 0!==a){b=[];c=0;for(k=a.length;c<k;c++){var l=a[c];b.push([l,c])}b.sort(m);8<b.length&&(b.length=8);var n=d.morphAttributes;c=0;for(k=b.length;c<k;c++)l=b[c],gb[c]=l[0],0!==l[0]?(a=l[1],!0===e.morphTargets&&d.addAttribute("morphTarget"+
|
|
|
-c,n.position[a]),!0===e.morphNormals&&d.addAttribute("morphNormal"+c,n.normal[a])):(!0===e.morphTargets&&d.removeAttribute("morphTarget"+c),!0===e.morphNormals&&d.removeAttribute("morphNormal"+c));a=h.getUniforms();null!==a.morphTargetInfluences&&t.uniform1fv(a.morphTargetInfluences,gb);k=!0}a=d.attributes.index;c=d.attributes.position;!0===e.wireframe&&(a=xa.getWireframeAttribute(d));void 0!==a?(b=Nb,b.setIndex(a)):b=Mb;if(k){a:{var k=void 0,q;if(d instanceof THREE.InstancedBufferGeometry&&(q=X.get("ANGLE_instanced_arrays"),
|
|
|
-null===q)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}void 0===k&&(k=0);K.initAttributes();var l=d.attributes,h=h.getAttributes(),n=e.defaultAttributeValues,p;for(p in h){var s=h[p];if(0<=s){var r=l[p];if(void 0!==r){K.enableAttribute(s);var v=r.itemSize,w=xa.getAttributeBuffer(r);if(r instanceof THREE.InterleavedBufferAttribute){var y=r.data,z=y.stride,r=r.offset;t.bindBuffer(t.ARRAY_BUFFER,
|
|
|
-w);t.vertexAttribPointer(s,v,t.FLOAT,!1,z*y.array.BYTES_PER_ELEMENT,(k*z+r)*y.array.BYTES_PER_ELEMENT);if(y instanceof THREE.InstancedInterleavedBuffer){if(null===q){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");break a}q.vertexAttribDivisorANGLE(s,y.meshPerAttribute);void 0===d.maxInstancedCount&&(d.maxInstancedCount=y.meshPerAttribute*y.count)}}else if(t.bindBuffer(t.ARRAY_BUFFER,w),
|
|
|
-t.vertexAttribPointer(s,v,t.FLOAT,!1,0,k*v*4),r instanceof THREE.InstancedBufferAttribute){if(null===q){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");break a}q.vertexAttribDivisorANGLE(s,r.meshPerAttribute);void 0===d.maxInstancedCount&&(d.maxInstancedCount=r.meshPerAttribute*r.count)}}else if(void 0!==n&&(v=n[p],void 0!==v))switch(v.length){case 2:t.vertexAttrib2fv(s,v);break;case 3:t.vertexAttrib3fv(s,
|
|
|
-v);break;case 4:t.vertexAttrib4fv(s,v);break;default:t.vertexAttrib1fv(s,v)}}}K.disableUnusedAttributes()}void 0!==a&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,xa.getAttributeBuffer(a))}void 0===g&&(g={start:0,count:void 0!==a?a.array.length:c instanceof THREE.InterleavedBufferAttribute?c.data.array.length/3:c.array.length/3});f instanceof THREE.Mesh?(!0===e.wireframe?(K.setLineWidth(e.wireframeLinewidth*D),b.setMode(t.LINES)):b.setMode(t.TRIANGLES),d instanceof THREE.InstancedBufferGeometry&&0<d.maxInstancedCount?
|
|
|
-b.renderInstances(d):c instanceof THREE.InterleavedBufferAttribute?b.render(0,c.data.count):b.render(g.start,g.count)):f instanceof THREE.Line?(d=e.linewidth,void 0===d&&(d=1),K.setLineWidth(d*D),f instanceof THREE.LineSegments?b.setMode(t.LINES):b.setMode(t.LINE_STRIP),b.render(g.start,g.count)):f instanceof THREE.PointCloud&&(b.setMode(t.POINTS),b.render(g.start,g.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.");
|
|
|
+t.vertexAttribPointer(b.color,3,t.FLOAT,!1,0,0));K.disableUnusedAttributes();t.drawArrays(t.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f,g){u(e);var h=x(a,b,c,e,f),k=!1;a=d.id+"_"+h.id+"_"+e.wireframe;a!==Ia&&(Ia=a,k=!0);a=f.morphTargetInfluences;if(void 0!==a){b=[];c=0;for(k=a.length;c<k;c++){var l=a[c];b.push([l,c])}b.sort(m);8<b.length&&(b.length=8);var n=d.morphAttributes;c=0;for(k=b.length;c<k;c++)l=b[c],gb[c]=l[0],0!==l[0]?(a=l[1],!0===e.morphTargets&&n.position&&
|
|
|
+d.addAttribute("morphTarget"+c,n.position[a]),!0===e.morphNormals&&n.normal&&d.addAttribute("morphNormal"+c,n.normal[a])):(!0===e.morphTargets&&d.removeAttribute("morphTarget"+c),!0===e.morphNormals&&d.removeAttribute("morphNormal"+c));a=h.getUniforms();null!==a.morphTargetInfluences&&t.uniform1fv(a.morphTargetInfluences,gb);k=!0}a=d.attributes.index;c=d.attributes.position;!0===e.wireframe&&(a=xa.getWireframeAttribute(d));void 0!==a?(b=Nb,b.setIndex(a)):b=Mb;if(k){a:{var k=void 0,q;if(d instanceof
|
|
|
+THREE.InstancedBufferGeometry&&(q=X.get("ANGLE_instanced_arrays"),null===q)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}void 0===k&&(k=0);K.initAttributes();var l=d.attributes,h=h.getAttributes(),n=e.defaultAttributeValues,p;for(p in h){var s=h[p];if(0<=s){var r=l[p];if(void 0!==r){K.enableAttribute(s);var v=r.itemSize,w=xa.getAttributeBuffer(r);if(r instanceof THREE.InterleavedBufferAttribute){var y=
|
|
|
+r.data,z=y.stride,r=r.offset;t.bindBuffer(t.ARRAY_BUFFER,w);t.vertexAttribPointer(s,v,t.FLOAT,!1,z*y.array.BYTES_PER_ELEMENT,(k*z+r)*y.array.BYTES_PER_ELEMENT);if(y instanceof THREE.InstancedInterleavedBuffer){if(null===q){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");break a}q.vertexAttribDivisorANGLE(s,y.meshPerAttribute);void 0===d.maxInstancedCount&&(d.maxInstancedCount=y.meshPerAttribute*
|
|
|
+y.count)}}else if(t.bindBuffer(t.ARRAY_BUFFER,w),t.vertexAttribPointer(s,v,t.FLOAT,!1,0,k*v*4),r instanceof THREE.InstancedBufferAttribute){if(null===q){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");break a}q.vertexAttribDivisorANGLE(s,r.meshPerAttribute);void 0===d.maxInstancedCount&&(d.maxInstancedCount=r.meshPerAttribute*r.count)}}else if(void 0!==n&&(v=n[p],void 0!==v))switch(v.length){case 2:t.vertexAttrib2fv(s,
|
|
|
+v);break;case 3:t.vertexAttrib3fv(s,v);break;case 4:t.vertexAttrib4fv(s,v);break;default:t.vertexAttrib1fv(s,v)}}}K.disableUnusedAttributes()}void 0!==a&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,xa.getAttributeBuffer(a))}void 0===g&&(g={start:0,count:void 0!==a?a.array.length:c instanceof THREE.InterleavedBufferAttribute?c.data.array.length/3:c.array.length/3});f instanceof THREE.Mesh?(!0===e.wireframe?(K.setLineWidth(e.wireframeLinewidth*D),b.setMode(t.LINES)):b.setMode(t.TRIANGLES),d instanceof THREE.InstancedBufferGeometry&&
|
|
|
+0<d.maxInstancedCount?b.renderInstances(d):c instanceof THREE.InterleavedBufferAttribute?b.render(0,c.data.count):b.render(g.start,g.count)):f instanceof THREE.Line?(d=e.linewidth,void 0===d&&(d=1),K.setLineWidth(d*D),f instanceof THREE.LineSegments?b.setMode(t.LINES):b.setMode(t.LINE_STRIP),b.render(g.start,g.count)):f instanceof THREE.PointCloud&&(b.setMode(t.POINTS),b.render(g.start,g.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;Ia="";Xa=-1;Wa=null;hb=!0;!0===a.autoUpdate&&a.updateMatrixWorld();null===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ja.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Za.setFromMatrix(Ja);ga.length=0;va.length=0;la.length=0;sa.length=0;Ca.length=0;ra.length=0;Ya.length=0;q(a);!0===ma.sortObjects&&(va.sort(n),la.sort(p));na.render(a,b);ka.calls=0;ka.vertices=0;ka.faces=0;ka.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
|
|
|
this.autoClearDepth,this.autoClearStencil);a.overrideMaterial?(d=a.overrideMaterial,s(va,b,ga,e,d),s(la,b,ga,e,d),r(sa,b,ga,e,d),r(Ca,b,ga,e,d)):(K.setBlending(THREE.NoBlending),s(va,b,ga,e),r(sa,b,ga,e),s(la,b,ga,e),r(Ca,b,ga,e));Qb.render(a,b);Rb.render(a,b,mb,nb);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(K.bindTexture(t.TEXTURE_CUBE_MAP,$.get(c).__webglTexture),t.generateMipmap(t.TEXTURE_CUBE_MAP),K.bindTexture(t.TEXTURE_CUBE_MAP,
|
|
|
null)):(K.bindTexture(t.TEXTURE_2D,$.get(c).__webglTexture),t.generateMipmap(t.TEXTURE_2D),K.bindTexture(t.TEXTURE_2D,null)));K.setDepthTest(!0);K.setDepthWrite(!0);K.setColorWrite(!0)}};var cc={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?K.disable(t.CULL_FACE):
|