From 7ca274704cbaf2819e15f269008dc5bb0b612a34 Mon Sep 17 00:00:00 2001 From: supereggbrt Date: Thu, 22 Aug 2019 08:43:59 +0100 Subject: [PATCH 1/4] restore initial projection matrix update --- src/renderers/webgl/WebGLShadowMap.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/renderers/webgl/WebGLShadowMap.js b/src/renderers/webgl/WebGLShadowMap.js index 7c05cde53a9c16..98ed1df695aeaa 100644 --- a/src/renderers/webgl/WebGLShadowMap.js +++ b/src/renderers/webgl/WebGLShadowMap.js @@ -140,6 +140,8 @@ function WebGLShadowMap( _renderer, _objects, maxTextureSize ) { shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars ); shadow.map.texture.name = light.name + ".shadowMap"; + shadow.camera.updateProjectionMatrix(); + } _renderer.setRenderTarget( shadow.map ); From 299522556685f05f26e1385542749881fb797bc6 Mon Sep 17 00:00:00 2001 From: Valentin Lenhart Date: Thu, 22 Aug 2019 11:09:50 +0200 Subject: [PATCH 2/4] add toArray and fromArray function types with array-likes --- src/math/Vector2.d.ts | 9 ++++++++- src/math/Vector3.d.ts | 18 +++++++++++++++--- src/math/Vector4.d.ts | 30 ++++++++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/src/math/Vector2.d.ts b/src/math/Vector2.d.ts index afe7b63bde9c3a..72d0eac11c2eaf 100644 --- a/src/math/Vector2.d.ts +++ b/src/math/Vector2.d.ts @@ -396,12 +396,19 @@ export class Vector2 implements Vector { equals( v: Vector2 ): boolean; /** - * Sets this vector's x value to be array[offset] and y value to be array[offset + 1]. + * Sets this vector's x and y value from the provided array. * @param array the source array. * @param offset (optional) offset into the array. Default is 0. */ fromArray( array: number[], offset?: number ): this; + /** + * Sets this vector's x and y value from the provided array-like. + * @param array the source array-like. + * @param offset (optional) offset into the array-like. Default is 0. + */ + fromArray( array: ArrayLike, offset?: number ): this; + /** * Returns an array [x, y], or copies x and y into the provided array. * @param array (optional) array to store the vector to. If this is not provided, a new array will be created. diff --git a/src/math/Vector3.d.ts b/src/math/Vector3.d.ts index cbf8dde30b46f8..1748dc1b1763f0 100644 --- a/src/math/Vector3.d.ts +++ b/src/math/Vector3.d.ts @@ -248,7 +248,19 @@ export class Vector3 implements Vector { */ equals( v: Vector3 ): boolean; - fromArray( xyz: number[], offset?: number ): Vector3; + /** + * Sets this vector's x, y and z value from the provided array. + * @param array the source array. + * @param offset (optional) offset into the array. Default is 0. + */ + fromArray( array: number[], offset?: number ): this; + + /** + * Sets this vector's x, y and z value from the provided array-lik. + * @param array the source array-like. + * @param offset (optional) offset into the array-like. Default is 0. + */ + fromArray( array: ArrayLike, offset?: number ): this; /** * Returns an array [x, y, z], or copies x, y and z into the provided array. @@ -256,7 +268,7 @@ export class Vector3 implements Vector { * @param offset (optional) optional offset into the array. * @return The created or provided array. */ - toArray( xyz?: number[], offset?: number ): number[]; + toArray( array?: number[], offset?: number ): number[]; /** * Copies x, y and z into the provided array-like. @@ -264,7 +276,7 @@ export class Vector3 implements Vector { * @param offset (optional) optional offset into the array. * @return The provided array-like. */ - toArray( xyz: ArrayLike, offset?: number ): ArrayLike; + toArray( array: ArrayLike, offset?: number ): ArrayLike; fromBufferAttribute( attribute: BufferAttribute, diff --git a/src/math/Vector4.d.ts b/src/math/Vector4.d.ts index 1204d988de1fdc..0d92b7806b2749 100644 --- a/src/math/Vector4.d.ts +++ b/src/math/Vector4.d.ts @@ -174,9 +174,35 @@ export class Vector4 implements Vector { */ equals( v: Vector4 ): boolean; - fromArray( xyzw: number[], offset?: number ): this; + /** + * Sets this vector's x, y, z and w value from the provided array. + * @param array the source array. + * @param offset (optional) offset into the array. Default is 0. + */ + fromArray( array: number[], offset?: number ): this; + + /** + * Sets this vector's x, y, z and w value from the provided array-like. + * @param array the source array-like. + * @param offset (optional) offset into the array-like. Default is 0. + */ + fromArray( array: ArrayLike, offset?: number ): this; - toArray( xyzw?: number[], offset?: number ): number[]; + /** + * Returns an array [x, y, z, w], or copies x, y, z and w into the provided array. + * @param array (optional) array to store the vector to. If this is not provided, a new array will be created. + * @param offset (optional) optional offset into the array. + * @return The created or provided array. + */ + toArray( array?: number[], offset?: number ): number[]; + + /** + * Copies x, y, z and w into the provided array-like. + * @param array array-like to store the vector to. + * @param offset (optional) optional offset into the array. + * @return The provided array-like. + */ + toArray( array: ArrayLike, offset?: number ): ArrayLike; fromBufferAttribute( attribute: BufferAttribute, From 027f70773db6d0f298391b7069012bd8d3d3bf40 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Thu, 22 Aug 2019 11:10:33 +0200 Subject: [PATCH 3/4] Update builds. --- build/three.js | 2 + build/three.min.js | 260 +++++++++++++++++++++--------------------- build/three.module.js | 2 + 3 files changed, 134 insertions(+), 130 deletions(-) diff --git a/build/three.js b/build/three.js index 010eab5b4c4a7f..781d74565a09d1 100644 --- a/build/three.js +++ b/build/three.js @@ -19387,6 +19387,8 @@ shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars ); shadow.map.texture.name = light.name + ".shadowMap"; + shadow.camera.updateProjectionMatrix(); + } _renderer.setRenderTarget( shadow.map ); diff --git a/build/three.min.js b/build/three.min.js index 6c4737cf997109..5a215473c82142 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -1,4 +1,3 @@ -// threejs.org/license (function(k,sa){"object"===typeof exports&&"undefined"!==typeof module?sa(exports):"function"===typeof define&&define.amd?define(["exports"],sa):(k=k||self,sa(k.THREE={}))})(this,function(k){function sa(){}function A(a,b){this.x=a||0;this.y=b||0}function ra(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}function n(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}function ka(){this.elements=[1,0,0,0,1,0,0,0,1];0c||g.y>c)console.warn("THREE.WebGLShadowMap:",n,"has shadow exceeding max texture size, reducing"), -g.x>c&&(h.x=Math.floor(c/v.x),g.x=h.x*v.x,w.mapSize.x=h.x),g.y>c&&(h.y=Math.floor(c/v.y),g.y=h.y*v.y,w.mapSize.y=h.y);null===w.map&&(w.map=new bb(g.x,g.y,{minFilter:1003,magFilter:1003,format:1023}),w.map.texture.name=n.name+".shadowMap");a.setRenderTarget(w.map);a.clear();v=w.getViewportCount();for(var x=0;x -d||a.height>d)e=d/Math.max(a.width,a.height);if(1>e||!0===b){if("undefined"!==typeof HTMLImageElement&&a instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&a instanceof ImageBitmap)return d=b?P.floorPowerOfTwo:Math.floor,b=d(e*a.width),e=d(e*a.height),void 0===H&&(H=h(b,e)),c=c?h(b,e):H,c.width=b,c.height=e,c.getContext("2d").drawImage(a,0,0,b,e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ -a.width+"x"+a.height+") to ("+b+"x"+e+")."),c;"data"in a&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+a.width+"x"+a.height+").")}return a}function m(a){return P.isPowerOfTwo(a.width)&&P.isPowerOfTwo(a.height)}function q(a,b){return a.generateMipmaps&&b&&1003!==a.minFilter&&1006!==a.minFilter}function t(b,c,e,f){a.generateMipmap(b);d.get(c).__maxMipLevel=Math.log(Math.max(e,f))*Math.LOG2E}function k(a,c){if(!e.isWebGL2)return a;var d=a;6403===a&&(5126===c&&(d=33326),5131=== -c&&(d=33325),5121===c&&(d=33321));6407===a&&(5126===c&&(d=34837),5131===c&&(d=34843),5121===c&&(d=32849));6408===a&&(5126===c&&(d=34836),5131===c&&(d=34842),5121===c&&(d=32856));33325===d||33326===d||34842===d||34836===d?b.get("EXT_color_buffer_float"):(34843===d||34837===d)&&console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead.");return d}function r(a){return 1003===a||1004===a||1005===a?9728:9729}function p(b){b=b.target;b.removeEventListener("dispose", -p);var c=d.get(b);void 0!==c.__webglInit&&(a.deleteTexture(c.__webglTexture),d.remove(b));b.isVideoTexture&&Ca.delete(b);g.memory.textures--}function n(b){b=b.target;b.removeEventListener("dispose",n);var c=d.get(b),e=d.get(b.texture);if(b){void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(e=0;6>e;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]); -else a.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer);d.remove(b.texture);d.remove(b)}g.memory.textures--}function v(a,b){var e=d.get(a);if(a.isVideoTexture){var f=g.render.frame;Ca.get(a)!==f&&(Ca.set(a,f),a.update())}if(0p;p++)r[p]=u||g?g?b.image[p].image:b.image[p]:l(b.image[p],!1,!0,e.maxCubemapSize);var n=r[0],w=m(n)||e.isWebGL2,v=f.convert(b.format), -x=f.convert(b.type),ja=k(v,x);L(34067,b,w);if(u){for(p=0;6>p;p++){var B=r[p].mipmaps;for(u=0;up;p++)if(g)for(c.texImage2D(34069+ -p,0,ja,r[p].width,r[p].height,0,v,x,r[p].data),u=0;u=e.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+a+" texture units while this GPU supports only "+e.maxTextures);C+=1;return a};this.resetTextureUnits=function(){C=0};this.setTexture2D=v;this.setTexture2DArray=function(a,b){var e=d.get(a);0p;p++)h.__webglFramebuffer[p]=a.createFramebuffer();else if(h.__webglFramebuffer=a.createFramebuffer(), -p)if(e.isWebGL2){h.__webglMultisampledFramebuffer=a.createFramebuffer();h.__webglColorRenderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,h.__webglColorRenderbuffer);p=f.convert(b.texture.format);var w=f.convert(b.texture.type);p=k(p,w);w=z(b);a.renderbufferStorageMultisample(36161,w,p,b.width,b.height);a.bindFramebuffer(36160,h.__webglMultisampledFramebuffer);a.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);b.depthBuffer&&(h.__webglDepthRenderbuffer= -a.createRenderbuffer(),Y(h.__webglDepthRenderbuffer,b,!0));a.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(u){c.bindTexture(34067,l.__webglTexture);L(34067,b.texture,r);for(p=0;6>p;p++)A(h.__webglFramebuffer[p],b,36064,34069+p);q(b.texture,r)&&t(34067,b.texture,b.width,b.height);c.bindTexture(34067,null)}else c.bindTexture(3553,l.__webglTexture),L(3553,b.texture,r),A(h.__webglFramebuffer,b,36064,3553),q(b.texture, -r)&&t(3553,b.texture,b.width,b.height),c.bindTexture(3553,null);if(b.depthBuffer){h=d.get(b);l=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(l)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");a.bindFramebuffer(36160,h.__webglFramebuffer);if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture"); -d.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);v(b.depthTexture,0);h=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(36160,36096,3553,h,0);else if(1027===b.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,h,0);else throw Error("Unknown depthTexture format");}else if(l)for(h.__webglDepthbuffer= -[],l=0;6>l;l++)a.bindFramebuffer(36160,h.__webglFramebuffer[l]),h.__webglDepthbuffer[l]=a.createRenderbuffer(),Y(h.__webglDepthbuffer[l],b);else a.bindFramebuffer(36160,h.__webglFramebuffer),h.__webglDepthbuffer=a.createRenderbuffer(),Y(h.__webglDepthbuffer,b);a.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap=function(a){var b=a.texture,f=m(a)||e.isWebGL2;if(q(b,f)){f=a.isWebGLRenderTargetCube?34067:3553;var g=d.get(b).__webglTexture;c.bindTexture(f,g);t(f,b,a.width,a.height);c.bindTexture(f, -null)}};this.updateMultisampleRenderTarget=function(b){if(b.isWebGLMultisampleRenderTarget)if(e.isWebGL2){var c=d.get(b);a.bindFramebuffer(36008,c.__webglMultisampledFramebuffer);a.bindFramebuffer(36009,c.__webglFramebuffer);c=b.width;var f=b.height,g=16384;b.depthBuffer&&(g|=256);b.stencilBuffer&&(g|=1024);a.blitFramebuffer(0,0,c,f,0,0,c,f,g,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")};this.safeSetTexture2D=function(a,b){a&&a.isWebGLRenderTarget&& -(!1===I&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),I=!0),a=a.texture);v(a,b)};this.safeSetTextureCube=function(a,b){a&&a.isWebGLRenderTargetCube&&(!1===G&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),G=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&&6===a.image.length?y(a,b):x(a,b)}}function Ch(a,b,c){return{convert:function(a){if(1E3=== -a)return 10497;if(1001===a)return 33071;if(1002===a)return 33648;if(1003===a)return 9728;if(1004===a)return 9984;if(1005===a)return 9986;if(1006===a)return 9729;if(1007===a)return 9985;if(1008===a)return 9987;if(1009===a)return 5121;if(1017===a)return 32819;if(1018===a)return 32820;if(1019===a)return 33635;if(1010===a)return 5120;if(1011===a)return 5122;if(1012===a)return 5123;if(1013===a)return 5124;if(1014===a)return 5125;if(1015===a)return 5126;if(1016===a){if(c.isWebGL2)return 5131;var d=b.get("OES_texture_half_float"); -if(null!==d)return d.HALF_FLOAT_OES}if(1021===a)return 6406;if(1022===a)return 6407;if(1023===a)return 6408;if(1024===a)return 6409;if(1025===a)return 6410;if(1026===a)return 6402;if(1027===a)return 34041;if(1028===a)return 6403;if(100===a)return 32774;if(101===a)return 32778;if(102===a)return 32779;if(200===a)return 0;if(201===a)return 1;if(202===a)return 768;if(203===a)return 769;if(204===a)return 770;if(205===a)return 771;if(206===a)return 772;if(207===a)return 773;if(208===a)return 774;if(209=== -a)return 775;if(210===a)return 776;if(33776===a||33777===a||33778===a||33779===a)if(d=b.get("WEBGL_compressed_texture_s3tc"),null!==d){if(33776===a)return d.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===a)return d.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===a)return d.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===a)return d.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===a||35841===a||35842===a||35843===a)if(d=b.get("WEBGL_compressed_texture_pvrtc"),null!==d){if(35840===a)return d.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841=== -a)return d.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===a)return d.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===a)return d.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===a&&(d=b.get("WEBGL_compressed_texture_etc1"),null!==d))return d.COMPRESSED_RGB_ETC1_WEBGL;if(37808===a||37809===a||37810===a||37811===a||37812===a||37813===a||37814===a||37815===a||37816===a||37817===a||37818===a||37819===a||37820===a||37821===a)if(d=b.get("WEBGL_compressed_texture_astc"),null!==d)return a;if(103===a||104===a){if(c.isWebGL2){if(103=== -a)return 32775;if(104===a)return 32776}d=b.get("EXT_blend_minmax");if(null!==d){if(103===a)return d.MIN_EXT;if(104===a)return d.MAX_EXT}}if(1020===a){if(c.isWebGL2)return 34042;d=b.get("WEBGL_depth_texture");if(null!==d)return d.UNSIGNED_INT_24_8_WEBGL}return 0}}}function Jc(){D.call(this);this.type="Group"}function Ld(a){V.call(this);this.cameras=a||[]}function Dh(a,b,c){Eh.setFromMatrixPosition(b.matrixWorld);Fh.setFromMatrixPosition(c.matrixWorld);var d=Eh.distanceTo(Fh),e=b.projectionMatrix.elements, -f=c.projectionMatrix.elements,g=e[14]/(e[10]-1);c=e[14]/(e[10]+1);var h=(e[9]+1)/e[5],l=(e[9]-1)/e[5],m=(e[8]-1)/e[0],q=(f[8]+1)/f[0];e=g*m;f=g*q;q=d/(-m+q);m=q*-m;b.matrixWorld.decompose(a.position,a.quaternion,a.scale);a.translateX(m);a.translateZ(q);a.matrixWorld.compose(a.position,a.quaternion,a.scale);a.matrixWorldInverse.getInverse(a.matrixWorld);b=g+q;g=c+q;a.projectionMatrix.makePerspective(e-m,f+(d-m),h*c/g*b,l*c/g*b,b,g)}function Yf(a){function b(){return null!==h&&!0===h.isPresenting}function c(){if(b()){var c= -h.getEyeParameters("left");e=2*c.renderWidth*r;f=c.renderHeight*r;Ga=a.getPixelRatio();a.getSize(B);a.setDrawingBufferSize(e,f,1);x.viewport.set(0,0,e/2,f);L.viewport.set(e/2,0,e/2,f);z.start();g.dispatchEvent({type:"sessionstart"})}else g.enabled&&a.setDrawingBufferSize(B.width,B.height,Ga),z.stop(),g.dispatchEvent({type:"sessionend"})}function d(a,b){null!==b&&4===b.length&&a.set(b[0]*e,b[1]*f,b[2]*e,b[3]*f)}var e,f,g=this,h=null,l=null,m=null,q=[],t=new R,k=new R,r=1,p="local-floor";"undefined"!== -typeof window&&"VRFrameData"in window&&(l=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",c,!1));var w=new R,v=new ra,y=new n,x=new V;x.viewport=new Z;x.layers.enable(1);var L=new V;L.viewport=new Z;L.layers.enable(2);var N=new Ld([x,L]);N.layers.enable(1);N.layers.enable(2);var B=new A,Ga,Y=[];this.enabled=!1;this.getController=function(a){var b=q[a];void 0===b&&(b=new Jc,b.matrixAutoUpdate=!1,b.visible=!1,q[a]=b);return b};this.getDevice=function(){return h};this.setDevice= -function(a){void 0!==a&&(h=a);z.setContext(a)};this.setFramebufferScaleFactor=function(a){r=a};this.setReferenceSpaceType=function(a){p=a};this.setPoseTarget=function(a){void 0!==a&&(m=a)};this.getCamera=function(a){var c="local-floor"===p?1.6:0;if(!1===b())return a.position.set(0,c,0),a.rotation.set(0,0,0),a;h.depthNear=a.near;h.depthFar=a.far;h.getFrameData(l);if("local-floor"===p){var e=h.stageParameters;e?t.fromArray(e.sittingToStandingTransform):t.makeTranslation(0,c,0)}c=l.pose;e=null!==m?m: -a;e.matrix.copy(t);e.matrix.decompose(e.position,e.quaternion,e.scale);null!==c.orientation&&(v.fromArray(c.orientation),e.quaternion.multiply(v));null!==c.position&&(v.setFromRotationMatrix(t),y.fromArray(c.position),y.applyQuaternion(v),e.position.add(y));e.updateMatrixWorld();x.near=a.near;L.near=a.near;x.far=a.far;L.far=a.far;x.matrixWorldInverse.fromArray(l.leftViewMatrix);L.matrixWorldInverse.fromArray(l.rightViewMatrix);k.getInverse(t);"local-floor"===p&&(x.matrixWorldInverse.multiply(k),L.matrixWorldInverse.multiply(k)); -a=e.parent;null!==a&&(w.getInverse(a.matrixWorld),x.matrixWorldInverse.multiply(w),L.matrixWorldInverse.multiply(w));x.matrixWorld.getInverse(x.matrixWorldInverse);L.matrixWorld.getInverse(L.matrixWorldInverse);x.projectionMatrix.fromArray(l.leftProjectionMatrix);L.projectionMatrix.fromArray(l.rightProjectionMatrix);Dh(N,x,L);a=h.getLayers();a.length&&(a=a[0],d(x.viewport,a.leftBounds),d(L.viewport,a.rightBounds));a:for(a=0;af.matrixWorld.determinant();da.setMaterial(e,h);var l=u(a,c,e,f),m=!1;if(b!==d.id||X!==l.id||U!==(!0===e.wireframe))b=d.id,X=l.id,U=!0===e.wireframe,m=!0;f.morphTargetInfluences&&(za.update(f,d,e,l),m=!0);h=d.index;var q=d.attributes.position;c=1;!0===e.wireframe&&(h=xa.getWireframeAttribute(d),c=2);a=Ba;if(null!==h){var k=va.get(h);a=Da;a.setIndex(k)}if(m){if(d&&d.isInstancedBufferGeometry&& -!Fa.isWebGL2&&null===oa.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{da.initAttributes();m=d.attributes;l=l.getAttributes();var t=e.defaultAttributeValues;for(N in l){var p=l[N];if(0<=p){var r=m[N];if(void 0!==r){var n=r.normalized,w=r.itemSize,v=va.get(r);if(void 0!==v){var x=v.buffer,y=v.type;v=v.bytesPerElement;if(r.isInterleavedBufferAttribute){var B= -r.data,L=B.stride;r=r.offset;B&&B.isInstancedInterleavedBuffer?(da.enableAttributeAndDivisor(p,B.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=B.meshPerAttribute*B.count)):da.enableAttribute(p);K.bindBuffer(34962,x);K.vertexAttribPointer(p,w,y,n,L*v,r*v)}else r.isInstancedBufferAttribute?(da.enableAttributeAndDivisor(p,r.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=r.meshPerAttribute*r.count)):da.enableAttribute(p),K.bindBuffer(34962,x),K.vertexAttribPointer(p, -w,y,n,0,0)}}else if(void 0!==t&&(n=t[N],void 0!==n))switch(n.length){case 2:K.vertexAttrib2fv(p,n);break;case 3:K.vertexAttrib3fv(p,n);break;case 4:K.vertexAttrib4fv(p,n);break;default:K.vertexAttrib1fv(p,n)}}}da.disableUnusedAttributes()}null!==h&&K.bindBuffer(34963,k.buffer)}k=Infinity;null!==h?k=h.count:void 0!==q&&(k=q.count);h=d.drawRange.start*c;q=null!==g?g.start*c:0;var N=Math.max(h,q);g=Math.max(0,Math.min(k,h+d.drawRange.count*c,q+(null!==g?g.count*c:Infinity))-1-N+1);if(0!==g){if(f.isMesh)if(!0=== -e.wireframe)da.setLineWidth(e.wireframeLinewidth*(null===M?ca:1)),a.setMode(1);else switch(f.drawMode){case 0:a.setMode(4);break;case 1:a.setMode(5);break;case 2:a.setMode(6)}else f.isLine?(e=e.linewidth,void 0===e&&(e=1),da.setLineWidth(e*(null===M?ca:1)),f.isLineSegments?a.setMode(1):f.isLineLoop?a.setMode(2):a.setMode(3)):f.isPoints?a.setMode(0):f.isSprite&&a.setMode(4);d&&d.isInstancedBufferGeometry?0e.far||f.push({distance:a,distanceToRay:Math.sqrt(h),point:c,index:b,face:null,object:g}))}function cg(a,b,c,d,e,f,g,h,l){T.call(this,a,b,c,d,e,f,g,h,l);this.format=void 0!==g?g:1022;this.minFilter=void 0!==f?f:1006;this.magFilter=void 0!==e?e:1006;this.generateMipmaps=!1}function Nc(a,b,c,d,e,f,g,h,l,m,q,k){T.call(this,null,f,g,h,l,m,d,e,q,k);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function Rd(a, -b,c,d,e,f,g,h,l){T.call(this,a,b,c,d,e,f,g,h,l);this.needsUpdate=!0}function Sd(a,b,c,d,e,f,g,h,l,m){m=void 0!==m?m:1026;if(1026!==m&&1027!==m)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===c&&1026===m&&(c=1012);void 0===c&&1027===m&&(c=1020);T.call(this,null,d,e,f,g,h,m,c,l);this.image={width:a,height:b};this.magFilter=void 0!==g?g:1003;this.minFilter=void 0!==h?h:1003;this.generateMipmaps=this.flipY=!1}function Oc(a){C.call(this);this.type= -"WireframeGeometry";var b=[],c,d,e,f=[0,0],g={},h=["a","b","c"];if(a&&a.isGeometry){var l=a.faces;var m=0;for(d=l.length;mc;c++){var k=q[h[c]];var u=q[h[(c+1)%3]];f[0]=Math.min(k,u);f[1]=Math.max(k,u);k=f[0]+","+f[1];void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]})}}for(k in g)m=g[k],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&&a.isBufferGeometry)if(h=new n,null!==a.index){l=a.attributes.position;q=a.index;var r=a.groups; -0===r.length&&(r=[{start:0,count:q.count,materialIndex:0}]);a=0;for(e=r.length;ac;c++)k=q.getX(m+c),u=q.getX(m+(c+1)%3),f[0]=Math.min(k,u),f[1]=Math.max(k,u),k=f[0]+","+f[1],void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]});for(k in g)m=g[k],h.fromBufferAttribute(l,m.index1),b.push(h.x,h.y,h.z),h.fromBufferAttribute(l,m.index2),b.push(h.x,h.y,h.z)}else for(l=a.attributes.position,m=0,d=l.count/3;mc;c++)g=3*m+c,h.fromBufferAttribute(l, -g),b.push(h.x,h.y,h.z),g=3*m+(c+1)%3,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z);this.addAttribute("position",new z(b,3))}function Td(a,b,c){E.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};this.fromBufferGeometry(new Pc(a,b,c));this.mergeVertices()}function Pc(a,b,c){C.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g=[],h=new n,l=new n,m=new n,q=new n,k=new n,u,r;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter."); -var p=b+1;for(u=0;u<=c;u++){var w=u/c;for(r=0;r<=b;r++){var v=r/b;a(v,w,l);e.push(l.x,l.y,l.z);0<=v-1E-5?(a(v-1E-5,w,m),q.subVectors(l,m)):(a(v+1E-5,w,m),q.subVectors(m,l));0<=w-1E-5?(a(v,w-1E-5,m),k.subVectors(l,m)):(a(v,w+1E-5,m),k.subVectors(m,l));h.crossVectors(q,k).normalize();f.push(h.x,h.y,h.z);g.push(v,w)}}for(u=0;ud&&1===a.x&&(l[b]=a.x-1);0===c.x&&0===c.z&&(l[b]=d/2/Math.PI+.5)}C.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:a, -indices:b,radius:c,detail:d};c=c||1;d=d||0;var h=[],l=[];(function(a){for(var c=new n,d=new n,g=new n,h=0;he&&(.2>b&&(l[a+0]+=1),.2>c&&(l[a+2]+=1),.2>d&&(l[a+4]+=1))})();this.addAttribute("position",new z(h,3));this.addAttribute("normal",new z(h.slice(),3));this.addAttribute("uv",new z(l,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Vd(a, -b){E.call(this);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Qc(a,b));this.mergeVertices()}function Qc(a,b){la.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Wd(a,b){E.call(this);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new dc(a,b));this.mergeVertices()}function dc(a,b){la.call(this,[1,0,0, --1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Xd(a,b){E.call(this);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Rc(a,b));this.mergeVertices()}function Rc(a,b){var c=(1+Math.sqrt(5))/2;la.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5, -11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Yd(a,b){E.call(this);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Sc(a,b));this.mergeVertices()}function Sc(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;la.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,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Zd(a,b,c,d,e,f){E.call(this);this.type="TubeGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d, -closed:e};void 0!==f&&console.warn("THREE.TubeGeometry: taper has been removed.");a=new ec(a,b,c,d,e);this.tangents=a.tangents;this.normals=a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function ec(a,b,c,d,e){function f(e){q=a.getPointAt(e/b,q);var f=g.normals[e];e=g.binormals[e];for(u=0;u<=d;u++){var m=u/d*Math.PI*2,k=Math.sin(m);m=-Math.cos(m);l.x=m*f.x+k*e.x;l.y=m*f.y+k*e.y;l.z=m*f.z+k*e.z;l.normalize();p.push(l.x,l.y,l.z);h.x=q.x+c*l.x;h.y=q.y+c*l.y;h.z= -q.z+c*l.z;r.push(h.x,h.y,h.z)}}C.call(this);this.type="TubeBufferGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;var g=a.computeFrenetFrames(b,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new n,l=new n,m=new A,q=new n,k,u,r=[],p=[],w=[],v=[];for(k=0;kc&&(h.x=Math.floor(c/v.x),g.x=h.x*v.x,w.mapSize.x=h.x),g.y>c&&(h.y=Math.floor(c/v.y),g.y=h.y*v.y,w.mapSize.y=h.y);null===w.map&&(w.map=new bb(g.x,g.y,{minFilter:1003,magFilter:1003,format:1023}),w.map.texture.name=n.name+".shadowMap",w.camera.updateProjectionMatrix());a.setRenderTarget(w.map);a.clear();v=w.getViewportCount();for(var x=0;xd||a.height>d)e=d/Math.max(a.width,a.height);if(1>e||!0===b){if("undefined"!==typeof HTMLImageElement&&a instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&a instanceof ImageBitmap)return d=b?P.floorPowerOfTwo:Math.floor,b=d(e*a.width),e=d(e*a.height),void 0=== +H&&(H=h(b,e)),c=c?h(b,e):H,c.width=b,c.height=e,c.getContext("2d").drawImage(a,0,0,b,e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+a.width+"x"+a.height+") to ("+b+"x"+e+")."),c;"data"in a&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+a.width+"x"+a.height+").")}return a}function m(a){return P.isPowerOfTwo(a.width)&&P.isPowerOfTwo(a.height)}function q(a,b){return a.generateMipmaps&&b&&1003!==a.minFilter&&1006!==a.minFilter}function t(b,c,e,f){a.generateMipmap(b); +d.get(c).__maxMipLevel=Math.log(Math.max(e,f))*Math.LOG2E}function k(a,c){if(!e.isWebGL2)return a;var d=a;6403===a&&(5126===c&&(d=33326),5131===c&&(d=33325),5121===c&&(d=33321));6407===a&&(5126===c&&(d=34837),5131===c&&(d=34843),5121===c&&(d=32849));6408===a&&(5126===c&&(d=34836),5131===c&&(d=34842),5121===c&&(d=32856));33325===d||33326===d||34842===d||34836===d?b.get("EXT_color_buffer_float"):(34843===d||34837===d)&&console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."); +return d}function r(a){return 1003===a||1004===a||1005===a?9728:9729}function p(b){b=b.target;b.removeEventListener("dispose",p);var c=d.get(b);void 0!==c.__webglInit&&(a.deleteTexture(c.__webglTexture),d.remove(b));b.isVideoTexture&&Ca.delete(b);g.memory.textures--}function n(b){b=b.target;b.removeEventListener("dispose",n);var c=d.get(b),e=d.get(b.texture);if(b){void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(e= +0;6>e;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]);else a.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer);d.remove(b.texture);d.remove(b)}g.memory.textures--}function v(a,b){var e=d.get(a);if(a.isVideoTexture){var f=g.render.frame;Ca.get(a)!==f&&(Ca.set(a,f),a.update())}if(0p;p++)r[p]=u||g?g?b.image[p].image: +b.image[p]:l(b.image[p],!1,!0,e.maxCubemapSize);var n=r[0],w=m(n)||e.isWebGL2,v=f.convert(b.format),x=f.convert(b.type),ja=k(v,x);L(34067,b,w);if(u){for(p=0;6>p;p++){var B=r[p].mipmaps;for(u=0;up;p++)if(g)for(c.texImage2D(34069+p,0,ja,r[p].width,r[p].height,0,v,x,r[p].data),u=0;u=e.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+a+" texture units while this GPU supports only "+e.maxTextures);C+=1;return a};this.resetTextureUnits=function(){C=0};this.setTexture2D=v;this.setTexture2DArray=function(a,b){var e=d.get(a);0p;p++)h.__webglFramebuffer[p]=a.createFramebuffer();else if(h.__webglFramebuffer=a.createFramebuffer(),p)if(e.isWebGL2){h.__webglMultisampledFramebuffer=a.createFramebuffer();h.__webglColorRenderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,h.__webglColorRenderbuffer);p=f.convert(b.texture.format);var w=f.convert(b.texture.type);p=k(p,w);w=z(b);a.renderbufferStorageMultisample(36161,w,p,b.width,b.height);a.bindFramebuffer(36160,h.__webglMultisampledFramebuffer); +a.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);b.depthBuffer&&(h.__webglDepthRenderbuffer=a.createRenderbuffer(),Y(h.__webglDepthRenderbuffer,b,!0));a.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(u){c.bindTexture(34067,l.__webglTexture);L(34067,b.texture,r);for(p=0;6>p;p++)A(h.__webglFramebuffer[p],b,36064,34069+p);q(b.texture,r)&&t(34067,b.texture,b.width, +b.height);c.bindTexture(34067,null)}else c.bindTexture(3553,l.__webglTexture),L(3553,b.texture,r),A(h.__webglFramebuffer,b,36064,3553),q(b.texture,r)&&t(3553,b.texture,b.width,b.height),c.bindTexture(3553,null);if(b.depthBuffer){h=d.get(b);l=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(l)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");a.bindFramebuffer(36160,h.__webglFramebuffer); +if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);v(b.depthTexture,0);h=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(36160,36096,3553,h,0);else if(1027=== +b.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,h,0);else throw Error("Unknown depthTexture format");}else if(l)for(h.__webglDepthbuffer=[],l=0;6>l;l++)a.bindFramebuffer(36160,h.__webglFramebuffer[l]),h.__webglDepthbuffer[l]=a.createRenderbuffer(),Y(h.__webglDepthbuffer[l],b);else a.bindFramebuffer(36160,h.__webglFramebuffer),h.__webglDepthbuffer=a.createRenderbuffer(),Y(h.__webglDepthbuffer,b);a.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap=function(a){var b=a.texture, +f=m(a)||e.isWebGL2;if(q(b,f)){f=a.isWebGLRenderTargetCube?34067:3553;var g=d.get(b).__webglTexture;c.bindTexture(f,g);t(f,b,a.width,a.height);c.bindTexture(f,null)}};this.updateMultisampleRenderTarget=function(b){if(b.isWebGLMultisampleRenderTarget)if(e.isWebGL2){var c=d.get(b);a.bindFramebuffer(36008,c.__webglMultisampledFramebuffer);a.bindFramebuffer(36009,c.__webglFramebuffer);c=b.width;var f=b.height,g=16384;b.depthBuffer&&(g|=256);b.stencilBuffer&&(g|=1024);a.blitFramebuffer(0,0,c,f,0,0,c,f, +g,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")};this.safeSetTexture2D=function(a,b){a&&a.isWebGLRenderTarget&&(!1===I&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),I=!0),a=a.texture);v(a,b)};this.safeSetTextureCube=function(a,b){a&&a.isWebGLRenderTargetCube&&(!1===G&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."), +G=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&&6===a.image.length?y(a,b):x(a,b)}}function Ch(a,b,c){return{convert:function(a){if(1E3===a)return 10497;if(1001===a)return 33071;if(1002===a)return 33648;if(1003===a)return 9728;if(1004===a)return 9984;if(1005===a)return 9986;if(1006===a)return 9729;if(1007===a)return 9985;if(1008===a)return 9987;if(1009===a)return 5121;if(1017===a)return 32819;if(1018===a)return 32820;if(1019===a)return 33635;if(1010===a)return 5120;if(1011===a)return 5122; +if(1012===a)return 5123;if(1013===a)return 5124;if(1014===a)return 5125;if(1015===a)return 5126;if(1016===a){if(c.isWebGL2)return 5131;var d=b.get("OES_texture_half_float");if(null!==d)return d.HALF_FLOAT_OES}if(1021===a)return 6406;if(1022===a)return 6407;if(1023===a)return 6408;if(1024===a)return 6409;if(1025===a)return 6410;if(1026===a)return 6402;if(1027===a)return 34041;if(1028===a)return 6403;if(100===a)return 32774;if(101===a)return 32778;if(102===a)return 32779;if(200===a)return 0;if(201=== +a)return 1;if(202===a)return 768;if(203===a)return 769;if(204===a)return 770;if(205===a)return 771;if(206===a)return 772;if(207===a)return 773;if(208===a)return 774;if(209===a)return 775;if(210===a)return 776;if(33776===a||33777===a||33778===a||33779===a)if(d=b.get("WEBGL_compressed_texture_s3tc"),null!==d){if(33776===a)return d.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===a)return d.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===a)return d.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===a)return d.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840=== +a||35841===a||35842===a||35843===a)if(d=b.get("WEBGL_compressed_texture_pvrtc"),null!==d){if(35840===a)return d.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===a)return d.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===a)return d.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===a)return d.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===a&&(d=b.get("WEBGL_compressed_texture_etc1"),null!==d))return d.COMPRESSED_RGB_ETC1_WEBGL;if(37808===a||37809===a||37810===a||37811===a||37812===a||37813===a||37814===a||37815===a||37816=== +a||37817===a||37818===a||37819===a||37820===a||37821===a)if(d=b.get("WEBGL_compressed_texture_astc"),null!==d)return a;if(103===a||104===a){if(c.isWebGL2){if(103===a)return 32775;if(104===a)return 32776}d=b.get("EXT_blend_minmax");if(null!==d){if(103===a)return d.MIN_EXT;if(104===a)return d.MAX_EXT}}if(1020===a){if(c.isWebGL2)return 34042;d=b.get("WEBGL_depth_texture");if(null!==d)return d.UNSIGNED_INT_24_8_WEBGL}return 0}}}function Jc(){D.call(this);this.type="Group"}function Ld(a){V.call(this); +this.cameras=a||[]}function Dh(a,b,c){Eh.setFromMatrixPosition(b.matrixWorld);Fh.setFromMatrixPosition(c.matrixWorld);var d=Eh.distanceTo(Fh),e=b.projectionMatrix.elements,f=c.projectionMatrix.elements,g=e[14]/(e[10]-1);c=e[14]/(e[10]+1);var h=(e[9]+1)/e[5],l=(e[9]-1)/e[5],m=(e[8]-1)/e[0],q=(f[8]+1)/f[0];e=g*m;f=g*q;q=d/(-m+q);m=q*-m;b.matrixWorld.decompose(a.position,a.quaternion,a.scale);a.translateX(m);a.translateZ(q);a.matrixWorld.compose(a.position,a.quaternion,a.scale);a.matrixWorldInverse.getInverse(a.matrixWorld); +b=g+q;g=c+q;a.projectionMatrix.makePerspective(e-m,f+(d-m),h*c/g*b,l*c/g*b,b,g)}function Yf(a){function b(){return null!==h&&!0===h.isPresenting}function c(){if(b()){var c=h.getEyeParameters("left");e=2*c.renderWidth*r;f=c.renderHeight*r;Ga=a.getPixelRatio();a.getSize(B);a.setDrawingBufferSize(e,f,1);x.viewport.set(0,0,e/2,f);L.viewport.set(e/2,0,e/2,f);z.start();g.dispatchEvent({type:"sessionstart"})}else g.enabled&&a.setDrawingBufferSize(B.width,B.height,Ga),z.stop(),g.dispatchEvent({type:"sessionend"})} +function d(a,b){null!==b&&4===b.length&&a.set(b[0]*e,b[1]*f,b[2]*e,b[3]*f)}var e,f,g=this,h=null,l=null,m=null,q=[],t=new R,k=new R,r=1,p="local-floor";"undefined"!==typeof window&&"VRFrameData"in window&&(l=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",c,!1));var w=new R,v=new ra,y=new n,x=new V;x.viewport=new Z;x.layers.enable(1);var L=new V;L.viewport=new Z;L.layers.enable(2);var N=new Ld([x,L]);N.layers.enable(1);N.layers.enable(2);var B=new A,Ga,Y=[];this.enabled=!1; +this.getController=function(a){var b=q[a];void 0===b&&(b=new Jc,b.matrixAutoUpdate=!1,b.visible=!1,q[a]=b);return b};this.getDevice=function(){return h};this.setDevice=function(a){void 0!==a&&(h=a);z.setContext(a)};this.setFramebufferScaleFactor=function(a){r=a};this.setReferenceSpaceType=function(a){p=a};this.setPoseTarget=function(a){void 0!==a&&(m=a)};this.getCamera=function(a){var c="local-floor"===p?1.6:0;if(!1===b())return a.position.set(0,c,0),a.rotation.set(0,0,0),a;h.depthNear=a.near;h.depthFar= +a.far;h.getFrameData(l);if("local-floor"===p){var e=h.stageParameters;e?t.fromArray(e.sittingToStandingTransform):t.makeTranslation(0,c,0)}c=l.pose;e=null!==m?m:a;e.matrix.copy(t);e.matrix.decompose(e.position,e.quaternion,e.scale);null!==c.orientation&&(v.fromArray(c.orientation),e.quaternion.multiply(v));null!==c.position&&(v.setFromRotationMatrix(t),y.fromArray(c.position),y.applyQuaternion(v),e.position.add(y));e.updateMatrixWorld();x.near=a.near;L.near=a.near;x.far=a.far;L.far=a.far;x.matrixWorldInverse.fromArray(l.leftViewMatrix); +L.matrixWorldInverse.fromArray(l.rightViewMatrix);k.getInverse(t);"local-floor"===p&&(x.matrixWorldInverse.multiply(k),L.matrixWorldInverse.multiply(k));a=e.parent;null!==a&&(w.getInverse(a.matrixWorld),x.matrixWorldInverse.multiply(w),L.matrixWorldInverse.multiply(w));x.matrixWorld.getInverse(x.matrixWorldInverse);L.matrixWorld.getInverse(L.matrixWorldInverse);x.projectionMatrix.fromArray(l.leftProjectionMatrix);L.projectionMatrix.fromArray(l.rightProjectionMatrix);Dh(N,x,L);a=h.getLayers();a.length&& +(a=a[0],d(x.viewport,a.leftBounds),d(L.viewport,a.rightBounds));a:for(a=0;af.matrixWorld.determinant();da.setMaterial(e,h);var l=u(a,c,e,f),m=!1;if(b!==d.id||X!==l.id||U!==(!0===e.wireframe))b=d.id,X=l.id,U=!0===e.wireframe,m=!0;f.morphTargetInfluences&&(za.update(f,d,e,l),m= +!0);h=d.index;var q=d.attributes.position;c=1;!0===e.wireframe&&(h=xa.getWireframeAttribute(d),c=2);a=Ba;if(null!==h){var k=va.get(h);a=Da;a.setIndex(k)}if(m){if(d&&d.isInstancedBufferGeometry&&!Fa.isWebGL2&&null===oa.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{da.initAttributes();m=d.attributes;l=l.getAttributes();var t=e.defaultAttributeValues;for(N in l){var p= +l[N];if(0<=p){var r=m[N];if(void 0!==r){var n=r.normalized,w=r.itemSize,v=va.get(r);if(void 0!==v){var x=v.buffer,y=v.type;v=v.bytesPerElement;if(r.isInterleavedBufferAttribute){var B=r.data,L=B.stride;r=r.offset;B&&B.isInstancedInterleavedBuffer?(da.enableAttributeAndDivisor(p,B.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=B.meshPerAttribute*B.count)):da.enableAttribute(p);K.bindBuffer(34962,x);K.vertexAttribPointer(p,w,y,n,L*v,r*v)}else r.isInstancedBufferAttribute?(da.enableAttributeAndDivisor(p, +r.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=r.meshPerAttribute*r.count)):da.enableAttribute(p),K.bindBuffer(34962,x),K.vertexAttribPointer(p,w,y,n,0,0)}}else if(void 0!==t&&(n=t[N],void 0!==n))switch(n.length){case 2:K.vertexAttrib2fv(p,n);break;case 3:K.vertexAttrib3fv(p,n);break;case 4:K.vertexAttrib4fv(p,n);break;default:K.vertexAttrib1fv(p,n)}}}da.disableUnusedAttributes()}null!==h&&K.bindBuffer(34963,k.buffer)}k=Infinity;null!==h?k=h.count:void 0!==q&&(k=q.count);h= +d.drawRange.start*c;q=null!==g?g.start*c:0;var N=Math.max(h,q);g=Math.max(0,Math.min(k,h+d.drawRange.count*c,q+(null!==g?g.count*c:Infinity))-1-N+1);if(0!==g){if(f.isMesh)if(!0===e.wireframe)da.setLineWidth(e.wireframeLinewidth*(null===M?ca:1)),a.setMode(1);else switch(f.drawMode){case 0:a.setMode(4);break;case 1:a.setMode(5);break;case 2:a.setMode(6)}else f.isLine?(e=e.linewidth,void 0===e&&(e=1),da.setLineWidth(e*(null===M?ca:1)),f.isLineSegments?a.setMode(1):f.isLineLoop?a.setMode(2):a.setMode(3)): +f.isPoints?a.setMode(0):f.isSprite&&a.setMode(4);d&&d.isInstancedBufferGeometry?0e.far||f.push({distance:a,distanceToRay:Math.sqrt(h), +point:c,index:b,face:null,object:g}))}function cg(a,b,c,d,e,f,g,h,l){T.call(this,a,b,c,d,e,f,g,h,l);this.format=void 0!==g?g:1022;this.minFilter=void 0!==f?f:1006;this.magFilter=void 0!==e?e:1006;this.generateMipmaps=!1}function Nc(a,b,c,d,e,f,g,h,l,m,q,k){T.call(this,null,f,g,h,l,m,d,e,q,k);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function Rd(a,b,c,d,e,f,g,h,l){T.call(this,a,b,c,d,e,f,g,h,l);this.needsUpdate=!0}function Sd(a,b,c,d,e,f,g,h,l,m){m=void 0!==m? +m:1026;if(1026!==m&&1027!==m)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===c&&1026===m&&(c=1012);void 0===c&&1027===m&&(c=1020);T.call(this,null,d,e,f,g,h,m,c,l);this.image={width:a,height:b};this.magFilter=void 0!==g?g:1003;this.minFilter=void 0!==h?h:1003;this.generateMipmaps=this.flipY=!1}function Oc(a){C.call(this);this.type="WireframeGeometry";var b=[],c,d,e,f=[0,0],g={},h=["a","b","c"];if(a&&a.isGeometry){var l=a.faces;var m=0;for(d= +l.length;mc;c++){var k=q[h[c]];var u=q[h[(c+1)%3]];f[0]=Math.min(k,u);f[1]=Math.max(k,u);k=f[0]+","+f[1];void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]})}}for(k in g)m=g[k],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&&a.isBufferGeometry)if(h=new n,null!==a.index){l=a.attributes.position;q=a.index;var r=a.groups;0===r.length&&(r=[{start:0,count:q.count,materialIndex:0}]);a=0;for(e=r.length;ac;c++)k=q.getX(m+c),u=q.getX(m+(c+1)%3),f[0]=Math.min(k,u),f[1]=Math.max(k,u),k=f[0]+","+f[1],void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]});for(k in g)m=g[k],h.fromBufferAttribute(l,m.index1),b.push(h.x,h.y,h.z),h.fromBufferAttribute(l,m.index2),b.push(h.x,h.y,h.z)}else for(l=a.attributes.position,m=0,d=l.count/3;mc;c++)g=3*m+c,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z),g=3*m+(c+1)%3,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z);this.addAttribute("position", +new z(b,3))}function Td(a,b,c){E.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};this.fromBufferGeometry(new Pc(a,b,c));this.mergeVertices()}function Pc(a,b,c){C.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g=[],h=new n,l=new n,m=new n,q=new n,k=new n,u,r;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var p=b+1;for(u=0;u<=c;u++){var w= +u/c;for(r=0;r<=b;r++){var v=r/b;a(v,w,l);e.push(l.x,l.y,l.z);0<=v-1E-5?(a(v-1E-5,w,m),q.subVectors(l,m)):(a(v+1E-5,w,m),q.subVectors(m,l));0<=w-1E-5?(a(v,w-1E-5,m),k.subVectors(l,m)):(a(v,w+1E-5,m),k.subVectors(m,l));h.crossVectors(q,k).normalize();f.push(h.x,h.y,h.z);g.push(v,w)}}for(u=0;ud&&1===a.x&&(l[b]=a.x-1);0===c.x&&0===c.z&&(l[b]=d/2/Math.PI+.5)}C.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c= +c||1;d=d||0;var h=[],l=[];(function(a){for(var c=new n,d=new n,g=new n,h=0;he&&(.2>b&&(l[a+0]+=1),.2>c&&(l[a+2]+=1),.2>d&&(l[a+4]+=1))})();this.addAttribute("position",new z(h,3));this.addAttribute("normal",new z(h.slice(),3));this.addAttribute("uv",new z(l,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Vd(a,b){E.call(this); +this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Qc(a,b));this.mergeVertices()}function Qc(a,b){la.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Wd(a,b){E.call(this);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new dc(a,b));this.mergeVertices()}function dc(a,b){la.call(this,[1,0,0,-1,0,0,0,1,0,0,-1, +0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Xd(a,b){E.call(this);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Rc(a,b));this.mergeVertices()}function Rc(a,b){var c=(1+Math.sqrt(5))/2;la.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7, +6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Yd(a,b){E.call(this);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Sc(a,b));this.mergeVertices()}function Sc(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;la.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,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Zd(a,b,c,d,e,f){E.call(this);this.type="TubeGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};void 0!== +f&&console.warn("THREE.TubeGeometry: taper has been removed.");a=new ec(a,b,c,d,e);this.tangents=a.tangents;this.normals=a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function ec(a,b,c,d,e){function f(e){q=a.getPointAt(e/b,q);var f=g.normals[e];e=g.binormals[e];for(u=0;u<=d;u++){var m=u/d*Math.PI*2,k=Math.sin(m);m=-Math.cos(m);l.x=m*f.x+k*e.x;l.y=m*f.y+k*e.y;l.z=m*f.z+k*e.z;l.normalize();p.push(l.x,l.y,l.z);h.x=q.x+c*l.x;h.y=q.y+c*l.y;h.z=q.z+c*l.z;r.push(h.x, +h.y,h.z)}}C.call(this);this.type="TubeBufferGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;var g=a.computeFrenetFrames(b,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new n,l=new n,m=new A,q=new n,k,u,r=[],p=[],w=[],v=[];for(k=0;k Date: Thu, 22 Aug 2019 10:27:01 -0400 Subject: [PATCH 4/4] Matching js material class names with glsl defines --- docs/api/en/materials/MeshPhysicalMaterial.html | 2 +- docs/api/en/materials/MeshStandardMaterial.html | 2 +- docs/api/zh/materials/MeshPhysicalMaterial.html | 2 +- docs/api/zh/materials/MeshStandardMaterial.html | 2 +- examples/js/effects/OutlineEffect.js | 2 +- examples/js/loaders/GLTFLoader.js | 2 +- examples/jsm/effects/OutlineEffect.js | 2 +- examples/jsm/loaders/GLTFLoader.js | 2 +- examples/jsm/nodes/materials/nodes/StandardNode.js | 2 +- src/materials/MeshPhysicalMaterial.js | 8 ++++---- src/materials/MeshStandardMaterial.js | 4 ++-- src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js | 2 +- .../ShaderChunk/clipping_planes_pars_fragment.glsl.js | 2 +- .../ShaderChunk/clipping_planes_pars_vertex.glsl.js | 2 +- .../shaders/ShaderChunk/clipping_planes_vertex.glsl.js | 2 +- .../shaders/ShaderChunk/lights_fragment_maps.glsl.js | 2 +- src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js | 8 +------- src/renderers/shaders/ShaderLib/meshphysical_vert.glsl.js | 2 +- 18 files changed, 22 insertions(+), 28 deletions(-) diff --git a/docs/api/en/materials/MeshPhysicalMaterial.html b/docs/api/en/materials/MeshPhysicalMaterial.html index 58b041af9af02a..0111a6f7d6727b 100644 --- a/docs/api/en/materials/MeshPhysicalMaterial.html +++ b/docs/api/en/materials/MeshPhysicalMaterial.html @@ -75,8 +75,8 @@

[property:Object defines]

{ + 'STANDARD': '' 'PHYSICAL': '', - 'ADVANCED_PHYSICAL': '' }; diff --git a/docs/api/en/materials/MeshStandardMaterial.html b/docs/api/en/materials/MeshStandardMaterial.html index 095c602f7300aa..e60c56eb213000 100644 --- a/docs/api/en/materials/MeshStandardMaterial.html +++ b/docs/api/en/materials/MeshStandardMaterial.html @@ -122,7 +122,7 @@

[property:Color color]

[property:Object defines]

An object of the form: - { 'PHYSICAL': '' }; + { 'STANDARD': '' }; This is used by the [page:WebGLRenderer] for selecting shaders. diff --git a/docs/api/zh/materials/MeshPhysicalMaterial.html b/docs/api/zh/materials/MeshPhysicalMaterial.html index d94ba06743855d..cf65d8c6dedd1b 100644 --- a/docs/api/zh/materials/MeshPhysicalMaterial.html +++ b/docs/api/zh/materials/MeshPhysicalMaterial.html @@ -69,8 +69,8 @@

[property:Object defines]

{ + 'STANDARD': '' 'PHYSICAL': '', - 'ADVANCED_PHYSICAL': '' }; diff --git a/docs/api/zh/materials/MeshStandardMaterial.html b/docs/api/zh/materials/MeshStandardMaterial.html index 7fefdc1807ab41..84985dc2d7bded 100644 --- a/docs/api/zh/materials/MeshStandardMaterial.html +++ b/docs/api/zh/materials/MeshStandardMaterial.html @@ -97,7 +97,7 @@

[property:Color color]

[property:Object defines]

如下形式的对象: - { 'PHYSICAL': '' }; + { 'STANDARD': '' }; [page:WebGLRenderer]使用它来选择shaders。

diff --git a/examples/js/effects/OutlineEffect.js b/examples/js/effects/OutlineEffect.js index fe06cd9382fdb2..bbffa58edb7edb 100644 --- a/examples/js/effects/OutlineEffect.js +++ b/examples/js/effects/OutlineEffect.js @@ -125,7 +125,7 @@ THREE.OutlineEffect = function ( renderer, parameters ) { var vertexShaderChunk2 = [ - "#if ! defined( LAMBERT ) && ! defined( PHONG ) && ! defined( TOON ) && ! defined( PHYSICAL )", + "#if ! defined( LAMBERT ) && ! defined( PHONG ) && ! defined( TOON ) && ! defined( STANDARD )", " #ifndef USE_ENVMAP", " vec3 objectNormal = normalize( normal );", " #endif", diff --git a/examples/js/loaders/GLTFLoader.js b/examples/js/loaders/GLTFLoader.js index e1aca10c559a1e..c071cec5240591 100644 --- a/examples/js/loaders/GLTFLoader.js +++ b/examples/js/loaders/GLTFLoader.js @@ -726,7 +726,7 @@ THREE.GLTFLoader = ( function () { materialParams.vertexShader = shader.vertexShader; materialParams.fragmentShader = fragmentShader; materialParams.uniforms = uniforms; - materialParams.defines = { 'PHYSICAL': '' } + materialParams.defines = { 'STANDARD': '' } materialParams.color = new THREE.Color( 1.0, 1.0, 1.0 ); materialParams.opacity = 1.0; diff --git a/examples/jsm/effects/OutlineEffect.js b/examples/jsm/effects/OutlineEffect.js index 64ec743d021193..655430e5d327d6 100644 --- a/examples/jsm/effects/OutlineEffect.js +++ b/examples/jsm/effects/OutlineEffect.js @@ -132,7 +132,7 @@ var OutlineEffect = function ( renderer, parameters ) { var vertexShaderChunk2 = [ - "#if ! defined( LAMBERT ) && ! defined( PHONG ) && ! defined( TOON ) && ! defined( PHYSICAL )", + "#if ! defined( LAMBERT ) && ! defined( PHONG ) && ! defined( TOON ) && ! defined( STANDARD )", " #ifndef USE_ENVMAP", " vec3 objectNormal = normalize( normal );", " #endif", diff --git a/examples/jsm/loaders/GLTFLoader.js b/examples/jsm/loaders/GLTFLoader.js index 239fc574dee571..472c68531bd7a1 100644 --- a/examples/jsm/loaders/GLTFLoader.js +++ b/examples/jsm/loaders/GLTFLoader.js @@ -791,7 +791,7 @@ var GLTFLoader = ( function () { materialParams.vertexShader = shader.vertexShader; materialParams.fragmentShader = fragmentShader; materialParams.uniforms = uniforms; - materialParams.defines = { 'PHYSICAL': '' } + materialParams.defines = { 'STANDARD': '' } materialParams.color = new Color( 1.0, 1.0, 1.0 ); materialParams.opacity = 1.0; diff --git a/examples/jsm/nodes/materials/nodes/StandardNode.js b/examples/jsm/nodes/materials/nodes/StandardNode.js index 69a98968c870e5..c940ff93615446 100644 --- a/examples/jsm/nodes/materials/nodes/StandardNode.js +++ b/examples/jsm/nodes/materials/nodes/StandardNode.js @@ -33,7 +33,7 @@ StandardNode.prototype.build = function ( builder ) { var code; - builder.define('PHYSICAL'); + builder.define('STANDARD'); var useClearcoat = this.clearcoat || this.clearcoatRoughness || this.clearCoatNormal; diff --git a/src/materials/MeshPhysicalMaterial.js b/src/materials/MeshPhysicalMaterial.js index 94f63eea744baf..49b8d416e41158 100644 --- a/src/materials/MeshPhysicalMaterial.js +++ b/src/materials/MeshPhysicalMaterial.js @@ -23,8 +23,8 @@ function MeshPhysicalMaterial( parameters ) { this.defines = { - 'PHYSICAL': '', - 'ADVANCED_PHYSICAL': '' + 'STANDARD': '', + 'PHYSICAL': '' }; @@ -55,8 +55,8 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) { this.defines = { - 'PHYSICAL': '', - 'ADVANCED_PHYSICAL': '' + 'STANDARD': '', + 'PHYSICAL': '' }; diff --git a/src/materials/MeshStandardMaterial.js b/src/materials/MeshStandardMaterial.js index 4a3f85c1f2c753..cbbe32dc34d1cf 100644 --- a/src/materials/MeshStandardMaterial.js +++ b/src/materials/MeshStandardMaterial.js @@ -59,7 +59,7 @@ function MeshStandardMaterial( parameters ) { Material.call( this ); - this.defines = { 'PHYSICAL': '' }; + this.defines = { 'STANDARD': '' }; this.type = 'MeshStandardMaterial'; @@ -123,7 +123,7 @@ MeshStandardMaterial.prototype.copy = function ( source ) { Material.prototype.copy.call( this, source ); - this.defines = { 'PHYSICAL': '' }; + this.defines = { 'STANDARD': '' }; this.color.copy( source.color ); this.roughness = source.roughness; diff --git a/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js b/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js index 3c15d332218ee7..7be3e3240835cb 100644 --- a/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +++ b/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js @@ -6,7 +6,7 @@ export default /* glsl */` reflectedLight.indirectDiffuse *= ambientOcclusion; - #if defined( USE_ENVMAP ) && defined( PHYSICAL ) + #if defined( USE_ENVMAP ) && defined( STANDARD ) float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); diff --git a/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js b/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js index ccdd963fcba8a1..6785ac70d19f33 100644 --- a/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js +++ b/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js @@ -1,7 +1,7 @@ export default /* glsl */` #if NUM_CLIPPING_PLANES > 0 - #if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP ) + #if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP ) varying vec3 vViewPosition; #endif diff --git a/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js b/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js index 44ade682b25dfc..088eb062b3f09c 100644 --- a/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js +++ b/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js @@ -1,5 +1,5 @@ export default /* glsl */` -#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP ) +#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP ) varying vec3 vViewPosition; #endif `; diff --git a/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js b/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js index 68862d3b1af805..d4662bfe106233 100644 --- a/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js +++ b/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js @@ -1,5 +1,5 @@ export default /* glsl */` -#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP ) +#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP ) vViewPosition = - mvPosition.xyz; #endif `; diff --git a/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js b/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js index 5226ddcad97180..4a65bb2465325b 100644 --- a/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +++ b/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js @@ -15,7 +15,7 @@ export default /* glsl */` #endif - #if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV ) + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) irradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, maxMipLevel ); diff --git a/src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js b/src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js index a053470f36508b..99cf483c307000 100644 --- a/src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js +++ b/src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js @@ -1,13 +1,7 @@ export default /* glsl */` -#define PHYSICAL_REFLECTION +#define STANDARD #ifdef PHYSICAL - - #define CLEARCOAT - -#endif - -#ifdef ADVANCED_PHYSICAL #define REFLECTIVITY #define CLEARCOAT #endif diff --git a/src/renderers/shaders/ShaderLib/meshphysical_vert.glsl.js b/src/renderers/shaders/ShaderLib/meshphysical_vert.glsl.js index 36410c0ba5aa46..3f73e2cd10d1c9 100644 --- a/src/renderers/shaders/ShaderLib/meshphysical_vert.glsl.js +++ b/src/renderers/shaders/ShaderLib/meshphysical_vert.glsl.js @@ -1,5 +1,5 @@ export default /* glsl */` -#define PHYSICAL +#define STANDARD varying vec3 vViewPosition;