language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
mrdoob
three.js
48b05d3500acc084df50be9b4c90781ad9b8cb17.json
Remove WebGLMultisampleRenderTarget. (#23455) * Remove WebGLMultisampleRenderTarget. * THREE.Legacy.js: Add WebGLMultisampleRenderTarget. * Exampels: Clean up. * WebGLRenderer: Use multisampling when possible without reporting errors. * Update WebGLRenderer.js Co-authored-by: mrdoob <info@mrdoob.com>
examples/webgl2_multisampled_renderbuffers.html
@@ -127,7 +127,7 @@ // const size = renderer.getDrawingBufferSize( new THREE.Vector2() ); - const renderTarget = new THREE.WebGLMultisampleRenderTarget( size.width, size.height ); + const renderTarget = new THREE.WebGLRenderTarget( size.width, size.height, { samples: 4 } ); const renderPass = new RenderPass( scene, camera ); const copyPass = new ShaderPass( CopyShader );
true
Other
mrdoob
three.js
48b05d3500acc084df50be9b4c90781ad9b8cb17.json
Remove WebGLMultisampleRenderTarget. (#23455) * Remove WebGLMultisampleRenderTarget. * THREE.Legacy.js: Add WebGLMultisampleRenderTarget. * Exampels: Clean up. * WebGLRenderer: Use multisampling when possible without reporting errors. * Update WebGLRenderer.js Co-authored-by: mrdoob <info@mrdoob.com>
src/Three.Legacy.js
@@ -1975,3 +1975,12 @@ export function ImmediateRenderObject() { console.error( 'THREE.ImmediateRenderObject has been removed.' ); } + +export function WebGLMultisampleRenderTarget( width, height, options ) { + + console.error( 'THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.' ); + const renderTarget = new WebGLRenderTarget( width, height, options ); + renderTarget.samples = 4; + return renderTarget; + +}
true
Other
mrdoob
three.js
48b05d3500acc084df50be9b4c90781ad9b8cb17.json
Remove WebGLMultisampleRenderTarget. (#23455) * Remove WebGLMultisampleRenderTarget. * THREE.Legacy.js: Add WebGLMultisampleRenderTarget. * Exampels: Clean up. * WebGLRenderer: Use multisampling when possible without reporting errors. * Update WebGLRenderer.js Co-authored-by: mrdoob <info@mrdoob.com>
src/Three.js
@@ -1,7 +1,6 @@ import { REVISION } from './constants.js'; export { WebGLMultipleRenderTargets } from './renderers/WebGLMultipleRenderTargets.js'; -export { WebGLMultisampleRenderTarget } from './renderers/WebGLMultisampleRenderTarget.js'; export { WebGLCubeRenderTarget } from './renderers/WebGLCubeRenderTarget.js'; export { WebGLRenderTarget } from './renderers/WebGLRenderTarget.js'; export { WebGLRenderer } from './renderers/WebGLRenderer.js';
true
Other
mrdoob
three.js
48b05d3500acc084df50be9b4c90781ad9b8cb17.json
Remove WebGLMultisampleRenderTarget. (#23455) * Remove WebGLMultisampleRenderTarget. * THREE.Legacy.js: Add WebGLMultisampleRenderTarget. * Exampels: Clean up. * WebGLRenderer: Use multisampling when possible without reporting errors. * Update WebGLRenderer.js Co-authored-by: mrdoob <info@mrdoob.com>
src/renderers/WebGLMultisampleRenderTarget.js
@@ -1,33 +0,0 @@ -import { WebGLRenderTarget } from './WebGLRenderTarget.js'; - -class WebGLMultisampleRenderTarget extends WebGLRenderTarget { - - constructor( width, height, options = {} ) { - - super( width, height, options ); - - this.samples = 4; - - this.ignoreDepthForMultisampleCopy = options.ignoreDepth !== undefined ? options.ignoreDepth : true; - this.useRenderToTexture = ( options.useRenderToTexture !== undefined ) ? options.useRenderToTexture : false; - this.useRenderbuffer = this.useRenderToTexture === false; - - } - - copy( source ) { - - super.copy.call( this, source ); - - this.samples = source.samples; - this.useRenderToTexture = source.useRenderToTexture; - this.useRenderbuffer = source.useRenderbuffer; - - return this; - - } - -} - -WebGLMultisampleRenderTarget.prototype.isWebGLMultisampleRenderTarget = true; - -export { WebGLMultisampleRenderTarget };
true
Other
mrdoob
three.js
48b05d3500acc084df50be9b4c90781ad9b8cb17.json
Remove WebGLMultisampleRenderTarget. (#23455) * Remove WebGLMultisampleRenderTarget. * THREE.Legacy.js: Add WebGLMultisampleRenderTarget. * Exampels: Clean up. * WebGLRenderer: Use multisampling when possible without reporting errors. * Update WebGLRenderer.js Co-authored-by: mrdoob <info@mrdoob.com>
src/renderers/WebGLRenderTarget.js
@@ -37,6 +37,8 @@ class WebGLRenderTarget extends EventDispatcher { this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null; + this.samples = options.samples !== undefined ? options.samples : 0; + } setTexture( texture ) { @@ -97,6 +99,8 @@ class WebGLRenderTarget extends EventDispatcher { if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone(); + this.samples = source.samples; + return this; }
true
Other
mrdoob
three.js
48b05d3500acc084df50be9b4c90781ad9b8cb17.json
Remove WebGLMultisampleRenderTarget. (#23455) * Remove WebGLMultisampleRenderTarget. * THREE.Legacy.js: Add WebGLMultisampleRenderTarget. * Exampels: Clean up. * WebGLRenderer: Use multisampling when possible without reporting errors. * Update WebGLRenderer.js Co-authored-by: mrdoob <info@mrdoob.com>
src/renderers/WebGLRenderer.js
@@ -31,7 +31,6 @@ import { WebGLGeometries } from './webgl/WebGLGeometries.js'; import { WebGLIndexedBufferRenderer } from './webgl/WebGLIndexedBufferRenderer.js'; import { WebGLInfo } from './webgl/WebGLInfo.js'; import { WebGLMorphtargets } from './webgl/WebGLMorphtargets.js'; -import { WebGLMultisampleRenderTarget } from './WebGLMultisampleRenderTarget.js'; import { WebGLObjects } from './webgl/WebGLObjects.js'; import { WebGLPrograms } from './webgl/WebGLPrograms.js'; import { WebGLProperties } from './webgl/WebGLProperties.js'; @@ -1189,13 +1188,11 @@ function WebGLRenderer( parameters = {} ) { if ( _transmissionRenderTarget === null ) { - const renderTargetType = ( isWebGL2 && _antialias === true ) ? WebGLMultisampleRenderTarget : WebGLRenderTarget; - - _transmissionRenderTarget = new renderTargetType( 1, 1, { + _transmissionRenderTarget = new WebGLRenderTarget( 1, 1, { generateMipmaps: true, - type: HalfFloatType, + type: utils.convert( HalfFloatType ) !== null ? HalfFloatType : UnsignedByteType, minFilter: LinearMipmapLinearFilter, - useRenderToTexture: extensions.has( 'WEBGL_multisampled_render_to_texture' ) + samples: ( isWebGL2 && _antialias === true ) ? 4 : 0 } ); } @@ -1797,7 +1794,7 @@ function WebGLRenderer( parameters = {} ) { // The multisample_render_to_texture extension doesn't work properly if there // are midframe flushes and an external depth buffer. Disable use of the extension. - if ( renderTarget.useRenderToTexture ) { + if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) { console.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' ); renderTarget.useRenderToTexture = false; @@ -1870,7 +1867,7 @@ function WebGLRenderer( parameters = {} ) { framebuffer = __webglFramebuffer[ activeCubeFace ]; isCube = true; - } else if ( renderTarget.useRenderbuffer ) { + } else if ( ( capabilities.isWebGL2 && renderTarget.samples > 0 ) && textures.useMultisampledRenderToTexture( renderTarget ) === false ) { framebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;
true
Other
mrdoob
three.js
48b05d3500acc084df50be9b4c90781ad9b8cb17.json
Remove WebGLMultisampleRenderTarget. (#23455) * Remove WebGLMultisampleRenderTarget. * THREE.Legacy.js: Add WebGLMultisampleRenderTarget. * Exampels: Clean up. * WebGLRenderer: Use multisampling when possible without reporting errors. * Update WebGLRenderer.js Co-authored-by: mrdoob <info@mrdoob.com>
src/renderers/webgl/WebGLTextures.js
@@ -10,8 +10,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, const maxCubemapSize = capabilities.maxCubemapSize; const maxTextureSize = capabilities.maxTextureSize; const maxSamples = capabilities.maxSamples; - const hasMultisampledRenderToTexture = extensions.has( 'WEBGL_multisampled_render_to_texture' ); - const MultisampledRenderToTextureExtension = hasMultisampledRenderToTexture ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : undefined; + const MultisampledRenderToTextureExtension = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null; const _videoTextures = new WeakMap(); let _canvas; @@ -1233,7 +1232,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, } state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer ); - if ( renderTarget.useRenderToTexture ) { + + if ( useMultisampledRenderToTexture( renderTarget ) ) { MultisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) ); @@ -1257,7 +1257,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, let glInternalFormat = _gl.DEPTH_COMPONENT16; - if ( isMultisample || renderTarget.useRenderToTexture ) { + if ( isMultisample || useMultisampledRenderToTexture( renderTarget ) ) { const depthTexture = renderTarget.depthTexture; @@ -1277,7 +1277,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, const samples = getRenderTargetSamples( renderTarget ); - if ( renderTarget.useRenderToTexture ) { + if ( useMultisampledRenderToTexture( renderTarget ) ) { MultisampledRenderToTextureExtension.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height ); @@ -1299,11 +1299,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, const samples = getRenderTargetSamples( renderTarget ); - if ( isMultisample && renderTarget.useRenderbuffer ) { + if ( isMultisample && useMultisampledRenderToTexture( renderTarget ) === false ) { _gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height ); - } else if ( renderTarget.useRenderToTexture ) { + } else if ( useMultisampledRenderToTexture( renderTarget ) ) { MultisampledRenderToTextureExtension.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height ); @@ -1326,11 +1326,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding ); const samples = getRenderTargetSamples( renderTarget ); - if ( isMultisample && renderTarget.useRenderbuffer ) { + if ( isMultisample && useMultisampledRenderToTexture( renderTarget ) === false ) { _gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height ); - } else if ( renderTarget.useRenderToTexture ) { + } else if ( useMultisampledRenderToTexture( renderTarget ) ) { MultisampledRenderToTextureExtension.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height ); @@ -1378,7 +1378,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, if ( renderTarget.depthTexture.format === DepthFormat ) { - if ( renderTarget.useRenderToTexture ) { + if ( useMultisampledRenderToTexture( renderTarget ) ) { MultisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples ); @@ -1390,7 +1390,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, } else if ( renderTarget.depthTexture.format === DepthStencilFormat ) { - if ( renderTarget.useRenderToTexture ) { + if ( useMultisampledRenderToTexture( renderTarget ) ) { MultisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples ); @@ -1537,41 +1537,32 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, } - } else if ( renderTarget.useRenderbuffer ) { - - if ( isWebGL2 ) { - - renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer(); - renderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer(); - - _gl.bindRenderbuffer( _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer ); - - const glFormat = utils.convert( texture.format, texture.encoding ); - const glType = utils.convert( texture.type ); - const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding ); - const samples = getRenderTargetSamples( renderTarget ); - _gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height ); - - state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer ); - _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer ); - _gl.bindRenderbuffer( _gl.RENDERBUFFER, null ); + } else if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRenderToTexture( renderTarget ) === false ) { - if ( renderTarget.depthBuffer ) { + renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer(); + renderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer(); - renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer(); - setupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true ); + _gl.bindRenderbuffer( _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer ); - } - - state.bindFramebuffer( _gl.FRAMEBUFFER, null ); + const glFormat = utils.convert( texture.format, texture.encoding ); + const glType = utils.convert( texture.type ); + const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding ); + const samples = getRenderTargetSamples( renderTarget ); + _gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height ); + state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer ); + _gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer ); + _gl.bindRenderbuffer( _gl.RENDERBUFFER, null ); - } else { + if ( renderTarget.depthBuffer ) { - console.warn( 'THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.' ); + renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer(); + setupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true ); } + state.bindFramebuffer( _gl.FRAMEBUFFER, null ); + } } @@ -1692,61 +1683,61 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, function updateMultisampleRenderTarget( renderTarget ) { - if ( renderTarget.useRenderbuffer ) { - - if ( isWebGL2 ) { + if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRenderToTexture( renderTarget ) === false ) { - const width = renderTarget.width; - const height = renderTarget.height; - let mask = _gl.COLOR_BUFFER_BIT; - const invalidationArray = [ _gl.COLOR_ATTACHMENT0 ]; - const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT; + const width = renderTarget.width; + const height = renderTarget.height; + let mask = _gl.COLOR_BUFFER_BIT; + const invalidationArray = [ _gl.COLOR_ATTACHMENT0 ]; + const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT; - if ( renderTarget.depthBuffer ) { + if ( renderTarget.depthBuffer ) { - invalidationArray.push( depthStyle ); + invalidationArray.push( depthStyle ); - } + } - if ( ! renderTarget.ignoreDepthForMultisampleCopy ) { + const renderTargetProperties = properties.get( renderTarget ); + const ignoreDepthValues = ( renderTargetProperties.__ignoreDepthValues !== undefined ) ? renderTargetProperties.__ignoreDepthValues : true; - if ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT; - if ( renderTarget.stencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT; + if ( ignoreDepthValues === false ) { - } + if ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT; + if ( renderTarget.stencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT; - const renderTargetProperties = properties.get( renderTarget ); + } - state.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer ); - state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer ); + state.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer ); + state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer ); - if ( renderTarget.ignoreDepthForMultisampleCopy ) { + if ( ignoreDepthValues === true ) { - _gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, [ depthStyle ] ); - _gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] ); + _gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, [ depthStyle ] ); + _gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] ); - } + } - _gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST ); - _gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArray ); + _gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST ); + _gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArray ); - state.bindFramebuffer( _gl.READ_FRAMEBUFFER, null ); - state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer ); + state.bindFramebuffer( _gl.READ_FRAMEBUFFER, null ); + state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer ); - } else { + } - console.warn( 'THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.' ); + } - } + function getRenderTargetSamples( renderTarget ) { - } + return Math.min( maxSamples, renderTarget.samples ); } - function getRenderTargetSamples( renderTarget ) { + function useMultisampledRenderToTexture( renderTarget ) { + + const renderTargetProperties = properties.get( renderTarget ); - return ( isWebGL2 && ( renderTarget.useRenderbuffer || renderTarget.useRenderToTexture ) ) ? - Math.min( maxSamples, renderTarget.samples ) : 0; + return isWebGL2 && renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false; } @@ -1883,6 +1874,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, this.updateMultisampleRenderTarget = updateMultisampleRenderTarget; this.setupDepthRenderbuffer = setupDepthRenderbuffer; this.setupFrameBufferTexture = setupFrameBufferTexture; + this.useMultisampledRenderToTexture = useMultisampledRenderToTexture; this.safeSetTexture2D = safeSetTexture2D; this.safeSetTextureCube = safeSetTextureCube;
true
Other
mrdoob
three.js
48b05d3500acc084df50be9b4c90781ad9b8cb17.json
Remove WebGLMultisampleRenderTarget. (#23455) * Remove WebGLMultisampleRenderTarget. * THREE.Legacy.js: Add WebGLMultisampleRenderTarget. * Exampels: Clean up. * WebGLRenderer: Use multisampling when possible without reporting errors. * Update WebGLRenderer.js Co-authored-by: mrdoob <info@mrdoob.com>
src/renderers/webxr/WebXRManager.js
@@ -7,7 +7,6 @@ import { WebGLAnimation } from '../webgl/WebGLAnimation.js'; import { WebGLRenderTarget } from '../WebGLRenderTarget.js'; import { WebXRController } from './WebXRController.js'; import { DepthTexture } from '../../textures/DepthTexture.js'; -import { WebGLMultisampleRenderTarget } from '../WebGLMultisampleRenderTarget.js'; import { DepthFormat, DepthStencilFormat, @@ -31,13 +30,11 @@ class WebXRManager extends EventDispatcher { let referenceSpace = null; let referenceSpaceType = 'local-floor'; - const hasMultisampledRenderToTexture = renderer.extensions.has( 'WEBGL_multisampled_render_to_texture' ); let pose = null; let glBinding = null; let glProjLayer = null; let glBaseLayer = null; - let isMultisample = false; let xrFrame = null; const attributes = gl.getContextAttributes(); let initialRenderTarget = null; @@ -267,7 +264,6 @@ class WebXRManager extends EventDispatcher { } else { - isMultisample = attributes.antialias; let depthFormat = null; let depthType = null; let glDepthFormat = null; @@ -292,36 +288,20 @@ class WebXRManager extends EventDispatcher { session.updateRenderState( { layers: [ glProjLayer ] } ); - if ( isMultisample ) { - - newRenderTarget = new WebGLMultisampleRenderTarget( - glProjLayer.textureWidth, - glProjLayer.textureHeight, - { - format: RGBAFormat, - type: UnsignedByteType, - depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ), - stencilBuffer: attributes.stencil, - ignoreDepth: glProjLayer.ignoreDepthValues, - useRenderToTexture: hasMultisampledRenderToTexture, - encoding: renderer.outputEncoding - } ); - - } else { - - newRenderTarget = new WebGLRenderTarget( - glProjLayer.textureWidth, - glProjLayer.textureHeight, - { - format: RGBAFormat, - type: UnsignedByteType, - depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ), - stencilBuffer: attributes.stencil, - ignoreDepth: glProjLayer.ignoreDepthValues, - encoding: renderer.outputEncoding - } ); - - } + newRenderTarget = new WebGLRenderTarget( + glProjLayer.textureWidth, + glProjLayer.textureHeight, + { + format: RGBAFormat, + type: UnsignedByteType, + depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ), + stencilBuffer: attributes.stencil, + encoding: renderer.outputEncoding, + samples: attributes.antialias ? 4 : 0 + } ); + + const renderTargetProperties = renderer.properties.get( newRenderTarget ); + renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues; }
true
Other
mrdoob
three.js
09b36f444e6edca02799ad0144d93b38cf4f9a99.json
fix default scope NormalNode.LOCAL
examples/jsm/renderers/nodes/accessors/NormalNode.js
@@ -8,11 +8,11 @@ import MathNode from '../math/MathNode.js'; class NormalNode extends Node { - static VIEW = 'view'; static LOCAL = 'local'; static WORLD = 'world'; + static VIEW = 'view'; - constructor( scope = NormalNode.VIEW ) { + constructor( scope = NormalNode.LOCAL ) { super( 'vec3' );
true
Other
mrdoob
three.js
09b36f444e6edca02799ad0144d93b38cf4f9a99.json
fix default scope NormalNode.LOCAL
examples/webgpu_nodes.html
@@ -133,14 +133,14 @@ case 'normal': - const normalNode = new NormalNode( NormalNode.VIEW ); + const normalNode = new NormalNode( NormalNode.LOCAL ); material.colorNode = normalNode; - addGui( 'scope', { - view: NormalNode.VIEW, + addGui( 'scope', { local: NormalNode.LOCAL, - world: NormalNode.WORLD + world: NormalNode.WORLD, + view: NormalNode.VIEW }, function ( val ) { normalNode.scope = val;
true
Other
mrdoob
three.js
2337179cdfe586336a4626cc9beecad146c7d15a.json
fix displace with normals
examples/webgpu_sandbox.html
@@ -22,10 +22,12 @@ import AttributeNode from './jsm/renderers/nodes/core/AttributeNode.js'; import FloatNode from './jsm/renderers/nodes/inputs/FloatNode.js'; import Vector2Node from './jsm/renderers/nodes/inputs/Vector2Node.js'; + import Vector3Node from './jsm/renderers/nodes/inputs/Vector3Node.js'; import ColorNode from './jsm/renderers/nodes/inputs/ColorNode.js'; import TextureNode from './jsm/renderers/nodes/inputs/TextureNode.js'; import UVNode from './jsm/renderers/nodes/accessors/UVNode.js'; import PositionNode from './jsm/renderers/nodes/accessors/PositionNode.js'; + import NormalNode from './jsm/renderers/nodes/accessors/NormalNode.js'; import OperatorNode from './jsm/renderers/nodes/math/OperatorNode.js'; import SwitchNode from './jsm/renderers/nodes/utils/SwitchNode.js'; import TimerNode from './jsm/renderers/nodes/utils/TimerNode.js'; @@ -95,10 +97,13 @@ const geometrySphere = new THREE.SphereGeometry( .5, 64, 64 ); const materialSphere = new THREE.MeshBasicMaterial(); - const displaceScaled = new OperatorNode( '*', new TextureNode( textureDisplace ), new FloatNode( .2 ) ); + const displaceAnimated = new SwitchNode( new TextureNode( textureDisplace ), 'x' ); + const displaceY = new OperatorNode( '*', displaceAnimated, new FloatNode( .25 ).setConst( true ) ); - materialSphere.colorNode = new TextureNode( textureDisplace ); - materialSphere.positionNode = new OperatorNode( '+', new PositionNode(), displaceScaled ); + const displace = new OperatorNode( '*', new NormalNode( NormalNode.LOCAL ), displaceY ); + + materialSphere.colorNode = displaceY; + materialSphere.positionNode = new OperatorNode( '+', new PositionNode( PositionNode.LOCAL ), displace ); const sphere = new THREE.Mesh( geometrySphere, materialSphere ); sphere.position.set( - 2, - 1, 0 );
false
Other
mrdoob
three.js
ad7d8036ceb251c574f48becafe2cc0826f26b62.json
fix VaryNode build in vertex shader
examples/jsm/renderers/nodes/core/NodeVary.js
@@ -1,10 +1,10 @@ class NodeVary { - constructor( name, type, value ) { + constructor( name, type, snippet = '' ) { this.name = name; this.type = type; - this.value = value; + this.snippet = snippet; Object.defineProperty( this, 'isNodeVary', { value: true } );
true
Other
mrdoob
three.js
ad7d8036ceb251c574f48becafe2cc0826f26b62.json
fix VaryNode build in vertex shader
examples/jsm/renderers/nodes/core/VaryNode.js
@@ -1,4 +1,5 @@ import Node from './Node.js'; +import { NodeShaderStage } from './constants.js'; class VaryNode extends Node { @@ -22,9 +23,12 @@ class VaryNode extends Node { const type = this.getType( builder ); - const value = this.value.build( builder, type ); + // force nodeVary.snippet work in vertex stage + const snippet = this.value.buildStage( builder, NodeShaderStage.Vertex, type ); + + const nodeVary = builder.getVaryFromNode( this, type ); + nodeVary.snippet = snippet; - const nodeVary = builder.getVaryFromNode( this, type, value ); const propertyName = builder.getPropertyName( nodeVary ); return builder.format( propertyName, type, output );
true
Other
mrdoob
three.js
ad7d8036ceb251c574f48becafe2cc0826f26b62.json
fix VaryNode build in vertex shader
examples/jsm/renderers/nodes/core/constants.js
@@ -1,3 +1,8 @@ +export const NodeShaderStage = { + Vertex: 'vertex', + Fragment: 'fragment' +}; + export const NodeUpdateType = { None: 'none', Frame: 'frame',
true
Other
mrdoob
three.js
ad7d8036ceb251c574f48becafe2cc0826f26b62.json
fix VaryNode build in vertex shader
examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js
@@ -244,7 +244,7 @@ class WebGPUNodeBuilder extends NodeBuilder { for ( const vary of this.varys ) { - snippet += `${vary.name} = ${vary.value};`; + snippet += `${vary.name} = ${vary.snippet};`; }
true
Other
mrdoob
three.js
86325122371dbd33dbed0f2b54e354ae54c599f0.json
Update setup.html (#24266) Make the language a bit clearer.
manual/en/setup.html
@@ -34,7 +34,7 @@ <h1>Setup</h1> The first article was <a href="fundamentals.html">about three.js fundamentals</a>. If you haven't read that yet you might want to start there.</p> <p>Before we go any further we need to talk about setting up your -computer to do development. In particular, for security reasons, +computer as a development environment. In particular, for security reasons, WebGL cannot use images from your hard drive directly. That means in order to do development you need to use a web server. Fortunately development web servers are super easy to setup and use.</p> @@ -51,7 +51,7 @@ <h1>Setup</h1> <p>Just point it at the folder where you unzipped the files, click "Start", then go to in your browser <a href="http://localhost:8080/"><code class="notranslate" translate="no">http://localhost:8080/</code></a> or if you'd like to browse the samples go to <a href="http://localhost:8080/threejs"><code class="notranslate" translate="no">http://localhost:8080/threejs</code></a>.</p> -<p>To stop serving pick stop or quit Servez.</p> +<p>To stop serving click stop or quit Servez.</p> <p>If you prefer the command line (I do), another way is to use <a href="https://nodejs.org">node.js</a>. Download it, install it, then open a command prompt / console / terminal window. If you're on Windows the installer will add a special "Node Command Prompt" so use that.</p> <p>Then install the <a href="https://github.com/greggman/servez-cli"><code class="notranslate" translate="no">servez</code></a> by typing</p> @@ -85,4 +85,4 @@ <h1>Setup</h1> -</body></html> \ No newline at end of file +</body></html>
false
Other
mrdoob
three.js
95172e542c07d40ff89d2e716e01358eff59fad0.json
Remove input source on XR session end (#24269) Fixes error on 2nd time entering AR: Uncaught DOMException: Failed to execute 'getPose' on 'XRFrame': XRSpace and XRFrame sessions do not match.
src/renderers/webxr/WebXRManager.js
@@ -153,6 +153,8 @@ class WebXRManager extends EventDispatcher { if ( inputSource === null ) continue; + controllerInputSources[ i ] = null; + controllers[ i ].disconnect( inputSource ); }
false
Other
mrdoob
three.js
a48a395a0327b35bca6cd5013cca22f2f7d33f5b.json
add glsl annotation (#24274)
examples/jsm/shaders/MMDToonShader.js
@@ -15,7 +15,7 @@ import { UniformsUtils, ShaderLib } from 'three'; -const lights_mmd_toon_pars_fragment = ` +const lights_mmd_toon_pars_fragment = /* glsl */` varying vec3 vViewPosition; struct BlinnPhongMaterial { @@ -49,7 +49,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in Geometric #define Material_LightProbeLOD( material ) (0) `; -const mmd_toon_matcap_fragment = ` +const mmd_toon_matcap_fragment = /* glsl */` #ifdef USE_MATCAP vec3 viewDir = normalize( vViewPosition );
false
Other
mrdoob
three.js
88ecb40f79cca1fc8881423672e50632aa4d4a04.json
Remove some deprecated methods (#21450)
src/Three.Legacy.js
@@ -47,7 +47,6 @@ import { DataTextureLoader } from './loaders/DataTextureLoader.js'; import { TextureLoader } from './loaders/TextureLoader.js'; import { Material } from './materials/Material.js'; import { LineBasicMaterial } from './materials/LineBasicMaterial.js'; -import { MeshPhongMaterial } from './materials/MeshPhongMaterial.js'; import { MeshPhysicalMaterial } from './materials/MeshPhysicalMaterial.js'; import { PointsMaterial } from './materials/PointsMaterial.js'; import { ShaderMaterial } from './materials/ShaderMaterial.js'; @@ -69,10 +68,8 @@ import { Vector3 } from './math/Vector3.js'; import { Vector4 } from './math/Vector4.js'; import { Mesh } from './objects/Mesh.js'; import { LineSegments } from './objects/LineSegments.js'; -import { LOD } from './objects/LOD.js'; import { Points } from './objects/Points.js'; import { Sprite } from './objects/Sprite.js'; -import { Skeleton } from './objects/Skeleton.js'; import { SkinnedMesh } from './objects/SkinnedMesh.js'; import { WebGLRenderer } from './renderers/WebGLRenderer.js'; import { WebGLRenderTarget } from './renderers/WebGLRenderTarget.js'; @@ -938,34 +935,6 @@ Object.defineProperties( Mesh.prototype, { } ); -Object.defineProperties( LOD.prototype, { - - objects: { - get: function () { - - console.warn( 'THREE.LOD: .objects has been renamed to .levels.' ); - return this.levels; - - } - } - -} ); - -Object.defineProperty( Skeleton.prototype, 'useVertexTexture', { - - get: function () { - - console.warn( 'THREE.Skeleton: useVertexTexture has been removed.' ); - - }, - set: function () { - - console.warn( 'THREE.Skeleton: useVertexTexture has been removed.' ); - - } - -} ); - SkinnedMesh.prototype.initBones = function () { console.error( 'THREE.SkinnedMesh: initBones() has been removed.' ); @@ -1353,25 +1322,12 @@ Scene.prototype.dispose = function () { // -Object.defineProperties( Uniform.prototype, { - - dynamic: { - set: function () { - - console.warn( 'THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.' ); +Uniform.prototype.onUpdate = function () { - } - }, - onUpdate: { - value: function () { - - console.warn( 'THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.' ); - return this; - - } - } + console.warn( 'THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.' ); + return this; -} ); +}; // @@ -1443,24 +1399,6 @@ Object.defineProperties( Material.prototype, { } ); -Object.defineProperties( MeshPhongMaterial.prototype, { - - metal: { - get: function () { - - console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.' ); - return false; - - }, - set: function () { - - console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead' ); - - } - } - -} ); - Object.defineProperties( MeshPhysicalMaterial.prototype, { transparency: { @@ -1968,32 +1906,20 @@ Object.defineProperties( WebGLRenderTarget.prototype, { // -Object.defineProperties( Audio.prototype, { - - load: { - value: function ( file ) { +Audio.prototype.load = function ( file ) { - console.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' ); - const scope = this; - const audioLoader = new AudioLoader(); - audioLoader.load( file, function ( buffer ) { + console.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' ); + const scope = this; + const audioLoader = new AudioLoader(); + audioLoader.load( file, function ( buffer ) { - scope.setBuffer( buffer ); - - } ); - return this; - - } - }, - startTime: { - set: function () { + scope.setBuffer( buffer ); - console.warn( 'THREE.Audio: .startTime is now .play( delay ).' ); + } ); + return this; - } - } +}; -} ); AudioAnalyser.prototype.getData = function () {
false
Other
mrdoob
three.js
67cced08a9d653fc670d1c344526f149d0e4bfbb.json
Select three examples
docs/api/en/helpers/AxesHelper.html
@@ -25,9 +25,6 @@ <h2>Code Example</h2> <h2>Examples</h2> <p> - [example:css2d_label Css2d / label]<br/> - [example:misc_animation_keys Misc / animation / keys]<br/> - [example:misc_exporter_gltf Misc / exporter / gltf]<br/> [example:webgl_buffergeometry_compression WebGL / buffergeometry / compression]<br/> [example:webgl_geometry_convex WebGL / geometry / convex]<br/> [example:webgl_loader_nrrd WebGL / loader / nrrd]<br/>
true
Other
mrdoob
three.js
67cced08a9d653fc670d1c344526f149d0e4bfbb.json
Select three examples
docs/api/zh/helpers/AxesHelper.html
@@ -24,9 +24,6 @@ <h2>代码示例</h2> <h2>例子</h2> <p> - [example:css2d_label Css2d / label]<br/> - [example:misc_animation_keys Misc / animation / keys]<br/> - [example:misc_exporter_gltf Misc / exporter / gltf]<br/> [example:webgl_buffergeometry_compression WebGL / buffergeometry / compression]<br/> [example:webgl_geometry_convex WebGL / geometry / convex]<br/> [example:webgl_loader_nrrd WebGL / loader / nrrd]<br/>
true
Other
mrdoob
three.js
ac6861eb15cf2e81864e1b44255ec627020c8b0c.json
Remove original ssaa example for files.json
examples/files.json
@@ -268,7 +268,6 @@ "webgl_postprocessing_rgb_halftone", "webgl_postprocessing_masking", "webgl_postprocessing_ssaa", - "webgl_postprocessing_ssaa_unbiased", "webgl_postprocessing_outline", "webgl_postprocessing_pixel", "webgl_postprocessing_procedural",
false
Other
mrdoob
three.js
cdab337b203e855d08f5c9551742f7b6d14da757.json
Fix pixel ratio
examples/webgl_postprocessing_ssaa.html
@@ -80,10 +80,9 @@ const width = window.innerWidth || 1; const height = window.innerHeight || 1; const aspect = width / height; - const devicePixelRatio = window.devicePixelRatio || 1; renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio( devicePixelRatio ); + renderer.setPixelRatio( 1 ); // ensure pixel ratio is always 1 for performance reasons renderer.setSize( width, height ); document.body.appendChild( renderer.domElement );
false
Other
mrdoob
three.js
1042edb1122d7fd9938262e0093ee22d436ae516.json
Add documentation of computeMorphedBufferGeometry
docs/examples/en/utils/BufferGeometryUtils.html
@@ -74,6 +74,17 @@ <h3>[method:BufferGeometry toTrianglesDrawMode]( [param:BufferGeometry geometry] </p> + <h3>[method:Object computeMorphedBufferGeometry]( [param:Object3D object] )</h3> + <p> + object -- Instance of [page:Object3D Object3D].<br /><br /> + + Returns the current attributes (Position and Normal) of a morphed/skinned [page:Object3D Object3D] whose geometry is a + [page:BufferGeometry BufferGeometry], together with the original ones: An Object with 4 properties: `positionAttribute`, `normalAttribute`, `morphedPositionAttribute` and `morphedNormalAttribute`. + + Helpful for Raytracing or Decals (i.e. a [page:DecalGeometry DecalGeometry] applied to a morphed Object with a [page:BufferGeometry BufferGeometry] will use the original BufferGeometry, not the morphed/skinned one, generating an incorrect result. Using this function to create a shadow Object3D the DecalGeometry can be correctly generated). + + </p> + <h2>Source</h2> <p>
false
Other
mrdoob
three.js
4dc07db7c848cd03d4e6ce4385882312bb4473ad.json
Fix reference to BoxBufferGeometry
src/extras/PMREMGenerator.js
@@ -25,7 +25,7 @@ import { Vector3 } from '../math/Vector3.js'; import { Color } from '../math/Color.js'; import { WebGLRenderTarget } from '../renderers/WebGLRenderTarget.js'; import { MeshBasicMaterial } from '../materials/MeshBasicMaterial.js'; -import { BoxBufferGeometry } from '../geometries/BoxBufferGeometry.js'; +import { BoxBufferGeometry } from '../geometries/BoxGeometry.js'; import { BackSide } from '../constants.js'; const LOD_MIN = 4;
false
Other
mrdoob
three.js
0bb92db3df41179adce5320447798b25f672d5cd.json
Fix typo in KeyframeTrack.optimize()
src/animation/KeyframeTrack.js
@@ -363,7 +363,7 @@ Object.assign( KeyframeTrack.prototype, { // remove adjacent keyframes scheduled at the same time - if ( time !== timeNext && ( i !== 1 || time !== time[ 0 ] ) ) { + if ( time !== timeNext && ( i !== 1 || time !== times[ 0 ] ) ) { if ( ! smoothInterpolation ) {
false
Other
mrdoob
three.js
7da24e39cf58bfcaa7486bfd9e5193f6230a838a.json
Fix a typo in multiple places (#24195) * Fix a typo in multiple places * Undo typo fix in build files Since the build files are auto-generated from the source, the typo should only have fixed it in the src folder. This commit fixes that Co-authored-by: Carl Lee Landskron <carl.lee.landskron@gmail.com>
src/core/InterleavedBufferAttribute.js
@@ -181,7 +181,7 @@ class InterleavedBufferAttribute { if ( data === undefined ) { - console.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.' ); + console.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.' ); const array = []; @@ -223,7 +223,7 @@ class InterleavedBufferAttribute { if ( data === undefined ) { - console.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.' ); + console.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.' ); const array = []; @@ -250,7 +250,7 @@ class InterleavedBufferAttribute { } else { - // save as true interlaved attribtue + // save as true interleaved attribtue if ( data.interleavedBuffers === undefined ) {
false
Other
mrdoob
three.js
cba85c5c6318e7ca53dd99f9f3c25eb3b79d9693.json
Improve OBJLoader (#24175) - Cache data splitter regex - Replace deprecated trimLeft calls with trimStart - Replace some let declarations with const
examples/js/loaders/OBJLoader.js
@@ -7,6 +7,7 @@ const _material_use_pattern = /^usemtl /; // usemap map_name const _map_use_pattern = /^usemap /; + const _face_vertex_data_separator_pattern = /\s+/; const _vA = new THREE.Vector3(); @@ -438,26 +439,19 @@ } const lines = text.split( '\n' ); - let line = '', - lineFirstChar = ''; - let lineLength = 0; - let result = []; // Faster to just trim left side of the line. Use if available. - - const trimLeft = typeof ''.trimLeft === 'function'; + let result = []; for ( let i = 0, l = lines.length; i < l; i ++ ) { - line = lines[ i ]; - line = trimLeft ? line.trimLeft() : line.trim(); - lineLength = line.length; - if ( lineLength === 0 ) continue; - lineFirstChar = line.charAt( 0 ); // @todo invoke passed in handler if any + const line = lines[ i ].trimStart(); + if ( line.length === 0 ) continue; + const lineFirstChar = line.charAt( 0 ); // @todo invoke passed in handler if any if ( lineFirstChar === '#' ) continue; if ( lineFirstChar === 'v' ) { - const data = line.split( /\s+/ ); + const data = line.split( _face_vertex_data_separator_pattern ); switch ( data[ 0 ] ) { @@ -492,7 +486,7 @@ } else if ( lineFirstChar === 'f' ) { const lineData = line.slice( 1 ).trim(); - const vertexData = lineData.split( /\s+/ ); + const vertexData = lineData.split( _face_vertex_data_separator_pattern ); const faceVertices = []; // Parse the face vertex data into an easy to work with format for ( let j = 0, jl = vertexData.length; j < jl; j ++ ) {
true
Other
mrdoob
three.js
cba85c5c6318e7ca53dd99f9f3c25eb3b79d9693.json
Improve OBJLoader (#24175) - Cache data splitter regex - Replace deprecated trimLeft calls with trimStart - Replace some let declarations with const
examples/jsm/loaders/OBJLoader.js
@@ -23,6 +23,7 @@ const _material_library_pattern = /^mtllib /; const _material_use_pattern = /^usemtl /; // usemap map_name const _map_use_pattern = /^usemap /; +const _face_vertex_data_separator_pattern = /\s+/; const _vA = new Vector3(); const _vB = new Vector3(); @@ -503,31 +504,22 @@ class OBJLoader extends Loader { } const lines = text.split( '\n' ); - let line = '', lineFirstChar = ''; - let lineLength = 0; let result = []; - // Faster to just trim left side of the line. Use if available. - const trimLeft = ( typeof ''.trimLeft === 'function' ); - for ( let i = 0, l = lines.length; i < l; i ++ ) { - line = lines[ i ]; - - line = trimLeft ? line.trimLeft() : line.trim(); - - lineLength = line.length; + const line = lines[ i ].trimStart(); - if ( lineLength === 0 ) continue; + if ( line.length === 0 ) continue; - lineFirstChar = line.charAt( 0 ); + const lineFirstChar = line.charAt( 0 ); // @todo invoke passed in handler if any if ( lineFirstChar === '#' ) continue; if ( lineFirstChar === 'v' ) { - const data = line.split( /\s+/ ); + const data = line.split( _face_vertex_data_separator_pattern ); switch ( data[ 0 ] ) { @@ -575,7 +567,7 @@ class OBJLoader extends Loader { } else if ( lineFirstChar === 'f' ) { const lineData = line.slice( 1 ).trim(); - const vertexData = lineData.split( /\s+/ ); + const vertexData = lineData.split( _face_vertex_data_separator_pattern ); const faceVertices = []; // Parse the face vertex data into an easy to work with format
true
Other
mrdoob
three.js
8a774733d986c4b9636ccef8fc1363fb0426a933.json
add check if face are not undefinded (#24169) add check if face are not undefinded check with u.faces[i]
examples/jsm/modifiers/SimplifyModifier.js
@@ -342,7 +342,7 @@ function collapse( vertices, faces, u, v ) { // u and v are pointers to vertices // delete triangles on edge uv: for ( let i = u.faces.length - 1; i >= 0; i -- ) { - if ( u.faces[ i ].hasVertex( v ) ) { + if ( u.faces[ i ] && u.faces[ i ].hasVertex( v ) ) { removeFace( u.faces[ i ], faces );
false
Other
mrdoob
three.js
0f3d50013eb25afd28b2121909f8f127fccbab6d.json
fix nan on first frame
examples/webgl_shader.html
@@ -74,7 +74,7 @@ var uniforms; init(); - animate(); + animate( 0 ); function init() {
false
Other
mrdoob
three.js
dd9e041c484c7c15bcee7afa53604981baab56c1.json
remove transparency in favor of transmission
src/loaders/MaterialLoader.js
@@ -92,7 +92,6 @@ MaterialLoader.prototype = Object.assign( Object.create( Loader.prototype ), { if ( json.side !== undefined ) material.side = json.side; if ( json.opacity !== undefined ) material.opacity = json.opacity; if ( json.transparent !== undefined ) material.transparent = json.transparent; - if ( json.transparency !== undefined ) material.transparency = json.transparency; if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest; if ( json.depthTest !== undefined ) material.depthTest = json.depthTest; if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
false
Other
mrdoob
three.js
bc788ea945ed4832f16c007c508cc1b8c8a83d1a.json
Remove SpriteMaterial.fog (zh doc)
docs/api/zh/materials/SpriteMaterial.html
@@ -64,9 +64,6 @@ <h3>[property:Texture alphaMap]</h3> <h3>[property:Color color]</h3> <p>材质的颜色([page:Color]),默认值为白色 (0xffffff)。 [page:.map]会和 color 相乘。</p> - <h3>[property:boolean fog]</h3> - <p>材质是否受场景雾的影响。默认值为*false*。</p> - <h3>[property:Texture map]</h3> <p>颜色贴图。默认为null。</p>
false
Other
mrdoob
three.js
706a375a06e963e32b9ad86af405a5170514d3ae.json
Change conditon style
examples/js/lines/LineSegments2.js
@@ -70,12 +70,7 @@ THREE.LineSegments2.prototype = Object.assign( Object.create( THREE.Mesh.prototy } - var threshold = 0; - if ( 'Line2' in raycaster.params ) { - - threshold = raycaster.params.Line2.threshold || 0.0; - - } + var threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0; var ray = raycaster.ray; var camera = raycaster.camera;
true
Other
mrdoob
three.js
706a375a06e963e32b9ad86af405a5170514d3ae.json
Change conditon style
examples/jsm/lines/LineSegments2.js
@@ -81,12 +81,7 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), { } - var threshold = 0; - if ( 'Line2' in raycaster.params ) { - - threshold = raycaster.params.Line2.threshold || 0.0; - - } + var threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0; var ray = raycaster.ray; var camera = raycaster.camera;
true
Other
mrdoob
three.js
4673a77db9193849bf2d668191504beee7a7ad37.json
remove useless code
examples/jsm/loaders/KTX2Loader.d.ts
@@ -12,13 +12,6 @@ export class KTX2Loader extends CompressedTextureLoader { detectSupport( renderer: WebGLRenderer ): KTX2Loader; initModule(): void; - load( - url: string, - onLoad: ( texture: CompressedTexture ) => void, - onProgress?: ( event: ProgressEvent ) => void, - onError?: ( event: ErrorEvent ) => void - ): CompressedTexture; - parse( buffer: ArrayBuffer, onLoad: ( texture: CompressedTexture ) => void,
false
Other
mrdoob
three.js
84deae15c8944717fe5d874f1246c4d2959303c8.json
Add threshold option to Line2 raycast
examples/jsm/lines/LineSegments2.js
@@ -81,14 +81,21 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), { } + var threshold = 0; + if ( 'Line2' in raycaster.params ) { + + threshold = raycaster.params.Lines2.threshold || 0.0 + + } + var ray = raycaster.ray; var camera = raycaster.camera; var projectionMatrix = camera.projectionMatrix; var geometry = this.geometry; var material = this.material; var resolution = material.resolution; - var lineWidth = material.linewidth; + var lineWidth = material.linewidth + threshold; var instanceStart = geometry.attributes.instanceStart; var instanceEnd = geometry.attributes.instanceEnd;
false
Other
mrdoob
three.js
8cfff8d8418933da5e89673578eae9a67701170b.json
Add LUT3dlLoader dts
examples/jsm/loaders/LUT3dlLoader.d.ts
@@ -0,0 +1,28 @@ +import { + Loader, + LoadingManager, + DataTexture, + DataTexture3D, +} from '../../../src/Three'; + +export interface LUT3dlResult { + + size: number; + texture: DataTexture; + texture3D: DataTexture3D; + +} + +export class LUT3dlLoader extends Loader { + + constructor( manager?: LoadingManager ); + + load( + url: string, + onLoad: ( result: LUT3dlResult ) => void, + onProgress?: ( event: ProgressEvent ) => void, + onError?: ( event: Error ) => void + ); + parse( data: string ): LUT3dlResult; + +}
false
Other
mrdoob
three.js
e3ca45396be1c9f5f5e4431345944e457dbcb7f1.json
Add LUTCubeLoader dts
examples/jsm/loaders/LUTCubeLoader.d.ts
@@ -0,0 +1,32 @@ +import { + Loader, + LoadingManager, + Vector3, + DataTexture, + DataTexture3D, +} from '../../../src/Three'; + +export interface LUTCubeResult { + + title: string; + size: number; + domainMin: Vector3; + domainMax: Vector3; + texture: DataTexture; + texture3D: DataTexture3D; + +} + +export class LUTCubeLoader extends Loader { + + constructor( manager?: LoadingManager ); + + load( + url: string, + onLoad: ( result: LUTCubeResult ) => void, + onProgress?: ( event: ProgressEvent ) => void, + onError?: ( event: Error ) => void + ); + parse( data: string ): LUTCubeResult; + +}
false
Other
mrdoob
three.js
19e16a510849bd87752bbc6d2694cdb37375ce02.json
Add LUTPass dts
examples/jsm/postprocessing/LUTPass.d.ts
@@ -0,0 +1,18 @@ +import { + DataTexture, + DataTexture3D, +} from '../../../src/Three'; +import { ShaderPass } from './ShaderPass'; + +export interface LUTPassParameters { + lut?: DataTexture | DataTexture3D; + intensity?: number; +} + +export class LUTPass extends ShaderPass { + + lut?: DataTexture | DataTexture3D; + intensity?: number; + constructor( params: LUTPassParameters ); + +}
false
Other
mrdoob
three.js
ddbc49298fe378253c45908b1018940793b5c837.json
Use a default parameter for renderCallDepth
src/renderers/WebGLRenderer.js
@@ -874,7 +874,7 @@ function WebGLRenderer( parameters ) { this.compile = function ( scene, camera ) { - currentRenderState = renderStates.get( scene, 0 ); + currentRenderState = renderStates.get( scene ); currentRenderState.init(); scene.traverseVisible( function ( object ) {
true
Other
mrdoob
three.js
ddbc49298fe378253c45908b1018940793b5c837.json
Use a default parameter for renderCallDepth
src/renderers/webgl/WebGLRenderStates.d.ts
@@ -22,7 +22,7 @@ interface WebGLRenderState { export class WebGLRenderStates { // renderCallDepth indexes start from 0. - get( scene: Scene, renderCallDepth: number ): WebGLRenderState; + get( scene: Scene, renderCallDepth?: number ): WebGLRenderState; dispose(): void; }
true
Other
mrdoob
three.js
ddbc49298fe378253c45908b1018940793b5c837.json
Use a default parameter for renderCallDepth
src/renderers/webgl/WebGLRenderStates.js
@@ -61,7 +61,7 @@ function WebGLRenderStates() { let renderStates = new WeakMap(); - function get( scene, renderCallDepth ) { + function get( scene, renderCallDepth = 0 ) { let renderState;
true
Other
mrdoob
three.js
832e9a29f6fa6d0bc3eb32fb0cc621aeef3e1b67.json
Add example logic
examples/webgl_postprocessing_3dlut.html
@@ -24,11 +24,15 @@ import { RGBELoader } from './jsm/loaders/RGBELoader.js'; import { EffectComposer } from './jsm/postprocessing/EffectComposer.js'; import { RenderPass } from './jsm/postprocessing/RenderPass.js'; + import { LUTPass } from './jsm/postprocessing/LUTPass.js'; + import { LUTCubeLoader } from './jsm/loaders/LUTCubeLoader.js'; import { GUI } from './jsm/libs/dat.gui.module.js'; const params = { enabled: true, - lut: 'Bourbon 64.CUBE' + lut: 'Bourbon 64.CUBE', + intensity: 1, + use2dLut: false, }; const lutMap = { @@ -82,6 +86,17 @@ } ); + Object.keys( lutMap ).forEach( name => { + + new LUTCubeLoader() + .load( 'luts/' + name, function ( result ) { + + lutMap[ name ] = result; + + } ); + + } ); + renderer = new THREE.WebGLRenderer( { antialias: true } ); renderer.setPixelRatio( window.devicePixelRatio ); renderer.setSize( window.innerWidth, window.innerHeight ); @@ -95,8 +110,8 @@ composer.setSize( window.innerWidth, window.innerHeight ); composer.addPass( new RenderPass( scene, camera ) ); - // lutPass = new LUTPass(); - // composer.addPass( lutPass ); + lutPass = new LUTPass(); + composer.addPass( lutPass ); const pmremGenerator = new THREE.PMREMGenerator( renderer ); pmremGenerator.compileEquirectangularShader(); @@ -112,6 +127,8 @@ gui.width = 350; gui.add( params, 'enabled' ); gui.add( params, 'lut', Object.keys( lutMap ) ); + gui.add( params, 'intensity' ).min( 0 ).max( 1 ); + gui.add( params, 'use2dLut' ); window.addEventListener( 'resize', onWindowResize, false ); @@ -133,6 +150,15 @@ function render() { + lutPass.enabled = params.enabled && Boolean( lutMap[ params.lut ] ); + lutPass.intensity = params.intensity; + if ( lutMap[ params.lut ] ) { + + const lut = lutMap[ params.lut ]; + lutPass.lut = params.use2DLut ? lut.texture : lut.texture3D; + + } + composer.render(); }
false
Other
mrdoob
three.js
0533e1785a069795c0f9c4fc2905447c049910b2.json
fix three path
examples/jsm/postprocessing/LUTPass.js
@@ -1,4 +1,4 @@ -import { ShaderPass } from '//unpkg.com/three@0.120.1/examples/jsm/postprocessing/ShaderPass.js'; +import { ShaderPass } from './ShaderPass.js'; const LUTShader = {
false
Other
mrdoob
three.js
4ce187587f62686b5bc29d323e3a133ffd0d2513.json
update three references
examples/jsm/loaders/LUT3dlLoader.js
@@ -10,7 +10,7 @@ import { UnsignedByteType, ClampToEdgeWrapping, LinearFilter, -} from '//unpkg.com/three@0.120.1/build/three.module.js'; +} from '../../../build/three.module.js'; export class LUT3dlLoader extends Loader {
true
Other
mrdoob
three.js
4ce187587f62686b5bc29d323e3a133ffd0d2513.json
update three references
examples/jsm/loaders/LUTCubeLoader.js
@@ -10,7 +10,7 @@ import { UnsignedByteType, ClampToEdgeWrapping, LinearFilter, -} from '//unpkg.com/three@0.120.1/build/three.module.js'; +} from '../../../build/three.module.js'; export class LUTCubeLoader extends Loader {
true
Other
mrdoob
three.js
5e176f8f2887becd164873d6669457c02545c6f4.json
Add LUT Loaders
examples/jsm/loaders/LUT3dlLoader.js
@@ -0,0 +1,143 @@ +// http://download.autodesk.com/us/systemdocs/help/2011/lustre/index.html?url=./files/WSc4e151a45a3b785a24c3d9a411df9298473-7ffd.htm,topicNumber=d0e9492 + +import { + Loader, + FileLoader, + Vector3, + DataTexture, + DataTexture3D, + RGBFormat, + UnsignedByteType, + ClampToEdgeWrapping, + LinearFilter, +} from '//unpkg.com/three@0.120.1/build/three.module.js'; + +export class LUT3dlLoader extends Loader { + + load( url, onLoad, onProgress, onError ) { + + const loader = new FileLoader( this.manager ); + loader.setPath( this.path ); + loader.setResponseType( 'text' ); + loader.load( url, text => { + + try { + + onLoad( this.parse( text ) ); + + } catch ( e ) { + + if ( onError ) { + + onError( e ); + + } else { + + console.error( e ); + + } + + this.manager.itemError( url ); + + } + + }, onProgress, onError ); + + } + + parse( str ) { + + // remove empty lines and comment lints + str = str + .replace( /^#.*?(\n|\r)/gm, '' ) + .replace( /^\s*?(\n|\r)/gm, '' ) + .trim(); + + const lines = str.split( /[\n\r]+/g ); + + // first line is the positions on the grid that are provided by the LUT + const gridLines = lines[ 0 ].trim().split( /\s+/g ).map( e => parseFloat( e ) ); + const gridStep = gridLines[ 1 ] - gridLines[ 0 ]; + const size = gridLines.length; + + for ( let i = 1, l = gridLines.length; i < l; i ++ ) { + + if ( gridStep !== ( gridLines[ i ] - gridLines[ i - 1 ] ) ) { + + throw new Error( 'LUT3dlLoader: Inconsistent grid size not supported.' ); + + } + + } + + const dataArray = new Array( size * size * size * 3 ); + let index = 0; + let maxOutputValue = 0.0; + for ( let i = 1, l = lines.length; i < l; i ++ ) { + + const line = lines[ i ].trim(); + const split = line.split( /\s/g ); + + const r = parseFloat( split[ 0 ] ); + const g = parseFloat( split[ 1 ] ); + const b = parseFloat( split[ 2 ] ); + maxOutputValue = Math.max( maxOutputValue, r, g, b ); + + const bLayer = index % size; + const gLayer = Math.floor( index / size ) % size; + const rLayer = Math.floor( index / ( size * size ) ) % size; + + // b grows first, then g, then r + const pixelIndex = bLayer * size * size + gLayer * size + rLayer; + dataArray[ 3 * pixelIndex + 0 ] = r; + dataArray[ 3 * pixelIndex + 1 ] = g; + dataArray[ 3 * pixelIndex + 2 ] = b; + index += 1; + + } + + // Find the apparent bit depth of the stored RGB values and scale the + // values to [ 0, 255 ]. + const bits = Math.ceil( Math.log2( maxOutputValue ) ); + const maxBitValue = Math.pow( 2.0, bits ); + for ( let i = 0, l = dataArray.length; i < l; i ++ ) { + + const val = dataArray[ i ]; + dataArray[ i ] = 255 * val / maxBitValue; + + } + + const data = new Uint8Array( dataArray ); + const texture = new DataTexture(); + texture.image.data = data; + texture.image.width = size; + texture.image.height = size * size; + texture.format = RGBFormat; + texture.type = UnsignedByteType; + texture.magFilter = LinearFilter; + texture.wrapS = ClampToEdgeWrapping; + texture.wrapT = ClampToEdgeWrapping; + texture.generateMipmaps = false; + + const texture3D = new DataTexture3D(); + texture3D.image.data = data; + texture3D.image.width = size; + texture3D.image.height = size; + texture3D.image.depth = size; + texture3D.format = RGBFormat; + texture3D.type = UnsignedByteType; + texture3D.magFilter = LinearFilter; + texture3D.wrapS = ClampToEdgeWrapping; + texture3D.wrapT = ClampToEdgeWrapping; + texture3D.wrapR = ClampToEdgeWrapping; + texture3D.generateMipmaps = false; + + return { + size, + texture, + texture3D, + }; + + } + +}
true
Other
mrdoob
three.js
5e176f8f2887becd164873d6669457c02545c6f4.json
Add LUT Loaders
examples/jsm/loaders/LUTCubeLoader.js
@@ -0,0 +1,151 @@ +// https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf + +import { + Loader, + FileLoader, + Vector3, + DataTexture, + DataTexture3D, + RGBFormat, + UnsignedByteType, + ClampToEdgeWrapping, + LinearFilter, +} from '//unpkg.com/three@0.120.1/build/three.module.js'; + +export class LUTCubeLoader extends Loader { + + load( url, onLoad, onProgress, onError ) { + + const loader = new FileLoader( this.manager ); + loader.setPath( this.path ); + loader.setResponseType( 'text' ); + loader.load( url, text => { + + try { + + onLoad( this.parse( text ) ); + + } catch ( e ) { + + if ( onError ) { + + onError( e ); + + } else { + + console.error( e ); + + } + + this.manager.itemError( url ); + + } + + }, onProgress, onError ); + + } + + parse( str ) { + + // Remove empty lines and comments + str = str + .replace( /^#.*?(\n|\r)/gm, '' ) + .replace( /^\s*?(\n|\r)/gm, '' ) + .trim(); + + let title = null; + let size = null; + const domainMin = new Vector3( 0, 0, 0 ); + const domainMax = new Vector3( 1, 1, 1 ); + + const lines = str.split( /[\n\r]+/g ); + let data = null; + + let currIndex = 0; + for ( let i = 0, l = lines.length; i < l; i ++ ) { + + const line = lines[ i ].trim(); + const split = line.split( /\s/g ); + + switch ( split[ 0 ] ) { + + case 'TITLE': + title = line.substring( 7, line.length - 1 ); + break; + case 'LUT_3D_SIZE': + // TODO: A .CUBE LUT file specifies floating point values and could be represented with + // more precision than can be captured with Uint8Array. + const sizeToken = split[ 1 ]; + size = parseFloat( sizeToken ); + data = new Uint8Array( size * size * size * 3 ); + break; + case 'DOMAIN_MIN': + domainMin.x = parseFloat( split[ 1 ] ); + domainMin.y = parseFloat( split[ 2 ] ); + domainMin.z = parseFloat( split[ 3 ] ); + break; + case 'DOMAIN_MAX': + domainMax.x = parseFloat( split[ 1 ] ); + domainMax.y = parseFloat( split[ 2 ] ); + domainMax.z = parseFloat( split[ 3 ] ); + break; + default: + const r = parseFloat( split[ 0 ] ); + const g = parseFloat( split[ 1 ] ); + const b = parseFloat( split[ 2 ] ); + + if ( + r > 1.0 || r < 0.0 || + g > 1.0 || g < 0.0 || + b > 1.0 || b < 0.0 + ) { + + throw new Error( 'LUTCubeLoader : Non normalized values not supported.' ); + + } + + data[ currIndex + 0 ] = r * 255; + data[ currIndex + 1 ] = g * 255; + data[ currIndex + 2 ] = b * 255; + currIndex += 3; + + } + + } + + const texture = new DataTexture(); + texture.image.data = data; + texture.image.width = size; + texture.image.height = size * size; + texture.format = RGBFormat; + texture.type = UnsignedByteType; + texture.magFilter = LinearFilter; + texture.wrapS = ClampToEdgeWrapping; + texture.wrapT = ClampToEdgeWrapping; + texture.generateMipmaps = false; + + const texture3D = new DataTexture3D(); + texture3D.image.data = data; + texture3D.image.width = size; + texture3D.image.height = size; + texture3D.image.depth = size; + texture3D.format = RGBFormat; + texture3D.type = UnsignedByteType; + texture3D.magFilter = LinearFilter; + texture3D.wrapS = ClampToEdgeWrapping; + texture3D.wrapT = ClampToEdgeWrapping; + texture3D.wrapR = ClampToEdgeWrapping; + texture3D.generateMipmaps = false; + + return { + title, + size, + domainMin, + domainMax, + texture, + texture3D, + }; + + } + +}
true
Other
mrdoob
three.js
9ab55519172a4472c1ff7ceab74f7bfa8c15475c.json
add initial lut demo
examples/files.json
@@ -249,6 +249,7 @@ ], "webgl / postprocessing": [ "webgl_postprocessing", + "webgl_postprocessing_3dlut", "webgl_postprocessing_advanced", "webgl_postprocessing_afterimage", "webgl_postprocessing_backgrounds",
true
Other
mrdoob
three.js
9ab55519172a4472c1ff7ceab74f7bfa8c15475c.json
add initial lut demo
examples/webgl_postprocessing_3dlut.html
@@ -0,0 +1,143 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <title>three.js webgl - 3d luts</title> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> + <link type="text/css" rel="stylesheet" href="main.css"> + </head> + + <body> + <div id="info"> + <a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - 3D LUTs<br /> + Battle Damaged Sci-fi Helmet by + <a href="https://sketchfab.com/theblueturtle_" target="_blank" rel="noopener">theblueturtle_</a><br /> + <a href="https://hdrihaven.com/hdri/?h=royal_esplanade" target="_blank" rel="noopener">Royal Esplanade</a> by <a href="https://hdrihaven.com/" target="_blank" rel="noopener">HDRI Haven</a> + </div> + + <script type="module"> + /* eslint-disable */ + import * as THREE from '../build/three.module.js'; + + import { OrbitControls } from './jsm/controls/OrbitControls.js'; + import { GLTFLoader } from './jsm/loaders/GLTFLoader.js'; + import { RGBELoader } from './jsm/loaders/RGBELoader.js'; + import { EffectComposer } from './jsm/postprocessing/EffectComposer.js'; + import { RenderPass } from './jsm/postprocessing/RenderPass.js'; + import { GUI } from './jsm/libs/dat.gui.module.js'; + + const params = { + enabled: true, + lut: 'Bourbon 64.CUBE' + }; + + const lutMap = { + 'Bourbon 64.CUBE': null, + 'Chemical 168.CUBE': null, + 'Clayton 33.CUBE': null, + 'Cubicle 99.CUBE': null + }; + + let gui; + let camera, scene, renderer; + let composer, lutPass; + + init(); + render(); + + function init() { + + const container = document.createElement( 'div' ); + document.body.appendChild( container ); + + camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.25, 20 ); + camera.position.set( - 1.8, 0.6, 2.7 ); + + scene = new THREE.Scene(); + + new RGBELoader() + .setDataType( THREE.UnsignedByteType ) + .setPath( 'textures/equirectangular/' ) + .load( 'royal_esplanade_1k.hdr', function ( texture ) { + + const envMap = pmremGenerator.fromEquirectangular( texture ).texture; + + scene.background = envMap; + scene.environment = envMap; + + texture.dispose(); + pmremGenerator.dispose(); + + render(); + + // model + + const loader = new GLTFLoader().setPath( 'models/gltf/DamagedHelmet/glTF/' ); + loader.load( 'DamagedHelmet.gltf', function ( gltf ) { + + scene.add( gltf.scene ); + render(); + + } ); + + } ); + + renderer = new THREE.WebGLRenderer( { antialias: true } ); + renderer.setPixelRatio( window.devicePixelRatio ); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + renderer.outputEncoding = THREE.sRGBEncoding; + container.appendChild( renderer.domElement ); + + composer = new EffectComposer( renderer ); + composer.setPixelRatio( window.devicePixelRatio ); + composer.setSize( window.innerWidth, window.innerHeight ); + composer.addPass( new RenderPass( scene, camera ) ); + + // lutPass = new LUTPass(); + // composer.addPass( lutPass ); + + const pmremGenerator = new THREE.PMREMGenerator( renderer ); + pmremGenerator.compileEquirectangularShader(); + + const controls = new OrbitControls( camera, renderer.domElement ); + controls.addEventListener( 'change', render ); // use if there is no animation loop + controls.minDistance = 2; + controls.maxDistance = 10; + controls.target.set( 0, 0, - 0.2 ); + controls.update(); + + gui = new GUI(); + gui.width = 350; + gui.add( params, 'enabled' ); + gui.add( params, 'lut', Object.keys( lutMap ) ); + + window.addEventListener( 'resize', onWindowResize, false ); + + } + + function onWindowResize() { + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize( window.innerWidth, window.innerHeight ); + composer.setSize( window.innerWidth, window.innerHeight ); + + render(); + + } + + // + + function render() { + + composer.render(); + + } + + </script> + + </body> +</html>
true
Other
mrdoob
three.js
8eed0bba85ee41dd43935f545a4a675554adc047.json
Add mouseButtons to TrackballControls
examples/jsm/controls/TrackballControls.d.ts
@@ -22,6 +22,7 @@ export class TrackballControls extends EventDispatcher { minDistance: number; maxDistance: number; keys: number[]; + mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE }; target: Vector3; position0: Vector3;
false
Other
mrdoob
three.js
a3e1703aebcbf1b8d7618ada1d69c18c9fafe1a0.json
Fix ReferenceError in check-coverage.js
test/e2e/check-coverage.js
@@ -13,11 +13,13 @@ const S = fs.readdirSync( './examples/screenshots' ) // files.js const F = []; -eval( fs.readFileSync( './examples/files.js' ).toString() ); -for ( var key in files ) { +// To expose files variable to out of eval scope, we need var statement, not const. +eval( fs.readFileSync( './examples/files.js' ) + .toString().replace( 'const files', 'var files' ) ); +for ( const key in files ) { - var section = files[ key ]; - for ( var i = 0, len = section.length; i < len; i ++ ) { + const section = files[ key ]; + for ( let i = 0, len = section.length; i < len; i ++ ) { F.push( section[ i ] );
false
Other
mrdoob
three.js
c29a1f8818b1907af53a8bf3efa9423a6ca186b7.json
Add unit test for Object3D.updateMatrix()
test/unit/src/core/Object3D.tests.js
@@ -500,9 +500,30 @@ export default QUnit.module( 'Core', () => { } ); - QUnit.todo( "updateMatrix", ( assert ) => { - - assert.ok( false, "everything's gonna be alright" ); + QUnit.test( "updateMatrix", ( assert ) => { + + const a = new Object3D(); + a.position.set( 2, 3, 4 ); + a.quaternion.set( 5, 6, 7, 8 ); + a.scale.set( 9, 10, 11 ); + + assert.deepEqual( a.matrix.elements, [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ], "Updating position, quaternion, or scale has no effect to matrix until calling updateMatrix()" ); + + a.updateMatrix(); + + assert.deepEqual( a.matrix.elements, [ + -1521, 1548, -234, 0, + -520, -1470, 1640, 0, + 1826, 44, -1331, 0, + 2, 3, 4, 1 + ], "matrix is calculated from position, quaternion, and scale" ); + + assert.equal( a.matrixWorldNeedsUpdate, true, "The flag indicating world matrix needs to be updated should be true" ); } );
false
Other
mrdoob
three.js
3e231ef9008bce4ad1a7629ee674e39a83a2cc1e.json
Fix the total size of RoundedBoxBufferGeometry
examples/jsm/geometries/RoundedBoxBufferGeometry.js
@@ -78,18 +78,16 @@ class RoundedBoxBufferGeometry extends BoxBufferGeometry { for ( let i = 0, j = 0; i < positions.length; i += 3, j += 2 ) { position.fromArray( positions, i ); - normal.copy( position ).normalize(); - - positions[ i + 0 ] = box.x * Math.sign( position.x ) + normal.x * radius; - positions[ i + 1 ] = box.y * Math.sign( position.y ) + normal.y * radius; - positions[ i + 2 ] = box.z * Math.sign( position.z ) + normal.z * radius; - normal.copy( position ); normal.x -= Math.sign( normal.x ) * halfSegmentSize; normal.y -= Math.sign( normal.y ) * halfSegmentSize; normal.z -= Math.sign( normal.z ) * halfSegmentSize; normal.normalize(); + positions[ i + 0 ] = box.x * Math.sign( position.x ) + normal.x * radius; + positions[ i + 1 ] = box.y * Math.sign( position.y ) + normal.y * radius; + positions[ i + 2 ] = box.z * Math.sign( position.z ) + normal.z * radius; + normals[ i + 0 ] = normal.x; normals[ i + 1 ] = normal.y; normals[ i + 2 ] = normal.z;
false
Other
mrdoob
three.js
334f2cf76e38944d010a1c70679706a5bb3c5b08.json
fix webgl_gpgpu_birds_gltf cohesion 0 error
examples/webgl_gpgpu_birds_gltf.html
@@ -179,8 +179,9 @@ // Attraction / Cohesion - move closer float threshDelta = 1.0 - alignmentThresh; - threshDelta = max( threshDelta, 1e-6 ); - float adjustedPercent = ( percent - alignmentThresh ) / threshDelta; + float adjustedPercent; + if( threshDelta == 0. ) adjustedPercent = 1.; + else adjustedPercent = ( percent - alignmentThresh ) / threshDelta; f = ( 0.5 - ( cos( adjustedPercent * PI_2 ) * -0.5 + 0.5 ) ) * delta;
false
Other
mrdoob
three.js
16b1e6593903b0ae13e68e296a3a0941a4d1b56a.json
fix webgl_gpgpu_birds_gltf cohesion 0 error
examples/webgl_gpgpu_birds_gltf.html
@@ -179,6 +179,7 @@ // Attraction / Cohesion - move closer float threshDelta = 1.0 - alignmentThresh; + threshDelta = max( threshDelta, 1e-6 ); float adjustedPercent = ( percent - alignmentThresh ) / threshDelta; f = ( 0.5 - ( cos( adjustedPercent * PI_2 ) * -0.5 + 0.5 ) ) * delta;
false
Other
mrdoob
three.js
66b7db927b6947c629c3cf9b266824a8474c5898.json
move changes into js directory rather than jsm
examples/js/loaders/SVGLoader.js
@@ -386,6 +386,9 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype var numbers = parseFloats( data ); for ( var j = 0, jl = numbers.length; j < jl; j += 7 ) { + + // skip command if start point == end point + if( numbers[ j + 5 ] == point.x && numbers[ j + 6 ] == point.y ) continue; var start = point.clone(); point.x = numbers[ j + 5 ]; @@ -576,6 +579,9 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype for ( var j = 0, jl = numbers.length; j < jl; j += 7 ) { + // skip command if no displacement + if( numbers[ j + 5 ] == 0 && numbers[ j + 6 ] == 0 ) continue; + var start = point.clone(); point.x += numbers[ j + 5 ]; point.y += numbers[ j + 6 ]; @@ -660,6 +666,12 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype function parseArcCommand( path, rx, ry, x_axis_rotation, large_arc_flag, sweep_flag, start, end ) { + if( rx == 0 || ry == 0 ) { + // draw a line if either of the radii == 0 + path.lineTo( end.x, end.y ); + return; + } + x_axis_rotation = x_axis_rotation * Math.PI / 180; // Ensure radii are positive
false
Other
mrdoob
three.js
139866dd3ff4b6a57074cd9c691aa4846393d3d6.json
move check into parse arc function
examples/jsm/loaders/SVGLoader.js
@@ -282,7 +282,7 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), { } break; - + case 'L': var numbers = parseFloats( data ); @@ -398,25 +398,18 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), { var numbers = parseFloats( data ); for ( var j = 0, jl = numbers.length; j < jl; j += 7 ) { + // skip command if start point == end point - if( numbers[ j + 5 ] == point.x && numbers[ j + 6 ] == point.y ) continue + if( numbers[ j + 5 ] == point.x && numbers[ j + 6 ] == point.y ) continue; - var start = point.clone(); point.x = numbers[ j + 5 ]; point.y = numbers[ j + 6 ]; control.x = point.x; control.y = point.y; - - if( numbers[ j ] == 0 || numbers[ j + 1 ] == 0 ) { - // draw a line if either of the radii == 0 - path.lineTo( point.x, point.y ); - } - else { - parseArcCommand( - path, numbers[ j ], numbers[ j + 1 ], numbers[ j + 2 ], numbers[ j + 3 ], numbers[ j + 4 ], start, point - ); - } + parseArcCommand( + path, numbers[ j ], numbers[ j + 1 ], numbers[ j + 2 ], numbers[ j + 3 ], numbers[ j + 4 ], start, point + ); if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); @@ -595,27 +588,23 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), { case 'a': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 7 ) { - // skip command if start point == end point - if( numbers[ j + 5 ] == 0 && numbers[ j + 6 ] == 0 ) continue + + // skip command if no displacement + if( numbers[ j + 5 ] == 0 && numbers[ j + 6 ] == 0 ) continue; var start = point.clone(); point.x += numbers[ j + 5 ]; point.y += numbers[ j + 6 ]; control.x = point.x; control.y = point.y; - - if( numbers[ j ] == 0 || numbers[ j + 1 ] == 0 ) { - // draw a line if either of the radii == 0 - path.lineTo( point.x, point.y ); - } - else { - parseArcCommand( - path, numbers[ j ], numbers[ j + 1 ], numbers[ j + 2 ], numbers[ j + 3 ], numbers[ j + 4 ], start, point - ); - } + parseArcCommand( + path, numbers[ j ], numbers[ j + 1 ], numbers[ j + 2 ], numbers[ j + 3 ], numbers[ j + 4 ], start, point + ); if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; @@ -689,6 +678,12 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), { function parseArcCommand( path, rx, ry, x_axis_rotation, large_arc_flag, sweep_flag, start, end ) { + if( rx == 0 || ry == 0 ) { + // draw a line if either of the radii == 0 + path.lineTo( end.x, end.y ); + return; + } + x_axis_rotation = x_axis_rotation * Math.PI / 180; // Ensure radii are positive
false
Other
mrdoob
three.js
3ddf815fb671482d33a17ff3c49908e237b99878.json
Add WebWorker OBJLoader
docs/manual/en/introduction/Libraries-and-Plugins.html
@@ -51,6 +51,7 @@ <h3>File Formats</h3> <ul> <li>[link:https://github.com/gkjohnson/urdf-loaders/tree/master/javascript urdf-loader]</li> <li>[link:https://github.com/NASA-AMMOS/3DTilesRendererJS 3d-tiles-renderer-js]</li> + <li>[link:https://github.com/kaisalmen/WWOBJLoader WebWorker OBJLoader]</li> </ul> <h3>3D Text and Layout</h3>
false
Other
mrdoob
three.js
749317ff845464b0561b35f48926fa58b213d13f.json
add ECSY, official examples comments
docs/manual/en/introduction/Libraries-and-Plugins.html
@@ -26,6 +26,11 @@ <h3>Physics</h3> <h3>Postprocessing</h3> + <p> + In addition to the [link:https://github.com/mrdoob/three.js/tree/dev/examples/jsm/postprocessing official three.js postprocessing effects], + support for some additional effects and frameworks are available through external libraries. + </p> + <ul> <li>[link:https://github.com/vanruesc/postprocessing postprocessing]</li> </ul> @@ -38,6 +43,11 @@ <h3>Intersection and Raycasting Performance</h3> <h3>File Formats</h3> + <p> + In addition to the [link:https://github.com/mrdoob/three.js/tree/dev/examples/jsm/loaders official three.js loaders], + support for some additional formats is available through external libraries. + </p> + <ul> <li>[link:https://github.com/gkjohnson/urdf-loaders/tree/master/javascript urdf-loader]</li> <li>[link:https://github.com/NASA-AMMOS/3DTilesRendererJS 3d-tiles-renderer-js]</li> @@ -68,6 +78,7 @@ <h3>Wrappers and Frameworks</h3> <ul> <li>[link:https://aframe.io/ A-Frame]</li> <li>[link:https://github.com/pmndrs/react-three-fiber react-three-fiber]</li> + <li>[link:https://github.com/ecsyjs/ecsy-three ECSY]</li> </ul> </body>
false
Other
mrdoob
three.js
efcf5d26208d110a6a7f6c73a7fae57c7b28657c.json
Restore LightShadow export for now. #20147
src/Three.js
@@ -61,6 +61,7 @@ export { HemisphereLightProbe } from './lights/HemisphereLightProbe.js'; export { DirectionalLight } from './lights/DirectionalLight.js'; export { AmbientLight } from './lights/AmbientLight.js'; export { AmbientLightProbe } from './lights/AmbientLightProbe.js'; +export { LightShadow } from './lights/LightShadow.js'; export { Light } from './lights/Light.js'; export { LightProbe } from './lights/LightProbe.js'; export { StereoCamera } from './cameras/StereoCamera.js';
false
Other
mrdoob
three.js
45b2f2e585989d964ab633ecf7d42f7f1f0968cb.json
Fix types for Line2 Allow to access to the original LineGeometry and LineMaterial safely without an explicit cast
examples/jsm/lines/Line2.d.ts
@@ -4,6 +4,9 @@ import { LineMaterial } from './LineMaterial'; export class Line2 extends LineSegments2 { + geometry?: LineGeometry; + material?: LineMaterial; + constructor( geometry?: LineGeometry, material?: LineMaterial ); readonly isLine2: true;
false
Other
mrdoob
three.js
1f74b419cec9a4624e729b1e34907d9a6c6d083d.json
Adjust remaining strings
docs/api/en/math/Matrix3.html
@@ -105,7 +105,7 @@ <h3>[method:this fromArray]( [param:Array array], [param:Integer offset] )</h3> [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format. </p> - <h3>[method:this invert()]()</h3> + <h3>[method:this invert]()</h3> <p> Inverts this matrix, using the [link:https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution analytic method].
true
Other
mrdoob
three.js
1f74b419cec9a4624e729b1e34907d9a6c6d083d.json
Adjust remaining strings
docs/api/zh/math/Matrix3.html
@@ -100,7 +100,7 @@ <h3>[method:this fromArray]( [param:Array array], [param:Integer offset] )</h3> 使用基于列优先格式[link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major]的数组来设置该矩阵。 </p> - <h3>[method:this invert()]()</h3> + <h3>[method:this invert]()</h3> <p> Inverts this matrix, using the [link:https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution analytic method].
true
Other
mrdoob
three.js
1f74b419cec9a4624e729b1e34907d9a6c6d083d.json
Adjust remaining strings
docs/api/zh/math/Matrix4.html
@@ -172,7 +172,7 @@ <h3>[method:this fromArray]( [param:Array array], [param:Integer offset] )</h3> 使用基于列优先格式[link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major]的数组来设置该矩阵。 </p> - <h3>[method:this invert()]()</h3> + <h3>[method:this invert]()</h3> <p> Inverts this matrix, using the [link:https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution analytic method].
true
Other
mrdoob
three.js
cc036ac817e34488da65d886d3a4d457ba00bdd5.json
Adjust Matrix4.invert docs
docs/api/en/math/Matrix4.html
@@ -186,7 +186,7 @@ <h3>[method:this fromArray]( [param:Array array], [param:Integer offset] )</h3> [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format. </p> - <h3>[method:this invert()]()</h3> + <h3>[method:this invert]()</h3> <p> Inverts this matrix, using the [link:https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution analytic method].
false
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/js/exporters/GLTFExporter.js
@@ -1700,7 +1700,7 @@ THREE.GLTFExporter.prototype = { joints.push( nodeMap.get( skeleton.bones[ i ] ) ); temporaryBoneInverse.copy( skeleton.boneInverses[ i ] ); - + temporaryBoneInverse.multiply( object.bindMatrix ).toArray( inverseBindMatrices, i * 16 ); }
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/exporters/GLTFExporter.js
@@ -1724,7 +1724,7 @@ GLTFExporter.prototype = { joints.push( nodeMap.get( skeleton.bones[ i ] ) ); temporaryBoneInverse.copy( skeleton.boneInverses[ i ] ); - + temporaryBoneInverse.multiply( object.bindMatrix ).toArray( inverseBindMatrices, i * 16 ); }
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/loaders/3DMLoader.js
@@ -626,7 +626,7 @@ Rhino3dmLoader.prototype = Object.assign( Object.create( Loader.prototype ), { } else if ( geometry.isLinearLight ) { - console.warn( `THREE.3DMLoader: No conversion exists for linear lights.` ); + console.warn( 'THREE.3DMLoader: No conversion exists for linear lights.' ); return;
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/loaders/NodeMaterialLoader.js
@@ -23,9 +23,9 @@ var NodeMaterialLoaderUtils = { recursive = recursive !== undefined ? recursive : true; - if ( typeof uuid === "object" ) uuid = uuid.uuid; + if ( typeof uuid === 'object' ) uuid = uuid.uuid; - if ( typeof object === "object" ) { + if ( typeof object === 'object' ) { var keys = Object.keys( object ); @@ -116,7 +116,7 @@ Object.assign( NodeMaterialLoader.prototype, { if ( ! object ) { - console.warn( "Node \"" + uuid + "\" not found." ); + console.warn( 'Node "' + uuid + '" not found.' ); } @@ -128,12 +128,12 @@ Object.assign( NodeMaterialLoader.prototype, { switch ( typeof json ) { - case "boolean": - case "number": + case 'boolean': + case 'number': return json; - case "string": + case 'string': if ( /^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/i.test( json ) || this.library[ json ] ) { @@ -157,7 +157,7 @@ Object.assign( NodeMaterialLoader.prototype, { for ( var prop in json ) { - if ( prop === "uuid" ) continue; + if ( prop === 'uuid' ) continue; json[ prop ] = this.resolve( json[ prop ] ); @@ -179,7 +179,7 @@ Object.assign( NodeMaterialLoader.prototype, { node = json.nodes[ uuid ]; - object = new Nodes[ node.nodeType + "Node" ](); + object = new Nodes[ node.nodeType + 'Node' ](); if ( node.name ) {
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/loaders/OBJLoader2.js
@@ -299,7 +299,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), { this.setCallbackOnMeshAlter( onMeshAlter ); const fileLoaderOnLoad = function ( content ) { - scope.parser.callbacks.onLoad( scope.parse( content ), "OBJLoader2#load: Parsing completed" ); + scope.parser.callbacks.onLoad( scope.parse( content ), 'OBJLoader2#load: Parsing completed' ); };
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/loaders/OBJLoader2Parallel.js
@@ -73,7 +73,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp if ( jsmWorkerUrl === undefined || jsmWorkerUrl === null ) { - throw "The url to the jsm worker is not valid. Aborting..."; + throw 'The url to the jsm worker is not valid. Aborting...'; } @@ -165,7 +165,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp if ( this.parser.callbacks.onLoad === this.parser._onLoad ) { - throw "No callback other than the default callback was provided! Aborting!"; + throw 'No callback other than the default callback was provided! Aborting!'; }
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/loaders/lwo/IFFParser.js
@@ -93,7 +93,7 @@ IFFParser.prototype = { if ( topForm !== 'FORM' ) { - console.warn( "LWOLoader: Top-level FORM missing." ); + console.warn( 'LWOLoader: Top-level FORM missing.' ); return; } @@ -577,7 +577,7 @@ IFFParser.prototype = { var texture = { index: this.reader.getUint32(), - fileName: "" + fileName: '' }; // seach STIL block @@ -1137,27 +1137,27 @@ Debugger.prototype = { switch ( this.node ) { case 0: - nodeType = "FORM"; + nodeType = 'FORM'; break; case 1: - nodeType = "CHK"; + nodeType = 'CHK'; break; case 2: - nodeType = "S-CHK"; + nodeType = 'S-CHK'; break; } console.log( - "| ".repeat( this.depth ) + + '| '.repeat( this.depth ) + nodeType, this.nodeID, `( ${this.offset} ) -> ( ${this.dataOffset + this.length} )`, - ( ( this.node == 0 ) ? " {" : "" ), - ( ( this.skipped ) ? "SKIPPED" : "" ), - ( ( this.node == 0 && this.skipped ) ? "}" : "" ) + ( ( this.node == 0 ) ? ' {' : '' ), + ( ( this.skipped ) ? 'SKIPPED' : '' ), + ( ( this.node == 0 && this.skipped ) ? '}' : '' ) ); if ( this.node == 0 && ! this.skipped ) { @@ -1180,7 +1180,7 @@ Debugger.prototype = { if ( this.offset >= this.formList[ i ] ) { this.depth -= 1; - console.log( "| ".repeat( this.depth ) + "}" ); + console.log( '| '.repeat( this.depth ) + '}' ); this.formList.splice( - 1, 1 ); }
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/loaders/obj2/OBJLoader2Parser.js
@@ -285,7 +285,7 @@ OBJLoader2Parser.prototype = { _onLoad: function ( object3d, message ) { - console.log( "You reached parser default onLoad callback: " + message ); + console.log( 'You reached parser default onLoad callback: ' + message ); }, @@ -629,7 +629,7 @@ OBJLoader2Parser.prototype = { let smoothingGroupInt = parseInt( smoothingGroup ); if ( isNaN( smoothingGroupInt ) ) { - smoothingGroupInt = smoothingGroup === "off" ? 0 : 1; + smoothingGroupInt = smoothingGroup === 'off' ? 0 : 1; }
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/loaders/obj2/shared/MaterialHandler.js
@@ -96,7 +96,7 @@ MaterialHandler.prototype = { if ( materialCloneInstructions !== undefined && materialCloneInstructions !== null ) { let materialNameOrg = materialCloneInstructions.materialNameOrg; - materialNameOrg = ( materialNameOrg !== undefined && materialNameOrg !== null ) ? materialNameOrg : ""; + materialNameOrg = ( materialNameOrg !== undefined && materialNameOrg !== null ) ? materialNameOrg : ''; const materialOrg = this.materials[ materialNameOrg ]; if ( materialOrg ) {
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/loaders/obj2/utils/CodeSerializer.js
@@ -100,7 +100,7 @@ const CodeSerializer = { } else if ( typeof objectPart === 'object' ) { console.log( 'Omitting object "' + funcInstructions.getName() + '" and replace it with empty object.' ); - funcInstructions.setCode( "{}" ); + funcInstructions.setCode( '{}' ); } else {
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/loaders/obj2/worker/main/WorkerExecutionSupport.js
@@ -119,9 +119,9 @@ CodeBuilderInstructions.prototype = { const WorkerExecutionSupport = function () { // check worker support first - if ( window.Worker === undefined ) throw "This browser does not support web workers!"; - if ( window.Blob === undefined ) throw "This browser does not support Blob!"; - if ( typeof window.URL.createObjectURL !== 'function' ) throw "This browser does not support Object creation from URL!"; + if ( window.Worker === undefined ) throw 'This browser does not support web workers!'; + if ( window.Blob === undefined ) throw 'This browser does not support Blob!'; + if ( typeof window.URL.createObjectURL !== 'function' ) throw 'This browser does not support Object creation from URL!'; this._reset(); @@ -296,7 +296,7 @@ WorkerExecutionSupport.prototype = { try { - const worker = new Worker( codeBuilderInstructions.jsmWorkerUrl.href, { type: "module" } ); + const worker = new Worker( codeBuilderInstructions.jsmWorkerUrl.href, { type: 'module' } ); this._configureWorkerCommunication( worker, true, codeBuilderInstructions.defaultGeometryType, timeLabel ); } catch ( e ) { @@ -305,7 +305,7 @@ WorkerExecutionSupport.prototype = { // Chrome throws this exception, but Firefox currently does not complain, but can't execute the worker afterwards if ( e instanceof TypeError || e instanceof SyntaxError ) { - console.error( "Modules are not supported in workers." ); + console.error( 'Modules are not supported in workers.' ); } @@ -426,7 +426,7 @@ WorkerExecutionSupport.prototype = { _receiveWorkerMessage: function ( event ) { // fast-fail in case of error - if ( event.type === "error" ) { + if ( event.type === 'error' ) { console.error( event ); return;
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/modifiers/CurveModifier.js
@@ -132,13 +132,13 @@ export function modifyShader( material, uniforms, numberOfCurves = 1 ) { ${shader.vertexShader} ` // chunk import moved in front of modified shader below - .replace( '#include <beginnormal_vertex>', `` ) + .replace( '#include <beginnormal_vertex>', '' ) // vec3 transformedNormal declaration overriden below - .replace( '#include <defaultnormal_vertex>', `` ) + .replace( '#include <defaultnormal_vertex>', '' ) // vec3 transformed declaration overriden below - .replace( '#include <begin_vertex>', `` ) + .replace( '#include <begin_vertex>', '' ) // shader override .replace( @@ -315,7 +315,7 @@ export class InstancedFlow extends Flow { */ setCurve( index, curveNo ) { - if ( isNaN( curveNo ) ) throw Error( "curve index being set is Not a Number (NaN)" ); + if ( isNaN( curveNo ) ) throw Error( 'curve index being set is Not a Number (NaN)' ); this.whichCurve[ index ] = curveNo; this.writeChanges( index );
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/accessors/CameraNode.js
@@ -15,22 +15,22 @@ function CameraNode( scope, camera ) { CameraNode.Nodes = ( function () { var depthColor = new FunctionNode( [ - "float depthColor( float mNear, float mFar ) {", + 'float depthColor( float mNear, float mFar ) {', - " #ifdef USE_LOGDEPTHBUF_EXT", + ' #ifdef USE_LOGDEPTHBUF_EXT', - " float depth = gl_FragDepthEXT / gl_FragCoord.w;", + ' float depth = gl_FragDepthEXT / gl_FragCoord.w;', - " #else", + ' #else', - " float depth = gl_FragCoord.z / gl_FragCoord.w;", + ' float depth = gl_FragCoord.z / gl_FragCoord.w;', - " #endif", + ' #endif', - " return 1.0 - smoothstep( mNear, mFar, depth );", + ' return 1.0 - smoothstep( mNear, mFar, depth );', - "}" - ].join( "\n" ) ); + '}' + ].join( '\n' ) ); return { depthColor: depthColor @@ -44,7 +44,7 @@ CameraNode.TO_VERTEX = 'toVertex'; CameraNode.prototype = Object.create( TempNode.prototype ); CameraNode.prototype.constructor = CameraNode; -CameraNode.prototype.nodeType = "Camera"; +CameraNode.prototype.nodeType = 'Camera'; CameraNode.prototype.setCamera = function ( camera ) {
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/accessors/ColorsNode.js
@@ -13,7 +13,7 @@ function ColorsNode( index ) { ColorsNode.prototype = Object.create( TempNode.prototype ); ColorsNode.prototype.constructor = ColorsNode; -ColorsNode.prototype.nodeType = "Colors"; +ColorsNode.prototype.nodeType = 'Colors'; ColorsNode.prototype.generate = function ( builder, output ) {
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/accessors/LightNode.js
@@ -12,7 +12,7 @@ LightNode.TOTAL = 'total'; LightNode.prototype = Object.create( TempNode.prototype ); LightNode.prototype.constructor = LightNode; -LightNode.prototype.nodeType = "Light"; +LightNode.prototype.nodeType = 'Light'; LightNode.prototype.generate = function ( builder, output ) { @@ -22,7 +22,7 @@ LightNode.prototype.generate = function ( builder, output ) { } else { - console.warn( "THREE.LightNode is only compatible in \"light\" channel." ); + console.warn( 'THREE.LightNode is only compatible in "light" channel.' ); return builder.format( 'vec3( 0.0 )', this.type, output );
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/accessors/NormalNode.js
@@ -15,7 +15,7 @@ NormalNode.VIEW = 'view'; NormalNode.prototype = Object.create( TempNode.prototype ); NormalNode.prototype.constructor = NormalNode; -NormalNode.prototype.nodeType = "Normal"; +NormalNode.prototype.nodeType = 'Normal'; NormalNode.prototype.getShared = function () {
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/accessors/PositionNode.js
@@ -16,7 +16,7 @@ PositionNode.PROJECTION = 'projection'; PositionNode.prototype = Object.create( TempNode.prototype ); PositionNode.prototype.constructor = PositionNode; -PositionNode.prototype.nodeType = "Position"; +PositionNode.prototype.nodeType = 'Position'; PositionNode.prototype.getType = function ( ) {
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/accessors/ReflectNode.js
@@ -16,7 +16,7 @@ ReflectNode.VECTOR = 'vector'; ReflectNode.prototype = Object.create( TempNode.prototype ); ReflectNode.prototype.constructor = ReflectNode; -ReflectNode.prototype.nodeType = "Reflect"; +ReflectNode.prototype.nodeType = 'Reflect'; ReflectNode.prototype.getUnique = function ( builder ) { @@ -128,7 +128,7 @@ ReflectNode.prototype.generate = function ( builder, output ) { } else { - console.warn( "THREE.ReflectNode is not compatible with " + builder.shader + " shader." ); + console.warn( 'THREE.ReflectNode is not compatible with ' + builder.shader + ' shader.' ); return builder.format( 'vec3( 0.0 )', this.type, output );
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/accessors/ResolutionNode.js
@@ -12,7 +12,7 @@ function ResolutionNode() { ResolutionNode.prototype = Object.create( Vector2Node.prototype ); ResolutionNode.prototype.constructor = ResolutionNode; -ResolutionNode.prototype.nodeType = "Resolution"; +ResolutionNode.prototype.nodeType = 'Resolution'; ResolutionNode.prototype.updateFrame = function ( frame ) { @@ -27,7 +27,7 @@ ResolutionNode.prototype.updateFrame = function ( frame ) { } else { - console.warn( "ResolutionNode need a renderer in NodeFrame" ); + console.warn( 'ResolutionNode need a renderer in NodeFrame' ); }
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/accessors/ScreenUVNode.js
@@ -11,7 +11,7 @@ function ScreenUVNode( resolution ) { ScreenUVNode.prototype = Object.create( TempNode.prototype ); ScreenUVNode.prototype.constructor = ScreenUVNode; -ScreenUVNode.prototype.nodeType = "ScreenUV"; +ScreenUVNode.prototype.nodeType = 'ScreenUV'; ScreenUVNode.prototype.generate = function ( builder, output ) { @@ -23,7 +23,7 @@ ScreenUVNode.prototype.generate = function ( builder, output ) { } else { - console.warn( "THREE.ScreenUVNode is not compatible with " + builder.shader + " shader." ); + console.warn( 'THREE.ScreenUVNode is not compatible with ' + builder.shader + ' shader.' ); result = 'vec2( 0.0 )';
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/accessors/UVNode.js
@@ -11,7 +11,7 @@ function UVNode( index ) { UVNode.prototype = Object.create( TempNode.prototype ); UVNode.prototype.constructor = UVNode; -UVNode.prototype.nodeType = "UV"; +UVNode.prototype.nodeType = 'UV'; UVNode.prototype.generate = function ( builder, output ) {
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/core/AttributeNode.js
@@ -10,7 +10,7 @@ function AttributeNode( name, type ) { AttributeNode.prototype = Object.create( Node.prototype ); AttributeNode.prototype.constructor = AttributeNode; -AttributeNode.prototype.nodeType = "Attribute"; +AttributeNode.prototype.nodeType = 'Attribute'; AttributeNode.prototype.getAttributeType = function ( builder ) {
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/core/ConstNode.js
@@ -19,7 +19,7 @@ ConstNode.EPSILON = 'EPSILON'; ConstNode.prototype = Object.create( TempNode.prototype ); ConstNode.prototype.constructor = ConstNode; -ConstNode.prototype.nodeType = "Const"; +ConstNode.prototype.nodeType = 'Const'; ConstNode.prototype.getType = function ( builder ) { @@ -31,7 +31,7 @@ ConstNode.prototype.parse = function ( src, useDefine ) { this.src = src || ''; - var name, type, value = ""; + var name, type, value = ''; var match = this.src.match( declarationRegexp );
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/core/ExpressionNode.js
@@ -8,6 +8,6 @@ function ExpressionNode( src, type, keywords, extensions, includes ) { ExpressionNode.prototype = Object.create( FunctionNode.prototype ); ExpressionNode.prototype.constructor = ExpressionNode; -ExpressionNode.prototype.nodeType = "Expression"; +ExpressionNode.prototype.nodeType = 'Expression'; export { ExpressionNode };
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/core/FunctionCallNode.js
@@ -10,7 +10,7 @@ function FunctionCallNode( func, inputs ) { FunctionCallNode.prototype = Object.create( TempNode.prototype ); FunctionCallNode.prototype.constructor = FunctionCallNode; -FunctionCallNode.prototype.nodeType = "FunctionCall"; +FunctionCallNode.prototype.nodeType = 'FunctionCall'; FunctionCallNode.prototype.setFunction = function ( func, inputs ) {
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/core/FunctionNode.js
@@ -17,7 +17,7 @@ function FunctionNode( src, includes, extensions, keywords, type ) { FunctionNode.prototype = Object.create( TempNode.prototype ); FunctionNode.prototype.constructor = FunctionNode; -FunctionNode.prototype.nodeType = "Function"; +FunctionNode.prototype.nodeType = 'Function'; FunctionNode.prototype.useKeywords = true;
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/core/InputNode.js
@@ -18,7 +18,7 @@ InputNode.prototype.setReadonly = function ( value ) { this.readonly = value; - this.hashProperties = this.readonly ? [ "value" ] : undefined; + this.hashProperties = this.readonly ? [ 'value' ] : undefined; return this;
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/core/Node.js
@@ -4,7 +4,7 @@ function Node( type ) { this.uuid = MathUtils.generateUUID(); - this.name = ""; + this.name = ''; this.type = type; @@ -197,12 +197,12 @@ Node.prototype = { var data = {}; - if ( typeof this.nodeType !== "string" ) throw new Error( "Node does not allow serialization." ); + if ( typeof this.nodeType !== 'string' ) throw new Error( 'Node does not allow serialization.' ); data.uuid = this.uuid; data.nodeType = this.nodeType; - if ( this.name !== "" ) data.name = this.name; + if ( this.name !== '' ) data.name = this.name; if ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/core/NodeBuilder.js
@@ -74,28 +74,28 @@ function NodeBuilder() { this.attributes = {}; this.prefixCode = [ - "#ifdef TEXTURE_LOD_EXT", + '#ifdef TEXTURE_LOD_EXT', - " #define texCube(a, b) textureCube(a, b)", - " #define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)", + ' #define texCube(a, b) textureCube(a, b)', + ' #define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)', - " #define tex2D(a, b) texture2D(a, b)", - " #define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)", + ' #define tex2D(a, b) texture2D(a, b)', + ' #define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)', - "#else", + '#else', - " #define texCube(a, b) textureCube(a, b)", - " #define texCubeBias(a, b, c) textureCube(a, b, c)", + ' #define texCube(a, b) textureCube(a, b)', + ' #define texCubeBias(a, b, c) textureCube(a, b, c)', - " #define tex2D(a, b) texture2D(a, b)", - " #define tex2DBias(a, b, c) texture2D(a, b, c)", + ' #define tex2D(a, b) texture2D(a, b)', + ' #define tex2DBias(a, b, c) texture2D(a, b, c)', - "#endif", + '#endif', - "#include <packing>", - "#include <common>" + '#include <packing>', + '#include <common>' - ].join( "\n" ); + ].join( '\n' ); this.parsCode = { vertex: '', @@ -522,7 +522,7 @@ NodeBuilder.prototype = { this.resultCode[ shader ], this.finalCode[ shader ], '}' - ].join( "\n" ); + ].join( '\n' ); }, @@ -542,7 +542,7 @@ NodeBuilder.prototype = { if ( formatType === undefined ) { - throw new Error( "Node pars " + formatType + " not found." ); + throw new Error( 'Node pars ' + formatType + ' not found.' ); } @@ -677,7 +677,7 @@ NodeBuilder.prototype = { } else { - throw new Error( "Include not found." ); + throw new Error( 'Include not found.' ); } @@ -964,7 +964,7 @@ NodeBuilder.prototype = { } else if ( map.isWebGLRenderTarget ) { - console.warn( "THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead." ); + console.warn( 'THREE.WebGLPrograms.getTextureEncodingFromMap: don\'t use render targets as textures. Use their .texture property instead.' ); encoding = map.texture.encoding; }
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/core/NodeUtils.js
@@ -52,7 +52,7 @@ var NodeUtils = { for ( var i = 0; i < list.length; ++ i ) { - var data = list[ i ].split( "." ), + var data = list[ i ].split( '.' ), property = data[ 0 ], subProperty = data[ 1 ];
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/core/StructNode.js
@@ -13,7 +13,7 @@ function StructNode( src ) { StructNode.prototype = Object.create( TempNode.prototype ); StructNode.prototype.constructor = StructNode; -StructNode.prototype.nodeType = "Struct"; +StructNode.prototype.nodeType = 'Struct'; StructNode.prototype.getType = function ( builder ) {
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/core/TempNode.js
@@ -114,7 +114,7 @@ TempNode.prototype.getUuid = function ( unique ) { var uuid = unique || unique == undefined ? this.constructor.uuid || this.uuid : this.uuid; - if ( typeof this.scope === "string" ) uuid = this.scope + '-' + uuid; + if ( typeof this.scope === 'string' ) uuid = this.scope + '-' + uuid; return uuid; @@ -132,7 +132,7 @@ TempNode.prototype.getTemp = function ( builder, uuid ) { TempNode.prototype.generate = function ( builder, output, uuid, type, ns ) { - if ( ! this.getShared( builder, output ) ) console.error( "THREE.TempNode is not shared!" ); + if ( ! this.getShared( builder, output ) ) console.error( 'THREE.TempNode is not shared!' ); uuid = uuid || this.uuid;
true
Other
mrdoob
three.js
9f07bafb9b8410f55879e96be3d336e094e85cf9.json
Run lint fix on js and jsm files
examples/jsm/nodes/core/VarNode.js
@@ -10,7 +10,7 @@ function VarNode( type, value ) { VarNode.prototype = Object.create( Node.prototype ); VarNode.prototype.constructor = VarNode; -VarNode.prototype.nodeType = "Var"; +VarNode.prototype.nodeType = 'Var'; VarNode.prototype.getType = function ( builder ) {
true