提交 63246bb5 编写于 作者: M Mr.doob

Updated builds.

上级 bde5f99b
......@@ -17760,7 +17760,15 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( _gl === null ) {
throw 'Error creating WebGL context.';
if ( _canvas.getContext( 'webgl') !== null ) {
throw 'Error creating WebGL context with your selected attributes.';
} else {
throw 'Error creating WebGL context.';
}
}
......
......@@ -517,19 +517,19 @@ if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}
a.stencil:!0,O=void 0!==a.antialias?a.antialias:!1,Ma=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ia=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,Pa=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,Ja=new THREE.Color(0),db=0,Za=[],$a={},lb=[],Ib=[],pb=[];this.domElement=Q;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 H=this,qb=[],Ab=null,Rc=
null,Jb=-1,Fa=-1,fc=null,dc=0,Kb=-1,Wb=-1,Lb=-1,tb=-1,Mb=-1,Nb=-1,Ob=-1,jb=-1,Oc=null,Pc=null,Qc=null,Nc=null,kb=0,rb=0,Xb=Q.width,Yb=Q.height,qc=0,rc=0,sb=new Uint8Array(16),eb=new Uint8Array(16),Bc=new THREE.Frustum,xc=new THREE.Matrix4,Dc=new THREE.Matrix4,Oa=new THREE.Vector3,ya=new THREE.Vector3,gc=!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;try{var Sc={alpha:ba,depth:ga,stencil:za,antialias:O,premultipliedAlpha:Ma,preserveDrawingBuffer:ia};l=ka||Q.getContext("webgl",Sc)||Q.getContext("experimental-webgl",Sc);if(null===l)throw"Error creating WebGL context.";}catch(Xc){console.error(Xc)}void 0===l.getShaderPrecisionFormat&&(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var sa=new THREE.WebGLExtensions(l);sa.get("OES_texture_float");
sa.get("OES_texture_float_linear");sa.get("OES_standard_derivatives");Pa&&sa.get("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(kb,rb,Xb,Yb);l.clearColor(Ja.r,Ja.g,Ja.b,db);this.context=l;var Mc=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),Yc=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),
Zc=l.getParameter(l.MAX_TEXTURE_SIZE),Wc=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),kc=0<Yc,ec=kc&&sa.get("OES_texture_float"),$c=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.HIGH_FLOAT),ad=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);var bd=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT),cd=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);var Lc=
function(){var a;return function(){if(void 0!==a)return a;a=[];if(sa.get("WEBGL_compressed_texture_pvrtc")||sa.get("WEBGL_compressed_texture_s3tc"))for(var b=l.getParameter(l.COMPRESSED_TEXTURE_FORMATS),c=0;c<b.length;c++)a.push(b[c]);return a}}(),dd=0<$c.precision&&0<bd.precision,Tc=0<ad.precision&&0<cd.precision;"highp"!==W||dd||(Tc?(W="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(W="lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")));
"mediump"!==W||Tc||(W="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));this.getContext=function(){return l};this.supportsVertexTextures=function(){return kc};this.supportsFloatTextures=function(){return sa.get("OES_texture_float")};this.supportsStandardDerivatives=function(){return sa.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function(){return sa.get("WEBGL_compressed_texture_s3tc")};this.supportsCompressedTexturePVRTC=function(){return sa.get("WEBGL_compressed_texture_pvrtc")};
this.supportsBlendMinMax=function(){return sa.get("EXT_blend_minmax")};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=sa.get("EXT_texture_filter_anisotropic");return a=null!==b?l.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return W};this.setSize=function(a,b,c){Q.width=a*this.devicePixelRatio;Q.height=b*this.devicePixelRatio;!1!==c&&(Q.style.width=a+"px",Q.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=
function(a,b,c,d){kb=a*this.devicePixelRatio;rb=b*this.devicePixelRatio;Xb=c*this.devicePixelRatio;Yb=d*this.devicePixelRatio;l.viewport(kb,rb,Xb,Yb)};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){Ja.set(a);db=void 0!==b?b:1;l.clearColor(Ja.r,Ja.g,Ja.b,db)};this.setClearColorHex=function(a,
b){console.warn("THREE.WebGLRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return Ja};this.getClearAlpha=function(){return db};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,Za,$a,lb);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this,Za,$a,lb);this.renderPluginsPre.push(a)};this.resetGLState=function(){fc=Ab=null;Jb=Fa=Wb=Kb=jb=Ob=Lb=-1;gc=!0};this.updateShadowMap=function(a,b){Ab=null;Jb=Fa=jb=Ob=Lb=-1;gc=!0;Wb=Kb=-1;this.shadowMapPlugin.update(a,b)};var Fc=function(a){a.target.traverse(function(a){a.removeEventListener("remove",
Fc);if(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)delete $a[a.id];else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var b=lb,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})},Gc=function(a){a=a.target;a.removeEventListener("dispose",Gc);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)}H.info.memory.geometries--}else if(b=Bb[a.id],void 0!==b){for(var c=0,d=b.length;c<d;c++){var e=b[c];if(void 0!==e.numMorphTargets){for(var f=0,g=e.numMorphTargets;f<g;f++)l.deleteBuffer(e.__webglMorphTargetsBuffers[f]);delete e.__webglMorphTargetsBuffers}if(void 0!==e.numMorphNormals){f=0;for(g=e.numMorphNormals;f<g;f++)l.deleteBuffer(e.__webglMorphNormalsBuffers[f]);delete e.__webglMorphNormalsBuffers}Uc(e)}delete Bb[a.id]}else Uc(a);
Fa=-1},hc=function(a){a=a.target;a.removeEventListener("dispose",hc);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);H.info.memory.textures--},Vc=function(a){a=a.target;a.removeEventListener("dispose",Vc);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}H.info.memory.textures--},Ac=function(a){a=a.target;a.removeEventListener("dispose",Ac);zc(a)},Uc=function(a){for(var b="__webglVertexBuffer __webglNormalBuffer __webglTangentBuffer __webglColorBuffer __webglUVBuffer __webglUV2Buffer __webglSkinIndicesBuffer __webglSkinWeightsBuffer __webglFaceBuffer __webglLineBuffer __webglLineDistanceBuffer".split(" "),
exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},l;try{var Sc={alpha:ba,depth:ga,stencil:za,antialias:O,premultipliedAlpha:Ma,preserveDrawingBuffer:ia};l=ka||Q.getContext("webgl",Sc)||Q.getContext("experimental-webgl",Sc);if(null===l){if(null!==Q.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}}catch(Xc){console.error(Xc)}void 0===l.getShaderPrecisionFormat&&(l.getShaderPrecisionFormat=function(){return{rangeMin:1,
rangeMax:1,precision:1}});var sa=new THREE.WebGLExtensions(l);sa.get("OES_texture_float");sa.get("OES_texture_float_linear");sa.get("OES_standard_derivatives");Pa&&sa.get("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(kb,rb,Xb,Yb);l.clearColor(Ja.r,Ja.g,Ja.b,db);this.context=
l;var Mc=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),Yc=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Zc=l.getParameter(l.MAX_TEXTURE_SIZE),Wc=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),kc=0<Yc,ec=kc&&sa.get("OES_texture_float"),$c=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.HIGH_FLOAT),ad=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);var bd=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT),cd=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,
l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);var Lc=function(){var a;return function(){if(void 0!==a)return a;a=[];if(sa.get("WEBGL_compressed_texture_pvrtc")||sa.get("WEBGL_compressed_texture_s3tc"))for(var b=l.getParameter(l.COMPRESSED_TEXTURE_FORMATS),c=0;c<b.length;c++)a.push(b[c]);return a}}(),dd=0<$c.precision&&0<bd.precision,Tc=0<ad.precision&&0<cd.precision;"highp"!==W||dd||(Tc?(W="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):
(W="lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")));"mediump"!==W||Tc||(W="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));this.getContext=function(){return l};this.supportsVertexTextures=function(){return kc};this.supportsFloatTextures=function(){return sa.get("OES_texture_float")};this.supportsStandardDerivatives=function(){return sa.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function(){return sa.get("WEBGL_compressed_texture_s3tc")};
this.supportsCompressedTexturePVRTC=function(){return sa.get("WEBGL_compressed_texture_pvrtc")};this.supportsBlendMinMax=function(){return sa.get("EXT_blend_minmax")};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=sa.get("EXT_texture_filter_anisotropic");return a=null!==b?l.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return W};this.setSize=function(a,b,c){Q.width=a*this.devicePixelRatio;Q.height=b*this.devicePixelRatio;!1!==
c&&(Q.style.width=a+"px",Q.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){kb=a*this.devicePixelRatio;rb=b*this.devicePixelRatio;Xb=c*this.devicePixelRatio;Yb=d*this.devicePixelRatio;l.viewport(kb,rb,Xb,Yb)};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){Ja.set(a);db=void 0!==b?b:1;l.clearColor(Ja.r,Ja.g,Ja.b,db)};this.setClearColorHex=function(a,b){console.warn("THREE.WebGLRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return Ja};this.getClearAlpha=function(){return db};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,Za,$a,lb);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this,Za,$a,lb);this.renderPluginsPre.push(a)};this.resetGLState=function(){fc=Ab=null;Jb=Fa=Wb=Kb=jb=Ob=Lb=-1;gc=!0};this.updateShadowMap=function(a,b){Ab=null;Jb=Fa=jb=Ob=Lb=-1;gc=!0;Wb=
Kb=-1;this.shadowMapPlugin.update(a,b)};var Fc=function(a){a.target.traverse(function(a){a.removeEventListener("remove",Fc);if(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)delete $a[a.id];else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var b=lb,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})},Gc=function(a){a=a.target;a.removeEventListener("dispose",
Gc);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)}H.info.memory.geometries--}else if(b=Bb[a.id],void 0!==b){for(var c=0,d=b.length;c<d;c++){var e=b[c];if(void 0!==e.numMorphTargets){for(var f=0,g=e.numMorphTargets;f<g;f++)l.deleteBuffer(e.__webglMorphTargetsBuffers[f]);delete e.__webglMorphTargetsBuffers}if(void 0!==e.numMorphNormals){f=0;for(g=e.numMorphNormals;f<g;f++)l.deleteBuffer(e.__webglMorphNormalsBuffers[f]);
delete e.__webglMorphNormalsBuffers}Uc(e)}delete Bb[a.id]}else Uc(a);Fa=-1},hc=function(a){a=a.target;a.removeEventListener("dispose",hc);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);H.info.memory.textures--},Vc=function(a){a=a.target;a.removeEventListener("dispose",Vc);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}H.info.memory.textures--},Ac=function(a){a=a.target;a.removeEventListener("dispose",Ac);zc(a)},Uc=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}H.info.memory.geometries--},zc=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=qb.length;a<c;a++)if(d=qb[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=qb.length;a<
c;a++)d=qb[a],d.program!==b&&e.push(d);qb=e;l.deleteProgram(b);H.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,r,q,t,s,u,w=3*a.count;for(u=0;u<w;u+=9)s=a.normalArray,d=s[u],e=s[u+1],k=s[u+2],m=s[u+3],p=s[u+4],q=s[u+5],n=s[u+6],r=s[u+7],t=s[u+8],d=(d+m+n)/3,e=(e+p+r)/3,k=(k+q+t)/3,s[u]=d,s[u+1]=e,s[u+2]=k,s[u+3]=d,s[u+4]=e,s[u+5]=k,s[u+6]=d,s[u+
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册