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
6580a6e6d23484e437a4ceb0a968d54a47cc0500.json
Escape strings for use in regex search. (#23729)
docs/index.html
@@ -350,6 +350,12 @@ <h1><a href="https://threejs.org">three.js</a></h1> } + function escapeRegExp( string ) { + + return string.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' ); // https://stackoverflow.com/a/6969486/5250847 + + } + function updateFilter() { let v = filterInput.value.trim(); @@ -367,7 +373,7 @@ <h1><a href="https://threejs.org">three.js</a></h1> // - const regExp = new RegExp( filterInput.value, 'gi' ); + const regExp = new RegExp( escapeRegExp( v ), 'gi' ); for ( let pageName in pageProperties ) {
true
Other
mrdoob
three.js
6580a6e6d23484e437a4ceb0a968d54a47cc0500.json
Escape strings for use in regex search. (#23729)
examples/index.html
@@ -249,6 +249,12 @@ <h1><a href="https://threejs.org">three.js</a></h1> } + function escapeRegExp( string ) { + + return string.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' ); // https://stackoverflow.com/a/6969486/5250847 + + } + function updateFilter( files, tags ) { let v = filterInput.value.trim(); @@ -264,7 +270,7 @@ <h1><a href="https://threejs.org">three.js</a></h1> } - const exp = new RegExp( v, 'gi' ); + const exp = new RegExp( escapeRegExp( v ), 'gi' ); for ( const key in files ) {
true
Other
mrdoob
three.js
d28c286c183d6db719240cd214b42c6338d1b326.json
remove author comments
examples/jsm/loaders/3DMLoader.js
@@ -1,7 +1,3 @@ -/** - * @author Luis Fraguada / https://github.com/fraguada - */ - import { BufferGeometryLoader, FileLoader,
false
Other
mrdoob
three.js
7ab47df7621c655e99fbd4e9f8e934bcf27a3783.json
prefer const updates
examples/js/loaders/EXRLoader.js
@@ -938,15 +938,15 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade for ( let comp = 0; comp < numComp; ++ comp ) { - let type = channelData[ cscSet.idx[ comp ] ].type; + const type = channelData[ cscSet.idx[ comp ] ].type; for ( let y = 8 * blocky; y < 8 * blocky + maxY; ++ y ) { offset = rowOffsets[ comp ][ y ]; for ( let blockx = 0; blockx < numFullBlocksX; ++ blockx ) { - let src = blockx * 64 + ( ( y & 0x7 ) * 8 ); + const src = blockx * 64 + ( ( y & 0x7 ) * 8 ); dataView.setUint16( offset + 0 * INT16_SIZE * type, rowBlock[ comp ][ src + 0 ], true ); dataView.setUint16( offset + 1 * INT16_SIZE * type, rowBlock[ comp ][ src + 1 ], true ); @@ -969,8 +969,8 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade for ( let y = 8 * blocky; y < 8 * blocky + maxY; ++ y ) { - let offset = rowOffsets[ comp ][ y ] + 8 * numFullBlocksX * INT16_SIZE * type; - let src = numFullBlocksX * 64 + ( ( y & 0x7 ) * 8 ); + const offset = rowOffsets[ comp ][ y ] + 8 * numFullBlocksX * INT16_SIZE * type; + const src = numFullBlocksX * 64 + ( ( y & 0x7 ) * 8 ); for ( let x = 0; x < maxX; ++ x ) { @@ -999,7 +999,7 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade for ( var y = 0; y < height; ++ y ) { - let offset = rowOffsets[ comp ][ y ]; + const offset = rowOffsets[ comp ][ y ]; for ( var x = 0; x < width; ++ x ) { @@ -1416,7 +1416,7 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade let tmpBufferEnd = 0; let writePtr = 0; - let ptr = new Array( 4 ); + const ptr = new Array( 4 ); for ( let y = 0; y < info.lines; y ++ ) { @@ -2392,7 +2392,7 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade } - let format = ( this.type === THREE.UnsignedByteType ) ? THREE.RGBEFormat : ( numChannels === 4 ) ? THREE.RGBAFormat : THREE.RGBFormat; + const format = ( this.type === THREE.UnsignedByteType ) ? THREE.RGBEFormat : ( numChannels === 4 ) ? THREE.RGBAFormat : THREE.RGBFormat; return { header: EXRHeader,
false
Other
mrdoob
three.js
92b163611488ff62f858a7fd14cd9c85bb1e3c6d.json
maintain texture parameters
examples/jsm/utils/RoughnessMipmapper.js
@@ -7,7 +7,6 @@ */ import { - LinearMipMapLinearFilter, MathUtils, Mesh, NoBlending, @@ -72,7 +71,7 @@ RoughnessMipmapper.prototype = { if ( width !== roughnessMap.image.width || height !== roughnessMap.image.height ) { - var newRoughnessTarget = new WebGLRenderTarget( width, height, { minFilter: LinearMipMapLinearFilter, depthBuffer: false } ); + var newRoughnessTarget = new WebGLRenderTarget( width, height, { wrapS: roughnessMap.wrapS, wrapT: roughnessMap.wrapT, magFilter: roughnessMap.magFilter, minFilter: roughnessMap.minFilter, depthBuffer: false } ); newRoughnessTarget.texture.generateMipmaps = true;
false
Other
mrdoob
three.js
c960bb1b9ce8c409138ac54784e1b44f06477b5e.json
Extend object classes with generic types
src/objects/InstancedMesh.d.ts
@@ -8,7 +8,7 @@ import { Matrix4 } from './../math/Matrix4'; export class InstancedMesh < TGeometry extends Geometry | BufferGeometry = Geometry | BufferGeometry, TMaterial extends Material | Material[] = Material | Material[] -> extends Mesh { +> extends Mesh<TGeometry, TMaterial> { constructor( geometry: TGeometry,
true
Other
mrdoob
three.js
c960bb1b9ce8c409138ac54784e1b44f06477b5e.json
Extend object classes with generic types
src/objects/LineLoop.d.ts
@@ -6,7 +6,7 @@ import { BufferGeometry } from '../core/BufferGeometry'; export class LineLoop < TGeometry extends Geometry | BufferGeometry = Geometry | BufferGeometry, TMaterial extends Material | Material[] = Material | Material[] -> extends Line { +> extends Line<TGeometry, TMaterial> { constructor( geometry?: TGeometry,
true
Other
mrdoob
three.js
c960bb1b9ce8c409138ac54784e1b44f06477b5e.json
Extend object classes with generic types
src/objects/LineSegments.d.ts
@@ -15,7 +15,7 @@ export const LinePieces: number; export class LineSegments < TGeometry extends Geometry | BufferGeometry = Geometry | BufferGeometry, TMaterial extends Material | Material[] = Material | Material[] -> extends Line { +> extends Line<TGeometry, TMaterial> { constructor( geometry?: TGeometry,
true
Other
mrdoob
three.js
c960bb1b9ce8c409138ac54784e1b44f06477b5e.json
Extend object classes with generic types
src/objects/SkinnedMesh.d.ts
@@ -8,7 +8,7 @@ import { BufferGeometry } from '../core/BufferGeometry'; export class SkinnedMesh < TGeometry extends Geometry | BufferGeometry = Geometry | BufferGeometry, TMaterial extends Material | Material[] = Material | Material[] -> extends Mesh { +> extends Mesh<TGeometry, TMaterial> { constructor( geometry?: TGeometry,
true
Other
mrdoob
three.js
a6f25bce55a99918a16c5ff8055ab8a8ea0f577e.json
Remove duplicate transmission property (#22464)
src/materials/MeshPhysicalMaterial.js
@@ -72,7 +72,6 @@ class MeshPhysicalMaterial extends MeshStandardMaterial { this.sheenTint = new Color( 0x000000 ); this.sheenRoughness = 1.0; - this.transmission = 0.0; this.transmissionMap = null; this.thickness = 0.01; @@ -88,7 +87,6 @@ class MeshPhysicalMaterial extends MeshStandardMaterial { this._clearcoat = 0; this._transmission = 0; - this.setValues( parameters ); } @@ -129,7 +127,6 @@ class MeshPhysicalMaterial extends MeshStandardMaterial { } - copy( source ) { super.copy( source );
false
Other
mrdoob
three.js
595987ef5c783603ad93ee39551906a67eb24a8a.json
Prevent infinite loop in Mesh.raycast(). (#22068)
src/objects/Mesh.js
@@ -170,7 +170,7 @@ class Mesh extends Object3D { const groupMaterial = material[ group.materialIndex ]; const start = Math.max( group.start, drawRange.start ); - const end = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ); + const end = Math.min( index.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) ); for ( let j = start, jl = end; j < jl; j += 3 ) { @@ -228,7 +228,7 @@ class Mesh extends Object3D { const groupMaterial = material[ group.materialIndex ]; const start = Math.max( group.start, drawRange.start ); - const end = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ); + const end = Math.min( position.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) ); for ( let j = start, jl = end; j < jl; j += 3 ) {
false
Other
mrdoob
three.js
a8ebd6d330ec42f87dc037a2e9e992fe1ecc59f1.json
Use roughness-squared in sheen BRDF
src/renderers/shaders/ShaderChunk/bsdfs.glsl.js
@@ -220,8 +220,10 @@ vec3 BRDF_BlinnPhong( const in IncidentLight incidentLight, const in GeometricCo // https://github.com/google/filament/blob/master/shaders/src/brdf.fs float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF" - float invAlpha = 1.0 / roughness; + float invAlpha = 1.0 / alpha; float cos2h = dotNH * dotNH; float sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16
false
Other
mrdoob
three.js
e0dfbc1b44e5c61beaae824e8ed627ba4bdcb23b.json
Improve clearcoat energy conservation (#22389)
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js
@@ -16,14 +16,10 @@ struct PhysicalMaterial { }; -#define DEFAULT_SPECULAR_COEFFICIENT 0.04 - -// Clear coat directional hemishperical reflectance (this approximation should be improved) -float clearcoatDHRApprox( const in float roughness, const in float dotNL ) { +// temporary +vec3 clearcoatSpecular = vec3( 0.0 ); - return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) ); - -} +#define DEFAULT_SPECULAR_COEFFICIENT 0.04 // Analytical approximation of the DFG LUT, one half of the // split-sum approximation used in indirect specular lighting. @@ -131,42 +127,31 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricC #ifdef CLEARCOAT - float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); + float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); - vec3 ccIrradiance = ccDotNL * directLight.color; + vec3 ccIrradiance = dotNLcc * directLight.color; #ifndef PHYSICALLY_CORRECT_LIGHTS ccIrradiance *= PI; // punctual light #endif - float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL ); - - reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), 1.0, material.clearcoatRoughness ); - - #else - - float clearcoatDHR = 0.0; + clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), 1.0, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN - reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Sheen( - material.roughness, - directLight.direction, - geometry, - material.sheenTint - ); + reflectedLight.directSpecular += irradiance * BRDF_Sheen( material.roughness, directLight.direction, geometry, material.sheenTint ); #else - reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness ); + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness ); #endif - reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { @@ -179,21 +164,10 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #ifdef CLEARCOAT - float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); - - reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, vec3( DEFAULT_SPECULAR_COEFFICIENT ), 1.0, material.clearcoatRoughness ); - - float ccDotNL = ccDotNV; - float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL ); - - #else - - float clearcoatDHR = 0.0; + clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, vec3( DEFAULT_SPECULAR_COEFFICIENT ), 1.0, material.clearcoatRoughness ); #endif - float clearcoatInv = 1.0 - clearcoatDHR; - // Both indirect specular and indirect diffuse light accumulate here vec3 singleScattering = vec3( 0.0 ); @@ -204,7 +178,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) ); - reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering; + reflectedLight.indirectSpecular += radiance * singleScattering; reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
true
Other
mrdoob
three.js
e0dfbc1b44e5c61beaae824e8ed627ba4bdcb23b.json
Improve clearcoat energy conservation (#22389)
src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js
@@ -107,6 +107,16 @@ void main() { vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef CLEARCOAT + + float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); + + vec3 Fcc = F_Schlick( vec3( DEFAULT_SPECULAR_COEFFICIENT ), 1.0, dotNVcc ); + + outgoingLight = outgoingLight * ( 1.0 - clearcoat * Fcc ) + clearcoatSpecular * clearcoat; + + #endif + gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include <tonemapping_fragment>
true
Other
mrdoob
three.js
efba1d0b0150d6fc4987273de0f9fb29275b35f7.json
Build ESM target first. (#22371)
utils/build/rollup.config.js
@@ -275,6 +275,21 @@ ${ code }`; } export default [ + { + input: 'src/Three.js', + plugins: [ + addons(), + glconstants(), + glsl(), + header() + ], + output: [ + { + format: 'esm', + file: 'build/three.module.js' + } + ] + }, { input: 'src/Three.js', plugins: [ @@ -320,20 +335,5 @@ export default [ file: 'build/three.min.js' } ] - }, - { - input: 'src/Three.js', - plugins: [ - addons(), - glconstants(), - glsl(), - header() - ], - output: [ - { - format: 'esm', - file: 'build/three.module.js' - } - ] } ];
false
Other
mrdoob
three.js
fa64d4a0f3b36fc738128c98862f83cf4ec91ea3.json
Remove unused parameter
src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js
@@ -7,7 +7,7 @@ export default /* glsl */` #endif - vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) { + vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry ) { #if defined( ENVMAP_TYPE_CUBE_UV ) @@ -25,7 +25,7 @@ export default /* glsl */` } - vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) { + vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { #if defined( ENVMAP_TYPE_CUBE_UV )
true
Other
mrdoob
three.js
fa64d4a0f3b36fc738128c98862f83cf4ec91ea3.json
Remove unused parameter
src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js
@@ -18,19 +18,19 @@ export default /* glsl */` #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) - iblIrradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, maxMipLevel ); + iblIrradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) - radiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel ); + radiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.normal, material.specularRoughness ); #ifdef CLEARCOAT - clearcoatRadiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel ); + clearcoatRadiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); #endif
true
Other
mrdoob
three.js
528ada08ea8abfbe4f81ab1ecb08f63396d8c113.json
Simplify Schlick signature (#22316)
src/renderers/shaders/ShaderChunk/bsdfs.glsl.js
@@ -5,6 +5,7 @@ export default /* glsl */` // via 'environmentBRDF' from "Physically Based Shading on Mobile" // https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) { + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); @@ -13,7 +14,7 @@ vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) { float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; - return vec2( -1.04, 1.04 ) * a004 + r.zw; + return vec2( - 1.04, 1.04 ) * a004 + r.zw; } @@ -40,7 +41,7 @@ float punctualLightIntensityToIrradianceFactor( const in float lightDistance, co if( cutoffDistance > 0.0 && decayExponent > 0.0 ) { - return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent ); + return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); } @@ -56,16 +57,16 @@ vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) { } // validated -vec3 F_Schlick( const in vec3 f0, const in vec3 f90, const in float dotVH ) { +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { // Original approximation by Christophe Schlick '94 // float fresnel = pow( 1.0 - dotVH, 5.0 ); // Optimized variant (presented by Epic at SIGGRAPH '13) // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf - float fresnel = exp2( ( -5.55473 * dotVH - 6.98316 ) * dotVH ); + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return ( f90 - f0 ) * fresnel + f0; + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } // validated @@ -95,8 +96,8 @@ float D_GGX( const in float alpha, const in float dotNH ) { } -// GGX Distribution, Schlick Fresnel, GGX-Smith Visibility -vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in vec3 f90, const in float roughness ) { +// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility +vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) { float alpha = pow2( roughness ); // UE4's roughness @@ -287,7 +288,7 @@ vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in Ge float dotNH = saturate( dot( geometry.normal, halfDir ) ); float dotVH = saturate( dot( geometry.viewDir, halfDir ) ); - vec3 F = F_Schlick( specularColor, vec3( 1.0 ), dotVH ); + vec3 F = F_Schlick( specularColor, 1.0, dotVH ); float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );
true
Other
mrdoob
three.js
528ada08ea8abfbe4f81ab1ecb08f63396d8c113.json
Simplify Schlick signature (#22316)
src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js
@@ -13,7 +13,7 @@ material.specularRoughness = min( material.specularRoughness, 1.0 ); #ifdef SPECULAR - vec3 specularIntensityFactor = vec3( specularIntensity ); + float specularIntensityFactor = specularIntensity; vec3 specularTintFactor = specularTint; #ifdef USE_SPECULARINTENSITYMAP @@ -28,13 +28,13 @@ material.specularRoughness = min( material.specularRoughness, 1.0 ); #endif - material.specularColorF90 = mix( specularIntensityFactor, vec3( 1.0 ), metalnessFactor ); + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); #else - vec3 specularIntensityFactor = vec3( 1.0 ); + float specularIntensityFactor = 1.0; vec3 specularTintFactor = vec3( 1.0 ); - material.specularColorF90 = vec3( 1.0 ); + material.specularF90 = 1.0; #endif @@ -43,7 +43,7 @@ material.specularRoughness = min( material.specularRoughness, 1.0 ); #else material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor ); - material.specularColorF90 = vec3( 1.0 ); + material.specularF90 = 1.0; #endif
true
Other
mrdoob
three.js
528ada08ea8abfbe4f81ab1ecb08f63396d8c113.json
Simplify Schlick signature (#22316)
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js
@@ -4,7 +4,7 @@ struct PhysicalMaterial { vec3 diffuseColor; float specularRoughness; vec3 specularColor; - vec3 specularColorF90; + float specularF90; #ifdef CLEARCOAT float clearcoat; @@ -93,7 +93,7 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricC float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL ); - reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), vec3( 1.0 ), material.clearcoatRoughness ); + reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), 1.0, material.clearcoatRoughness ); #else @@ -102,14 +102,18 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricC #endif #ifdef USE_SHEEN + reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen( material.specularRoughness, directLight.direction, geometry, material.sheenColor ); + #else - reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularColorF90, material.specularRoughness); + + reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.specularRoughness ); + #endif reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
true
Other
mrdoob
three.js
d2fae357d7243cbb219925c2a3f5b8d89e7ebc65.json
improve SkinnedMesh.boneTransform docs (#23422)
docs/api/en/objects/SkinnedMesh.html
@@ -148,9 +148,15 @@ <h3>[method:undefined pose]()</h3> This method sets the skinned mesh in the rest pose (resets the pose). </p> - <h3>[method:Vector3 boneTransform]( [index:Integer], [target:Vector3] )</h3> + <h3>[method:Vector3 boneTransform]( [param:Integer index], [param:Vector3 target] )</h3> <p> Calculates the position of the vertex at the given index relative to the current bone transformations. + Target vector must be initialized with the vetrex coordinates prior to the transformation: + <code> +const target = new THREE.Vector3(); +target.fromBufferAttribute( mesh.geometry.attributes.position, index ); +mesh.boneTransform( index, target ); + </code> </p> <h2>Source</h2>
false
Other
mrdoob
three.js
63cf8afd7c23c03cc2402c7765a7762b0c39d887.json
clarify the example in SkinnedMesh docs (#23423)
docs/api/en/objects/SkinnedMesh.html
@@ -38,7 +38,8 @@ <h2>Code Example</h2> <code> const geometry = new THREE.CylinderGeometry( 5, 5, 5, 5, 15, 5, 30 ); - // create the skin indices and skin weights + // create the skin indices and skin weights manually + // (typically a loader would read this data from a 3D model for you) const position = geometry.attributes.position;
false
Other
mrdoob
three.js
b44e5a661e6bea2bdb95543acbb2fd6ead39ca8a.json
Fix Live Editor for r137 (#23373) This is a more generic fix than hardcoding checks for 'three'. Also fixes the export function.
manual/examples/resources/editor-settings.js
@@ -61,7 +61,7 @@ function fixSourceLinks(url, source) { const urlPropRE = /(url:\s*)('|")(.*?)('|")/g; const workerRE = /(new\s+Worker\s*\(\s*)('|")(.*?)('|")/g; const importScriptsRE = /(importScripts\s*\(\s*)('|")(.*?)('|")/g; - const moduleRE = /(import.*?)(?!'three')('|")(.*?)('|")/g; + const moduleRE = /(import.*?)('|")(.*?)('|")/g; const prefix = getPrefix(url); const rootPrefix = getRootPrefix(url); @@ -82,8 +82,9 @@ function fixSourceLinks(url, source) { function makeTaggedFDedQuotes(match, start, q1, url, q2, suffix) { return start + q1 + addPrefix(url) + q2 + suffix; } - function makeFDedQuotes(match, start, q1, url, q2) { - return start + q1 + addPrefix(url) + q2; + function makeFDedQuotesModule(match, start, q1, url, q2) { + // modules require relative paths or fully qualified, otherwise they are module names + return `${start}${q1}${url.startsWith('.') ? addPrefix(url) : url}${q2}`; } function makeArrayLinksFDed(match, prefix, arrayStr, suffix) { const lines = arrayStr.split(',').map((line) => { @@ -105,7 +106,7 @@ function fixSourceLinks(url, source) { source = source.replace(importScriptsRE, makeLinkFDedQuotes); source = source.replace(loaderArrayLoadRE, makeArrayLinksFDed); source = source.replace(threejsUrlRE, makeTaggedFDedQuotes); - source = source.replace(moduleRE, makeFDedQuotes); + source = source.replace(moduleRE, makeFDedQuotesModule); return source; } @@ -130,8 +131,8 @@ let version; async function fixJSForCodeSite(js) { const moduleRE = /(import.*?)('|")(.*?)('|")/g; - // convert https://threejs.org/build/three.module.js -> https://cdn.skypack.dev/three@<version> - // convert https://threejs.org/examples/jsm/.?? -> https://cdn.skypack.dev/three@<version>/examples/jsm/.?? + // convert https://threejs.org/build/three.module.js -> https://unpkg.com/three@<version> + // convert https://threejs.org/examples/jsm/.?? -> https://unpkg.com/three@<version>/examples/jsm/.?? if (!version) { try { @@ -146,10 +147,10 @@ async function fixJSForCodeSite(js) { function addVersion(href) { if (href.startsWith(window.location.origin)) { if (href.includes('/build/three.module.js')) { - return `https://cdn.skypack.dev/three@${version}`; + return `https://unpkg.com/three@${version}`; } else if (href.includes('/examples/jsm/')) { const url = new URL(href); - return `https://cdn.skypack.dev/three@${version}${url.pathname}${url.search}${url.hash}`; + return `https://unpkg.com/three@${version}${url.pathname}${url.search}${url.hash}`; } } return href;
true
Other
mrdoob
three.js
b44e5a661e6bea2bdb95543acbb2fd6ead39ca8a.json
Fix Live Editor for r137 (#23373) This is a more generic fix than hardcoding checks for 'three'. Also fixes the export function.
manual/examples/resources/editor.html
@@ -190,9 +190,6 @@ border-bottom: none !important; border-top: 5px solid #666 !important; } -.button-export { - display: none; /* TODO: Fix export with import maps */ -} .button-result { margin-left: 2em !important; }
true
Other
mrdoob
three.js
b44e5a661e6bea2bdb95543acbb2fd6ead39ca8a.json
Fix Live Editor for r137 (#23373) This is a more generic fix than hardcoding checks for 'three'. Also fixes the export function.
manual/examples/resources/editor.js
@@ -122,6 +122,26 @@ const htmlParts = { }, }; +function getRootPrefix(url) { + const u = new URL(url, window.location.href); + return u.origin; +} + +function removeDotDotSlash(href) { + // assumes a well formed URL. In other words: 'https://..//foo.html" is a bad URL and this code would fail. + const url = new URL(href, window.location.href); + const parts = url.pathname.split('/'); + for (;;) { + const dotDotNdx = parts.indexOf('..'); + if (dotDotNdx < 0) { + break; + } + parts.splice(dotDotNdx - 1, 2); + } + url.pathname = parts.join('/'); + return url.toString(); +} + function forEachHTMLPart(fn) { Object.keys(htmlParts).forEach(function(name, ndx) { const info = htmlParts[name]; @@ -201,10 +221,17 @@ async function getWorkerScripts(text, baseUrl, scriptInfos = {}) { return `${prefix}${quote}${fqURL}${quote}`; } + function replaceWithUUIDModule(match, prefix, quote, url) { + // modules are either relative, fully qualified, or a module name + // Skip it if it's a module name + return (url.startsWith('.') || url.includes('://')) + ? replaceWithUUID(match, prefix, quote, url) + : match.toString(); + } text = text.replace(workerRE, replaceWithUUID); text = text.replace(importScriptsRE, replaceWithUUID); - text = text.replace(importRE, replaceWithUUID); + text = text.replace(importRE, replaceWithUUIDModule); await Promise.all(newScripts.map((url) => { return getScript(url, scriptInfos); @@ -233,8 +260,8 @@ async function parseHTML(url, html) { const bodyRE = /<body>([^]*?)<\/body>/i; const inlineScriptRE = /<script>([^]*?)<\/script>/i; const inlineModuleScriptRE = /<script type="module">([^]*?)<\/script>/i; - const externalScriptRE = /(<!--(?:(?!-->)[\s\S])*?-->\n){0,1}<script\s+(type="module"\s+)?src\s*=\s*"(.*?)"\s*>\s*<\/script>/ig; - const dataScriptRE = /(<!--(?:(?!-->)[\s\S])*?-->\n){0,1}<script(.*?id=".*?)>([^]*?)<\/script>/ig; + const externalScriptRE = /(<!--(?:(?!-->)[\s\S])*?-->\n){0,1}<script\s+([^>]*?)(type="module"\s+)?src\s*=\s*"(.*?)"(.*?)>\s*<\/script>/ig; + const dataScriptRE = /(<!--(?:(?!-->)[\s\S])*?-->\n){0,1}<script([^>]*?type="(?!module).*?".*?)>([^]*?)<\/script>/ig; const cssLinkRE = /<link ([^>]+?)>/g; const isCSSLinkRE = /type="text\/css"|rel="stylesheet"/; const hrefRE = /href="([^"]+)"/; @@ -270,19 +297,48 @@ async function parseHTML(url, html) { const kScript = 'script'; const scripts = []; - html = html.replace(externalScriptRE, function(p0, p1, type, p2) { + html = html.replace(externalScriptRE, function(p0, p1, p2, type, p3, p4) { p1 = p1 || ''; - scripts.push(`${p1}<${kScript} ${safeStr(type)}src="${p2}"></${kScript}>`); + scripts.push(`${p1}<${kScript} ${p2}${safeStr(type)}src="${p3}"${p4}></${kScript}>`); return ''; }); + const prefix = getPrefix(url); + const rootPrefix = getRootPrefix(url); + + function addCorrectPrefix(href) { + return (href.startsWith('/')) + ? `${rootPrefix}${href}` + : removeDotDotSlash((`${prefix}/${href}`).replace(/\/.\//g, '/')); + } + + function addPrefix(url) { + return url.indexOf('://') < 0 && !url.startsWith('data:') && url[0] !== '?' + ? removeDotDotSlash(addCorrectPrefix(url)) + : url; + } + + const importMapRE = /type\s*=["']importmap["']/; const dataScripts = []; - html = html.replace(dataScriptRE, function(p0, p1, p2, p3) { - p1 = p1 || ''; - dataScripts.push(`${p1}<${kScript} ${p2}>${p3}</${kScript}>`); + html = html.replace(dataScriptRE, function(p0, blockComments, scriptTagAttrs, content) { + blockComments = blockComments || ''; + if (importMapRE.test(scriptTagAttrs)) { + const imap = JSON.parse(content); + const imports = imap.imports; + if (imports) { + for (let [k, url] of Object.entries(imports)) { + if (url.indexOf('://') < 0 && !url.startsWith('data:')) { + imports[k] = addPrefix(url); + } + } + } + content = JSON.stringify(imap, null, '\t'); + } + dataScripts.push(`${blockComments}<${kScript} ${scriptTagAttrs}>${content}</${kScript}>`); return ''; }); + htmlParts.html.sources[0].source += dataScripts.join('\n'); htmlParts.html.sources[0].source += scripts.join('\n'); @@ -296,8 +352,6 @@ async function parseHTML(url, html) { // query params but that only works in Firefox >:( html = html.replace('</head>', '<script id="hackedparams">window.hackedParams = ${hackedParams}\n</script>\n</head>'); - html = html.replace('../../build/three.module.js', window.location.origin + '/build/three.module.js'); - html = extraHTMLParsing(html, htmlParts); let links = '';
true
Other
mrdoob
three.js
b3119d196ae99ed45eabbf173671db53a0001a97.json
Update HTMLMesh.js (#23381) Render number input values in HTMLMesh
examples/jsm/interactive/HTMLMesh.js
@@ -229,7 +229,7 @@ function html2canvas( element ) { drawBorder( style, 'borderBottom', x, y + height, width, 0 ); drawBorder( style, 'borderRight', x + width, y, 0, height ); - if ( element.type === 'color' || element.type === 'text' ) { + if ( element.type === 'color' || element.type === 'text' || element.type === 'number' ) { clipper.add( { x: x, y: y, width: width, height: height } );
false
Other
mrdoob
three.js
941a09bad225f1294ad4295ab9362eb30fae633f.json
add link to github draft PR page removed add [draft] from title. draft PR is enough and should be perferred
.github/CONTRIBUTING.md
@@ -77,6 +77,6 @@ When you’ve decided to make changes, start with the following: * Once done with a patch / feature do not add more commits to a feature branch * Create separate branches per patch or feature. -* If you make a PR but it is not actually ready to be pulled into the dev branch, add `[Draft]` into the PR title and/or convert it to a draft PR +* If you make a PR but it is not actually ready to be pulled into the dev branch then please [convert it to a draft PR](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-stage-of-a-pull-request#converting-a-pull-request-to-a-draft). This project is currently contributed to mostly via everyone's spare time. Please keep that in mind as it may take some time for the appropriate feedback to get to you. If you are unsure about adding a new feature, it might be better to ask first to see whether other people think it's a good idea.
false
Other
mrdoob
three.js
724c0bdf8a6ca5a02745fb2778c9e89431215604.json
Fix typo in GLTFLoader.js accomodate -> accommodate
examples/js/loaders/GLTFLoader.js
@@ -2566,7 +2566,7 @@ THREE.GLTFLoader = ( function () { * Assigns final material to a Mesh, Line, or Points instance. The instance * already has a material (generated from the glTF material options alone) * but reuse of the same glTF material may require multiple threejs materials - * to accomodate different primitive types, defines, etc. New materials will + * to accommodate different primitive types, defines, etc. New materials will * be created if necessary, and reused from a cache. * @param {THREE.Object3D} mesh Mesh, Line, or Points instance. */
false
Other
mrdoob
three.js
761cae1547e0ee5632f242c011ae6fdac187bf2b.json
Fix docs for CurvePath.getCurveLengths
docs/api/en/extras/core/CurvePath.html
@@ -49,8 +49,8 @@ <h3>[method:null add]( [param:Curve curve] )</h3> <h3>[method:null closePath]()</h3> <p>Adds a [page:LineCurve lineCurve] to close the path.</p> - <h3>[method:Float getCurveLengths]()</h3> - <p>Adds together the lengths of the curves in the [page:.curves] array.</p> + <h3>[method:Array getCurveLengths]()</h3> + <p>Get list of cumulative curve lengths of the curves in the [page:.curves] array.</p> <h3>[method:Vector getPoint]( [param:Float t] )</h3> <p>
true
Other
mrdoob
three.js
761cae1547e0ee5632f242c011ae6fdac187bf2b.json
Fix docs for CurvePath.getCurveLengths
docs/api/zh/extras/core/CurvePath.html
@@ -49,7 +49,7 @@ <h3>[method:null add]( [param:Curve curve] )</h3> <h3>[method:null closePath]()</h3> <p>添加一条[page:LineCurve lineCurve]用于闭合路径。</p> - <h3>[method:Float getCurveLengths]()</h3> + <h3>[method:Array getCurveLengths]()</h3> <p>将[page:.curves]数组中曲线的长度相加。</p> <h3>[method:Vector getPoint]( [param:Float t] )</h3>
true
Other
mrdoob
three.js
7208eb816b10b291540ae7905555697a4a6a1431.json
Replace soft tags with hard tabs
examples/jsm/loaders/GLTFLoader.js
@@ -258,7 +258,7 @@ var GLTFLoader = ( function () { parser.fileLoader.setRequestHeader( this.requestHeader ); - for ( var i = 0; i < this.pluginCallbacks.length; i ++ ) { + for ( var i = 0; i < this.pluginCallbacks.length; i ++ ) { var plugin = this.pluginCallbacks[ i ]( parser ); plugins[ plugin.name ] = plugin;
false
Other
mrdoob
three.js
74533eefd3ded6327ca08c3cae019947861a7f43.json
Improve ACES Filmic tone mapping
src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js
@@ -31,11 +31,42 @@ vec3 OptimizedCineonToneMapping( vec3 color ) { } -// source: https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ +// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs +vec3 RRTAndODTFit( vec3 v ) { + + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; + +} + vec3 ACESFilmicToneMapping( vec3 color ) { - color *= toneMappingExposure; - return saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) ); + // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), // transposed from source + vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + + // ODT_SAT => XYZ => D60_2_D65 => sRGB + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), // transposed from source + vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + + color *= toneMappingExposure; + + color = ACESInputMat * color; + + // Apply RRT and ODT + color = RRTAndODTFit( color ); + + color = ACESOutputMat * color; + + // Clamp to [0, 1] + return saturate( color ); } `;
false
Other
mrdoob
three.js
dcc6abe55f67242bc333b07aa0f98a799238805f.json
Change screenSpacePanning default value
docs/examples/en/controls/OrbitControls.html
@@ -236,7 +236,8 @@ <h3>[property:Float rotateSpeed]</h3> <h3>[property:Boolean screenSpacePanning]</h3> <p> Defines how the camera's position is translated when panning. If true, the camera pans in screen space. - Otherwise, the camera pans in the plane orthogonal to the camera's up direction. Default is false. + Otherwise, the camera pans in the plane orthogonal to the camera's up direction. + Default is true for OrbitControls; false for MapControls. </p> <h3>[property:Vector3 target0]</h3>
true
Other
mrdoob
three.js
dcc6abe55f67242bc333b07aa0f98a799238805f.json
Change screenSpacePanning default value
docs/examples/zh/controls/OrbitControls.html
@@ -234,7 +234,10 @@ <h3>[property:Float rotateSpeed]</h3> <h3>[property:Boolean screenSpacePanning]</h3> <p> 定义当平移的时候摄像机的位置将如何移动。如果为true,摄像机将在屏幕空间内平移。 - 否则,摄像机将在与摄像机向上方向垂直的平面中平移。其默认值为false。 + 否则,摄像机将在与摄像机向上方向垂直的平面中平移。 + Defines how the camera's position is translated when panning. If true, the camera pans in screen space. + Otherwise, the camera pans in the plane orthogonal to the camera's up direction. + Default is true for OrbitControls; false for MapControls. </p> <h3>[property:Vector3 target0]</h3>
true
Other
mrdoob
three.js
dcc6abe55f67242bc333b07aa0f98a799238805f.json
Change screenSpacePanning default value
examples/js/controls/OrbitControls.js
@@ -64,7 +64,7 @@ THREE.OrbitControls = function ( object, domElement ) { // Set to false to disable panning this.enablePan = true; this.panSpeed = 1.0; - this.screenSpacePanning = false; // if true, pan in screen-space + this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up this.keyPanSpeed = 7.0; // pixels moved per arrow key push // Set to true to automatically rotate around the target @@ -1139,6 +1139,8 @@ THREE.MapControls = function ( object, domElement ) { THREE.OrbitControls.call( this, object, domElement ); + this.screenSpacePanning = false; // pan orthogonal to world-space direction camera.up + this.mouseButtons.LEFT = THREE.MOUSE.PAN; this.mouseButtons.RIGHT = THREE.MOUSE.ROTATE;
true
Other
mrdoob
three.js
dcc6abe55f67242bc333b07aa0f98a799238805f.json
Change screenSpacePanning default value
examples/jsm/controls/OrbitControls.js
@@ -73,7 +73,7 @@ var OrbitControls = function ( object, domElement ) { // Set to false to disable panning this.enablePan = true; this.panSpeed = 1.0; - this.screenSpacePanning = false; // if true, pan in screen-space + this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up this.keyPanSpeed = 7.0; // pixels moved per arrow key push // Set to true to automatically rotate around the target @@ -1148,6 +1148,8 @@ var MapControls = function ( object, domElement ) { OrbitControls.call( this, object, domElement ); + this.screenSpacePanning = false; // pan orthogonal to world-space direction camera.up + this.mouseButtons.LEFT = MOUSE.PAN; this.mouseButtons.RIGHT = MOUSE.ROTATE;
true
Other
mrdoob
three.js
14de6bc258762803301a74cf80e137ad25e97f5a.json
Fix a lint error
examples/jsm/loaders/GLTFLoader.js
@@ -1482,7 +1482,7 @@ var GLTFLoader = ( function () { // Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the // expensive work of uploading a texture to the GPU off the main thread. - if (typeof createImageBitmap !== 'undefined') { + if ( typeof createImageBitmap !== 'undefined' ) { this.textureLoader.setImageLoader( new ImageBitmapLoader( this.options.manager ) ); }
true
Other
mrdoob
three.js
14de6bc258762803301a74cf80e137ad25e97f5a.json
Fix a lint error
src/loaders/TextureLoader.js
@@ -7,7 +7,7 @@ import { ImageLoader } from './ImageLoader.js'; import { Texture } from '../textures/Texture.js'; import { Loader } from './Loader.js'; -function TextureLoader( manager, imageLoader ) { +function TextureLoader( manager ) { Loader.call( this, manager ); @@ -23,7 +23,7 @@ TextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), { const texture = new Texture(); - if ( !this.imageLoader ) { + if ( ! this.imageLoader ) { this.imageLoader = new ImageLoader( this.manager );
true
Other
mrdoob
three.js
b4d64ca5fb3d25385709b427dfcd8a9242fec78e.json
Add support for LightProbes
src/renderers/shaders/ShaderChunk/lights_lambert_vertex.glsl.js
@@ -13,7 +13,6 @@ backGeometry.viewDir = geometry.viewDir; vLightFront = vec3( 0.0 ); vIndirectFront = vec3( 0.0 ); - #ifdef DOUBLE_SIDED vLightBack = vec3( 0.0 ); vIndirectBack = vec3( 0.0 ); @@ -23,6 +22,18 @@ IncidentLight directLight; float dotNL; vec3 directLightColor_Diffuse; +vIndirectFront += getAmbientLightIrradiance( ambientLightColor ); + +vIndirectFront += getLightProbeIrradiance( lightProbe, geometry ); + +#ifdef DOUBLE_SIDED + + vIndirectBack += getAmbientLightIrradiance( ambientLightColor ); + + vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry ); + +#endif + #if NUM_POINT_LIGHTS > 0 #pragma unroll_loop_start
true
Other
mrdoob
three.js
b4d64ca5fb3d25385709b427dfcd8a9242fec78e.json
Add support for LightProbes
src/renderers/shaders/ShaderLib/meshlambert_frag.glsl.js
@@ -52,7 +52,6 @@ void main() { #include <emissivemap_fragment> // accumulation - reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor ); #ifdef DOUBLE_SIDED @@ -81,6 +80,7 @@ void main() { reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask(); // modulation + #include <aomap_fragment> vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
true
Other
mrdoob
three.js
b886901e6ce83ff42b2286879c58c586e5f2f835.json
Update Collada Exporter to export lightmap uvs
examples/jsm/exporters/ColladaExporter.js
@@ -264,6 +264,13 @@ ColladaExporter.prototype = { triangleInputs += `<input semantic="TEXCOORD" source="#${ uvName }" offset="0" set="0" />`; } + + // serialize lightmap uvs + if ( 'uv2' in bufferGeometry.attributes ) { + var uvName = `${ meshid }-texcoord2`; + gnode += getAttribute( bufferGeometry.attributes.uv2, uvName, [ 'S', 'T' ], 'float' ); + triangleInputs += `<input semantic="TEXCOORD" source="#${ uvName }" offset="0" set="1" />`; + } // serialize colors if ( 'color' in bufferGeometry.attributes ) { @@ -273,7 +280,7 @@ ColladaExporter.prototype = { triangleInputs += `<input semantic="COLOR" source="#${ colName }" offset="0" />`; } - + var indexArray = null; if ( bufferGeometry.index ) {
false
Other
mrdoob
three.js
c0a69a1f79a0b32fcfb69fe6649b933d767be579.json
Add makeEmpty function to Sphere
docs/api/en/math/Sphere.html
@@ -76,6 +76,9 @@ <h3>[method:Float distanceToPoint]( [param:Vector3 point] )</h3> <h3>[method:Boolean empty]()</h3> <p>Checks to see if the sphere is empty (the radius set to 0).</p> + <h3>[method:Sphere makeEmpty]()</h3> + <p>Makes the sphere empty by setting [page:.center center] to (0, 0, 0) and [page:.radius radius] to 0.</p> + <h3>[method:Boolean equals]( [param:Sphere sphere] )</h3> <p> Checks to see if the two spheres' centers and radii are equal.
true
Other
mrdoob
three.js
c0a69a1f79a0b32fcfb69fe6649b933d767be579.json
Add makeEmpty function to Sphere
docs/api/zh/math/Sphere.html
@@ -73,6 +73,9 @@ <h3>[method:Float distanceToPoint]( [param:Vector3 point] )</h3> <h3>[method:Boolean empty]()</h3> <p>检查球是否为空(其半径设为了0).</p> + <h3>[method:Sphere makeEmpty]()</h3> + <p>Makes the sphere empty by setting [page:.center center] to (0, 0, 0) and [page:.radius radius] to 0.</p> + <h3>[method:Boolean equals]( [param:Sphere sphere] )</h3> <p> 检查这两个球的球心与半径是否相等。
true
Other
mrdoob
three.js
c0a69a1f79a0b32fcfb69fe6649b933d767be579.json
Add makeEmpty function to Sphere
src/math/Sphere.d.ts
@@ -15,6 +15,7 @@ export class Sphere { clone(): this; copy( sphere: Sphere ): this; empty(): boolean; + makeEmpty(): this; containsPoint( point: Vector3 ): boolean; distanceToPoint( point: Vector3 ): number; intersectsSphere( sphere: Sphere ): boolean;
true
Other
mrdoob
three.js
c0a69a1f79a0b32fcfb69fe6649b933d767be579.json
Add makeEmpty function to Sphere
src/math/Sphere.js
@@ -75,6 +75,15 @@ Object.assign( Sphere.prototype, { }, + makeEmpty: function () { + + this.center.set( 0, 0, 0 ); + this.radius = 0; + + return this; + + }, + containsPoint: function ( point ) { return ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );
true
Other
mrdoob
three.js
7630e7a649738cf28ad4fe5a9235da17d74de30c.json
Update unit tests.
test/unit/src/extras/curves/CatmullRomCurve3.tests.js
@@ -232,10 +232,10 @@ export default QUnit.module( 'Extras', () => { ]; var points = [ - curve.getPointAt( 0 ), - curve.getPointAt( 0.3 ), - curve.getPointAt( 0.5 ), - curve.getPointAt( 1 ) + curve.getPointAt( 0, new Vector3() ), + curve.getPointAt( 0.3, new Vector3() ), + curve.getPointAt( 0.5, new Vector3() ), + curve.getPointAt( 1, new Vector3() ) ]; assert.deepEqual( points, expectedPoints, "Correct points" ); @@ -256,11 +256,11 @@ export default QUnit.module( 'Extras', () => { ]; var tangents = [ - curve.getTangent( 0 ), - curve.getTangent( 0.25 ), - curve.getTangent( 0.5 ), - curve.getTangent( 0.75 ), - curve.getTangent( 1 ) + curve.getTangent( 0, new Vector3() ), + curve.getTangent( 0.25, new Vector3() ), + curve.getTangent( 0.5, new Vector3() ), + curve.getTangent( 0.75, new Vector3() ), + curve.getTangent( 1, new Vector3() ) ]; expectedTangents.forEach( function ( exp, i ) { @@ -274,20 +274,20 @@ export default QUnit.module( 'Extras', () => { // - var expectedTangents = [ + expectedTangents = [ new Vector3( 0, 1, 0 ), new Vector3( - 0.10709018822205997, 0.9884651653817284, 0.10709018822205997 ), new Vector3( 0.6396363672964268, - 0.4262987629159402, - 0.6396363672964268 ), new Vector3( 0.5077298411616501, - 0.6960034603275557, - 0.5077298411616501 ), new Vector3( - 0.00019991333100812723, - 0.9999999600346592, 0.00019991333100812723 ) ]; - var tangents = [ - curve.getTangentAt( 0 ), - curve.getTangentAt( 0.25 ), - curve.getTangentAt( 0.5 ), - curve.getTangentAt( 0.75 ), - curve.getTangentAt( 1 ) + tangents = [ + curve.getTangentAt( 0, new Vector3() ), + curve.getTangentAt( 0.25, new Vector3() ), + curve.getTangentAt( 0.5, new Vector3() ), + curve.getTangentAt( 0.75, new Vector3() ), + curve.getTangentAt( 1, new Vector3() ) ]; expectedTangents.forEach( function ( exp, i ) {
true
Other
mrdoob
three.js
7630e7a649738cf28ad4fe5a9235da17d74de30c.json
Update unit tests.
test/unit/src/extras/curves/CubicBezierCurve.tests.js
@@ -116,10 +116,10 @@ export default QUnit.module( 'Extras', () => { ]; var points = [ - curve.getPointAt( 0 ), - curve.getPointAt( 0.3 ), - curve.getPointAt( 0.5 ), - curve.getPointAt( 1 ) + curve.getPointAt( 0, new Vector2() ), + curve.getPointAt( 0.3, new Vector2() ), + curve.getPointAt( 0.5, new Vector2() ), + curve.getPointAt( 1, new Vector2() ) ]; assert.deepEqual( points, expectedPoints, "Correct points" ); @@ -137,11 +137,11 @@ export default QUnit.module( 'Extras', () => { ]; var tangents = [ - curve.getTangent( 0 ), - curve.getTangent( 0.25 ), - curve.getTangent( 0.5 ), - curve.getTangent( 0.75 ), - curve.getTangent( 1 ) + curve.getTangent( 0, new Vector2() ), + curve.getTangent( 0.25, new Vector2() ), + curve.getTangent( 0.5, new Vector2() ), + curve.getTangent( 0.75, new Vector2() ), + curve.getTangent( 1, new Vector2() ) ]; expectedTangents.forEach( function ( exp, i ) { @@ -164,11 +164,11 @@ export default QUnit.module( 'Extras', () => { ]; var tangents = [ - curve.getTangentAt( 0 ), - curve.getTangentAt( 0.25 ), - curve.getTangentAt( 0.5 ), - curve.getTangentAt( 0.75 ), - curve.getTangentAt( 1 ) + curve.getTangentAt( 0, new Vector2() ), + curve.getTangentAt( 0.25, new Vector2() ), + curve.getTangentAt( 0.5, new Vector2() ), + curve.getTangentAt( 0.75, new Vector2() ), + curve.getTangentAt( 1, new Vector2() ) ]; expectedTangents.forEach( function ( exp, i ) {
true
Other
mrdoob
three.js
7630e7a649738cf28ad4fe5a9235da17d74de30c.json
Update unit tests.
test/unit/src/extras/curves/CubicBezierCurve3.tests.js
@@ -116,10 +116,10 @@ export default QUnit.module( 'Extras', () => { ]; var points = [ - curve.getPointAt( 0 ), - curve.getPointAt( 0.3 ), - curve.getPointAt( 0.5 ), - curve.getPointAt( 1 ) + curve.getPointAt( 0, new Vector3() ), + curve.getPointAt( 0.3, new Vector3() ), + curve.getPointAt( 0.5, new Vector3() ), + curve.getPointAt( 1, new Vector3() ) ]; assert.deepEqual( points, expectedPoints, "Correct points" ); @@ -137,11 +137,11 @@ export default QUnit.module( 'Extras', () => { ]; var tangents = [ - curve.getTangent( 0 ), - curve.getTangent( 0.25 ), - curve.getTangent( 0.5 ), - curve.getTangent( 0.75 ), - curve.getTangent( 1 ) + curve.getTangent( 0, new Vector3() ), + curve.getTangent( 0.25, new Vector3() ), + curve.getTangent( 0.5, new Vector3() ), + curve.getTangent( 0.75, new Vector3() ), + curve.getTangent( 1, new Vector3() ) ]; expectedTangents.forEach( function ( exp, i ) { @@ -164,11 +164,11 @@ export default QUnit.module( 'Extras', () => { ]; tangents = [ - curve.getTangentAt( 0 ), - curve.getTangentAt( 0.25 ), - curve.getTangentAt( 0.5 ), - curve.getTangentAt( 0.75 ), - curve.getTangentAt( 1 ) + curve.getTangentAt( 0, new Vector3() ), + curve.getTangentAt( 0.25, new Vector3() ), + curve.getTangentAt( 0.5, new Vector3() ), + curve.getTangentAt( 0.75, new Vector3() ), + curve.getTangentAt( 1, new Vector3() ) ]; expectedTangents.forEach( function ( exp, i ) {
true
Other
mrdoob
three.js
7630e7a649738cf28ad4fe5a9235da17d74de30c.json
Update unit tests.
test/unit/src/extras/curves/EllipseCurve.tests.js
@@ -107,13 +107,16 @@ export default QUnit.module( 'Extras', () => { var testValues = [ 0, 0.3, 0.5, 0.7, 1 ]; - testValues.forEach( function ( val, i ) { + var p = new Vector2(); + var a = new Vector2(); + + testValues.forEach( function ( val ) { var expectedX = Math.cos( val * Math.PI * 2 ) * 10; var expectedY = Math.sin( val * Math.PI * 2 ) * 10; - var p = curve.getPoint( val ); - var a = curve.getPointAt( val ); + curve.getPoint( val, p ); + curve.getPointAt( val, a ); assert.numEqual( p.x, expectedX, "getPoint(" + val + ").x correct" ); assert.numEqual( p.y, expectedY, "getPoint(" + val + ").y correct" ); @@ -136,11 +139,11 @@ export default QUnit.module( 'Extras', () => { ]; var tangents = [ - curve.getTangent( 0 ), - curve.getTangent( 0.25 ), - curve.getTangent( 0.5 ), - curve.getTangent( 0.75 ), - curve.getTangent( 1 ) + curve.getTangent( 0, new Vector2() ), + curve.getTangent( 0.25, new Vector2() ), + curve.getTangent( 0.5, new Vector2() ), + curve.getTangent( 0.75, new Vector2() ), + curve.getTangent( 1, new Vector2() ) ]; expectedTangents.forEach( function ( exp, i ) {
true
Other
mrdoob
three.js
7630e7a649738cf28ad4fe5a9235da17d74de30c.json
Update unit tests.
test/unit/src/extras/curves/LineCurve.tests.js
@@ -66,10 +66,10 @@ export default QUnit.module( 'Extras', () => { ]; var points = [ - curve.getPointAt( 0 ), - curve.getPointAt( 0.3 ), - curve.getPointAt( 0.5 ), - curve.getPointAt( 1 ) + curve.getPointAt( 0, new Vector2() ), + curve.getPointAt( 0.3, new Vector2() ), + curve.getPointAt( 0.5, new Vector2() ), + curve.getPointAt( 1, new Vector2() ) ]; assert.deepEqual( points, expectedPoints, "Correct points" ); @@ -79,8 +79,9 @@ export default QUnit.module( 'Extras', () => { QUnit.test( "getTangent", ( assert ) => { var curve = _curve; + var tangent = new Vector2(); - var tangent = curve.getTangent( 0 ); + curve.getTangent( 0, tangent ); var expectedTangent = Math.sqrt( 0.5 ); assert.numEqual( tangent.x, expectedTangent, "tangent.x correct" );
true
Other
mrdoob
three.js
7630e7a649738cf28ad4fe5a9235da17d74de30c.json
Update unit tests.
test/unit/src/extras/curves/LineCurve3.tests.js
@@ -66,10 +66,10 @@ export default QUnit.module( 'Extras', () => { ]; var points = [ - curve.getPointAt( 0 ), - curve.getPointAt( 0.3 ), - curve.getPointAt( 0.5 ), - curve.getPointAt( 1 ) + curve.getPointAt( 0, new Vector3() ), + curve.getPointAt( 0.3, new Vector3() ), + curve.getPointAt( 0.5, new Vector3() ), + curve.getPointAt( 1, new Vector3() ) ]; assert.deepEqual( points, expectedPoints, "Correct getPointAt points" ); @@ -145,8 +145,9 @@ export default QUnit.module( 'Extras', () => { QUnit.test( "getTangent/getTangentAt", ( assert ) => { var curve = _curve; + var tangent = new Vector3(); - var tangent = curve.getTangent( 0.5 ); + curve.getTangent( 0.5, tangent ); var expectedTangent = Math.sqrt( 1 / 3 ); assert.numEqual( tangent.x, expectedTangent, "tangent.x correct" );
true
Other
mrdoob
three.js
7630e7a649738cf28ad4fe5a9235da17d74de30c.json
Update unit tests.
test/unit/src/extras/curves/QuadraticBezierCurve.tests.js
@@ -120,10 +120,10 @@ export default QUnit.module( 'Extras', () => { ]; var points = [ - curve.getPointAt( 0 ), - curve.getPointAt( 0.3 ), - curve.getPointAt( 0.5 ), - curve.getPointAt( 1 ) + curve.getPointAt( 0, new Vector2() ), + curve.getPointAt( 0.3, new Vector2() ), + curve.getPointAt( 0.5, new Vector2() ), + curve.getPointAt( 1, new Vector2() ) ]; assert.deepEqual( points, expectedPoints, "Correct points" ); @@ -143,11 +143,11 @@ export default QUnit.module( 'Extras', () => { ]; var tangents = [ - curve.getTangent( 0 ), - curve.getTangent( 0.25 ), - curve.getTangent( 0.5 ), - curve.getTangent( 0.75 ), - curve.getTangent( 1 ) + curve.getTangent( 0, new Vector2() ), + curve.getTangent( 0.25, new Vector2() ), + curve.getTangent( 0.5, new Vector2() ), + curve.getTangent( 0.75, new Vector2() ), + curve.getTangent( 1, new Vector2() ) ]; expectedTangents.forEach( function ( exp, i ) { @@ -170,11 +170,11 @@ export default QUnit.module( 'Extras', () => { ]; tangents = [ - curve.getTangentAt( 0 ), - curve.getTangentAt( 0.25 ), - curve.getTangentAt( 0.5 ), - curve.getTangentAt( 0.75 ), - curve.getTangentAt( 1 ) + curve.getTangentAt( 0, new Vector2() ), + curve.getTangentAt( 0.25, new Vector2() ), + curve.getTangentAt( 0.5, new Vector2() ), + curve.getTangentAt( 0.75, new Vector2() ), + curve.getTangentAt( 1, new Vector2() ) ]; expectedTangents.forEach( function ( exp, i ) {
true
Other
mrdoob
three.js
7630e7a649738cf28ad4fe5a9235da17d74de30c.json
Update unit tests.
test/unit/src/extras/curves/QuadraticBezierCurve3.tests.js
@@ -120,10 +120,10 @@ export default QUnit.module( 'Extras', () => { ]; var points = [ - curve.getPointAt( 0 ), - curve.getPointAt( 0.3 ), - curve.getPointAt( 0.5 ), - curve.getPointAt( 1 ) + curve.getPointAt( 0, new Vector3() ), + curve.getPointAt( 0.3, new Vector3() ), + curve.getPointAt( 0.5, new Vector3() ), + curve.getPointAt( 1, new Vector3() ) ]; assert.deepEqual( points, expectedPoints, "Correct points" ); @@ -143,11 +143,11 @@ export default QUnit.module( 'Extras', () => { ]; var tangents = [ - curve.getTangent( 0 ), - curve.getTangent( 0.25 ), - curve.getTangent( 0.5 ), - curve.getTangent( 0.75 ), - curve.getTangent( 1 ) + curve.getTangent( 0, new Vector3() ), + curve.getTangent( 0.25, new Vector3() ), + curve.getTangent( 0.5, new Vector3() ), + curve.getTangent( 0.75, new Vector3() ), + curve.getTangent( 1, new Vector3() ) ]; expectedTangents.forEach( function ( exp, i ) { @@ -170,11 +170,11 @@ export default QUnit.module( 'Extras', () => { ]; tangents = [ - curve.getTangentAt( 0 ), - curve.getTangentAt( 0.25 ), - curve.getTangentAt( 0.5 ), - curve.getTangentAt( 0.75 ), - curve.getTangentAt( 1 ) + curve.getTangentAt( 0, new Vector3() ), + curve.getTangentAt( 0.25, new Vector3() ), + curve.getTangentAt( 0.5, new Vector3() ), + curve.getTangentAt( 0.75, new Vector3() ), + curve.getTangentAt( 1, new Vector3() ) ]; expectedTangents.forEach( function ( exp, i ) {
true
Other
mrdoob
three.js
7630e7a649738cf28ad4fe5a9235da17d74de30c.json
Update unit tests.
test/unit/src/extras/curves/SplineCurve.tests.js
@@ -111,13 +111,15 @@ export default QUnit.module( 'Extras', () => { QUnit.test( "getPointAt", ( assert ) => { var curve = _curve; + var point = new Vector2(); - assert.ok( curve.getPointAt( 0 ).equals( curve.points[ 0 ] ), "PointAt 0.0 correct" ); - assert.ok( curve.getPointAt( 1 ).equals( curve.points[ 4 ] ), "PointAt 1.0 correct" ); + assert.ok( curve.getPointAt( 0, point ).equals( curve.points[ 0 ] ), "PointAt 0.0 correct" ); + assert.ok( curve.getPointAt( 1, point ).equals( curve.points[ 4 ] ), "PointAt 1.0 correct" ); - var pointAt = curve.getPointAt( 0.5 ); - assert.numEqual( pointAt.x, 0.0, "PointAt 0.5 x correct" ); - assert.numEqual( pointAt.y, 0.0, "PointAt 0.5 y correct" ); + curve.getPointAt( 0.5, point ); + + assert.numEqual( point.x, 0.0, "PointAt 0.5 x correct" ); + assert.numEqual( point.y, 0.0, "PointAt 0.5 y correct" ); } ); @@ -132,9 +134,9 @@ export default QUnit.module( 'Extras', () => { ]; var tangents = [ - curve.getTangent( 0 ), - curve.getTangent( 0.5 ), - curve.getTangent( 1 ) + curve.getTangent( 0, new Vector2() ), + curve.getTangent( 0.5, new Vector2() ), + curve.getTangent( 1, new Vector2() ) ]; tangents.forEach( function ( tangent, i ) {
true
Other
mrdoob
three.js
97b1228c876133b07ff14af3d23e62905200c5d6.json
Fix typo in Line3 docs
docs/api/en/math/Line3.html
@@ -98,7 +98,7 @@ <h3>[method:Boolean equals]( [param:Line3 line] )</h3> <p> [page:Line3 line] - [page:Line3] to compare with this one.<br /><br /> - Returns true if both line's [page:.start start] and [page:.end en] points are equal. + Returns true if both line's [page:.start start] and [page:.end end] points are equal. </p> <h3>[method:Vector3 getCenter]( [param:Vector3 target] )</h3>
false
Other
mrdoob
three.js
75c0df531ebbdcea928eab41e41bb8038d867438.json
Fix binary reading problem of PCD format PCD binary format could look like this: ``` # .PCD v0.7 - Point Cloud Data file format VERSION 0.7 FIELDS x y z _ intensity ring _ SIZE 4 4 4 1 4 2 1 TYPE F F F U F U U COUNT 1 1 1 4 1 1 10 WIDTH 22539 HEIGHT 1 VIEWPOINT 0 0 0 1 0 0 0 POINTS 22539 DATA binary ``` The correct field size is SIZE * COUNT.
examples/jsm/loaders/PCDLoader.js
@@ -210,7 +210,7 @@ PCDLoader.prototype = Object.assign( Object.create( Loader.prototype ), { } else { PCDheader.offset[ PCDheader.fields[ i ] ] = sizeSum; - sizeSum += PCDheader.size[ i ]; + sizeSum += PCDheader.size[ i ] * PCDheader.count[ i ]; }
false
Other
mrdoob
three.js
a5a5351d0125c708bd7a96b6b7f459c3934957ad.json
fix a spelling bug in LineSegmentsGeometry.js
examples/js/lines/LineSegmentsGeometry.js
@@ -133,7 +133,7 @@ THREE.LineSegmentsGeometry.prototype = Object.assign( Object.create( THREE.Insta }, - fromLineSegements: function ( lineSegments ) { + fromLineSegments: function ( lineSegments ) { var geometry = lineSegments.geometry;
false
Other
mrdoob
three.js
e5f6dbd238cbf098d8f44ccab1a282637a2c5290.json
Update valid far range
docs/api/en/cameras/OrthographicCamera.html
@@ -72,7 +72,7 @@ <h3>[property:Float far]</h3> <p> Camera frustum far plane. Default is *2000*.<br /><br /> - The valid range is between the current value of the [page:.near near] plane and infinity. + Must be greater than the current value of [page:.near near] plane. </p> <h3>[property:Float left]</h3>
true
Other
mrdoob
three.js
e5f6dbd238cbf098d8f44ccab1a282637a2c5290.json
Update valid far range
docs/api/en/cameras/PerspectiveCamera.html
@@ -63,7 +63,7 @@ <h3>[property:Float far]</h3> <p> Camera frustum far plane. Default is *2000*.<br /><br /> - The valid range is between the current value of the [page:.near near] plane and infinity. + Must be greater than the current value of [page:.near near] plane. </p> <h3>[property:Float filmGauge]</h3>
true
Other
mrdoob
three.js
e5f6dbd238cbf098d8f44ccab1a282637a2c5290.json
Update valid far range
docs/api/zh/cameras/OrthographicCamera.html
@@ -75,7 +75,7 @@ <h3>[property:Float bottom]</h3> <h3>[property:Float far]</h3> <p> 摄像机视锥体远端面,其默认值为*2000*。<br /><br /> - 其值的有效范围介于[page:.near near](摄像机视锥体近端面)和无穷大之间。 + Must be greater than the current value of [page:.near near] plane. </p>
true
Other
mrdoob
three.js
e5f6dbd238cbf098d8f44ccab1a282637a2c5290.json
Update valid far range
docs/api/zh/cameras/PerspectiveCamera.html
@@ -62,7 +62,7 @@ <h3>[property:Float far]</h3> <p> 摄像机的远端面,默认值是*2000*。 <br /><br /> - 其有效值范围是在当前摄像机[page:.near near] plane(近端面)的值到无穷远之间。 + Must be greater than the current value of [page:.near near] plane. </p> <h3>[property:Float filmGauge]</h3>
true
Other
mrdoob
three.js
1c27b835f30d4e1ea0692f8997d6fefc19f09f22.json
Specify tonemapping exposure
examples/webgl_loader_gltf.html
@@ -87,6 +87,7 @@ 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 );
true
Other
mrdoob
three.js
1c27b835f30d4e1ea0692f8997d6fefc19f09f22.json
Specify tonemapping exposure
examples/webgl_materials_variations_physical.html
@@ -159,6 +159,7 @@ renderer.outputEncoding = THREE.sRGBEncoding; renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; //
true
Other
mrdoob
three.js
1c27b835f30d4e1ea0692f8997d6fefc19f09f22.json
Specify tonemapping exposure
examples/webgl_materials_variations_standard.html
@@ -164,6 +164,7 @@ renderer.outputEncoding = THREE.sRGBEncoding; renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; //
true
Other
mrdoob
three.js
474fd78d229508fa56aa6f790fc408973935250d.json
use regex to test
src/extras/ImageUtils.js
@@ -13,7 +13,7 @@ const ImageUtils = { let canvas; var src = image.src; - if ( src[ 0 ] === "d" && src[ 1 ] === "a" && src[ 2 ] === "t" && src[ 3 ] === "a" && src[ 4 ] === ":" ) { + if ( /^data:/i.test( src ) ) { return image.src;
false
Other
mrdoob
three.js
99cced52d11222fa898f8740bbccef1ac7834651.json
add PointsMaterial node system
examples/jsm/renderers/webgpu/WebGPUNodeBuilder.js
@@ -47,7 +47,7 @@ class WebGPUNodeBuilder extends NodeBuilder { const material = this.material; - if ( material.isMeshBasicMaterial ) { + if ( material.isMeshBasicMaterial || material.isPointsMaterial ) { if ( material.colorNode !== undefined ) {
true
Other
mrdoob
three.js
99cced52d11222fa898f8740bbccef1ac7834651.json
add PointsMaterial node system
examples/jsm/renderers/webgpu/WebGPURenderPipelines.js
@@ -797,6 +797,7 @@ class WebGPURenderPipelines { const ShaderLib = { mesh_basic: { vertexShader: `#version 450 + layout(location = 0) in vec3 position; layout(location = 1) in vec2 uv; @@ -818,6 +819,7 @@ const ShaderLib = { gl_Position = cameraUniforms.projectionMatrix * modelUniforms.modelViewMatrix * vec4( position, 1.0 ); }`, fragmentShader: `#version 450 + layout(set = 0, binding = 2) uniform OpacityUniforms { float opacity; } opacityUniforms; @@ -869,10 +871,22 @@ const ShaderLib = { }`, fragmentShader: `#version 450 + #ifdef NODE_UNIFORMS + layout(set = 0, binding = 2) uniform NodeUniforms { + NODE_UNIFORMS + } nodeUniforms; + #endif + layout(location = 0) out vec4 outColor; void main() { - outColor = vec4( 1.0, 0.0, 0.0, 1.0 ); + + outColor = vec4( 1.0, 1.0, 1.0, 1.0 ); + + #ifdef NODE_COLOR + outColor.rgb = NODE_COLOR; + #endif + }` }, line_basic: {
true
Other
mrdoob
three.js
99cced52d11222fa898f8740bbccef1ac7834651.json
add PointsMaterial node system
examples/webgpu_sandbox.html
@@ -95,6 +95,8 @@ const geometryPoints = new THREE.BufferGeometry().setFromPoints( points ); const materialPoints = new THREE.PointsMaterial(); + materialPoints.colorNode = new Vector3Node( new THREE.Vector3( 0, .6, 1 ) ); + const pointCloud = new THREE.Points( geometryPoints, materialPoints ); pointCloud.position.set( 2, - 1, 0 ); scene.add( pointCloud );
true
Other
mrdoob
three.js
535a44942e9f2bfef793e2ac55d26773bccd7709.json
move nodes to webgpu_sandbox example
examples/webgpu_sandbox.html
@@ -19,6 +19,10 @@ import WebGPURenderer from './jsm/renderers/webgpu/WebGPURenderer.js'; import WebGPU from './jsm/renderers/webgpu/WebGPU.js'; + import FloatNode from './jsm/renderers/nodes/inputs/FloatNode.js'; + import Vector3Node from './jsm/renderers/nodes/inputs/Vector3Node.js'; + import OperatorNode from './jsm/renderers/nodes/math/OperatorNode.js'; + let camera, scene, renderer; let box; @@ -49,6 +53,10 @@ const geometryBox = new THREE.BoxBufferGeometry(); const materialBox = new THREE.MeshBasicMaterial( { map: texture } ); + materialBox.colorNode = new OperatorNode( '+', new FloatNode( .5 ).setConst( true ), new Vector3Node( new THREE.Vector3( 0, 0, 1 ) ) ); + materialBox.opacityNode = new FloatNode( .5 ); + materialBox.transparent = true; + box = new THREE.Mesh( geometryBox, materialBox ); box.position.set( 0, 1, 0 ); scene.add( box );
true
Other
mrdoob
three.js
535a44942e9f2bfef793e2ac55d26773bccd7709.json
move nodes to webgpu_sandbox example
examples/webgpu_sandbox_nodes.html
@@ -1,185 +0,0 @@ -<html lang="en"> - <head> - <title>WebGPU Sandbox</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> WebGPU - sandbox<br/>(Chrome Canary with flag: --enable-unsafe-webgpu) - </div> - - <script type="module"> - - import * as THREE from '../build/three.module.js'; - - import { DDSLoader } from './jsm/loaders/DDSLoader.js'; - - import WebGPURenderer from './jsm/renderers/webgpu/WebGPURenderer.js'; - import WebGPU from './jsm/renderers/webgpu/WebGPU.js'; - - import FloatNode from './jsm/renderers/nodes/inputs/FloatNode.js'; - import Vector3Node from './jsm/renderers/nodes/inputs/Vector3Node.js'; - import OperatorNode from './jsm/renderers/nodes/math/OperatorNode.js'; - - let camera, scene, renderer; - - let box; - - init().then( animate ).catch( error ); - - async function init() { - - if ( WebGPU.isAvailable() === false ) { - - document.body.appendChild( WebGPU.getErrorMessage() ); - - throw 'No WebGPU support'; - - } - - camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.1, 10 ); - camera.position.z = 4; - - scene = new THREE.Scene(); - scene.background = new THREE.Color( 0x222222 ); - - // textured mesh - - const textureLoader = new THREE.TextureLoader(); - const texture = textureLoader.load( './textures/uv_grid_opengl.jpg' ); - - const geometryBox = new THREE.BoxBufferGeometry(); - const materialBox = new THREE.MeshBasicMaterial( { map: texture } ); - - //materialBox.color = new OperatorNode( '+', new Vector3Node( new THREE.Vector3( 0, .6, 0 ) ), new Vector3Node( new THREE.Vector3( 0, 0, 1 ) ) ); - materialBox.color = new OperatorNode( '+', new FloatNode( .5 ), new Vector3Node( new THREE.Vector3( 0, 0, 1 ) ) ); - //materialBox.color = new Vector3Node( new THREE.Vector3( 0, 0, 1 ) ); - - box = new THREE.Mesh( geometryBox, materialBox ); - box.position.set( 0, 1, 0 ); - scene.add( box ); - - // data texture - - const geometryPlane = new THREE.PlaneBufferGeometry(); - const materialPlane = new THREE.MeshBasicMaterial( { map: createDataTexture(), transparent: true, opacity: 0.5 } ); - - const plane = new THREE.Mesh( geometryPlane, materialPlane ); - plane.position.set( 0, - 1, 0 ); - //scene.add( plane ); - - // compressed texture - - const ddsLoader = new DDSLoader(); - const dxt5Texture = ddsLoader.load( './textures/compressed/explosion_dxt5_mip.dds' ); - - const materialCompressed = new THREE.MeshBasicMaterial( { map: dxt5Texture, transparent: true } ); - - const boxCompressed = new THREE.Mesh( geometryBox, materialCompressed ); - boxCompressed.position.set( - 2, 1, 0 ); - //scene.add( boxCompressed ); - - // points - - const points = []; - - for ( let i = 0; i < 1000; i ++ ) { - - const point = new THREE.Vector3().random().subScalar( 0.5 ); - points.push( point ); - - } - - const geometryPoints = new THREE.BufferGeometry().setFromPoints( points ); - const materialPoints = new THREE.PointsMaterial(); - - const pointCloud = new THREE.Points( geometryPoints, materialPoints ); - pointCloud.position.set( 2, - 1, 0 ); - //scene.add( pointCloud ); - - // lines - - const geometryLine = new THREE.BufferGeometry().setFromPoints( [ - new THREE.Vector3( - 0.5, - 0.5, 0 ), - new THREE.Vector3( 0.5, - 0.5, 0 ), - new THREE.Vector3( 0.5, 0.5, 0 ), - new THREE.Vector3( - 0.5, 0.5, 0 ) - ] ); - const materialLine = new THREE.LineBasicMaterial(); - const line = new THREE.Line( geometryLine, materialLine ); - line.position.set( 2, 1, 0 ); - //scene.add( line ); - - // - - renderer = new WebGPURenderer( { extensions: [ 'texture-compression-bc' ] } ); - renderer.setPixelRatio( window.devicePixelRatio ); - renderer.setSize( window.innerWidth, window.innerHeight ); - document.body.appendChild( renderer.domElement ); - - window.addEventListener( 'resize', onWindowResize, false ); - - return renderer.init(); - - } - - function onWindowResize() { - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize( window.innerWidth, window.innerHeight ); - - } - - function animate() { - - requestAnimationFrame( animate ); - - box.rotation.x += 0.01; - box.rotation.y += 0.02; - - renderer.render( scene, camera ); - - } - - function createDataTexture() { - - const color = new THREE.Color( 0xff0000 ); - - const width = 512; - const height = 512; - - const size = width * height; - const data = new Uint8Array( 4 * size ); - - const r = Math.floor( color.r * 255 ); - const g = Math.floor( color.g * 255 ); - const b = Math.floor( color.b * 255 ); - - for ( let i = 0; i < size; i ++ ) { - - const stride = i * 4; - - data[ stride ] = r; - data[ stride + 1 ] = g; - data[ stride + 2 ] = b; - data[ stride + 3 ] = 255; - - } - - return new THREE.DataTexture( data, width, height, THREE.RGBAFormat ); - - } - - function error( error ) { - - console.error( error ); - - } - - </script> - </body> -</html>
true
Other
mrdoob
three.js
806eb90507bca48a22c86fd12deae7a05c5936d4.json
add opacityNode and rename to colorNode property
examples/jsm/renderers/webgpu/WebGPUNodeBuilder.js
@@ -49,9 +49,15 @@ class WebGPUNodeBuilder extends NodeBuilder { if ( material.isMeshBasicMaterial ) { - if ( material.color.isNode ) { + if ( material.colorNode !== undefined ) { - this.addSlot( 'fragment', new NodeSlot( material.color, 'COLOR', 'vec3' ) ); + this.addSlot( 'fragment', new NodeSlot( material.colorNode, 'COLOR', 'vec3' ) ); + + } + + if ( material.opacityNode !== undefined ) { + + this.addSlot( 'fragment', new NodeSlot( material.opacityNode, 'OPACITY', 'float' ) ); }
true
Other
mrdoob
three.js
806eb90507bca48a22c86fd12deae7a05c5936d4.json
add opacityNode and rename to colorNode property
examples/jsm/renderers/webgpu/WebGPURenderPipelines.js
@@ -842,6 +842,10 @@ const ShaderLib = { outColor.rgb = NODE_COLOR; #endif + #ifdef NODE_OPACITY + outColor.a *= NODE_OPACITY; + #endif + outColor.a *= opacityUniforms.opacity; }` },
true
Other
mrdoob
three.js
71a1a013df2bbce56f44cb06f6fd9ba25c4ec532.json
Fix "color" property type on LineBasicMaterial
src/materials/LineBasicMaterial.d.ts
@@ -21,7 +21,7 @@ export class LineBasicMaterial extends Material { /** * @default 0xffffff */ - color: Color | string | number; + color: Color; /** * @default 1
false
Other
mrdoob
three.js
87e22024d85b81297c7a5f0b9482b2b36401ea9d.json
Fix TSDoc for CircleGeometry
src/geometries/CircleGeometry.d.ts
@@ -6,7 +6,7 @@ export class CircleGeometry extends Geometry { * @param [radius=1] * @param [segments=8] * @param [thetaStart=0] - * @param [widthSegments=Math.PI * 2] + * @param [thetaLength=Math.PI * 2] */ constructor( radius?: number,
false
Other
mrdoob
three.js
5fb40fd5e362fd81c4b427718343127f7c0d0c5a.json
Fix TSDoc for CircleBufferGeometry
src/geometries/CircleBufferGeometry.d.ts
@@ -6,7 +6,7 @@ export class CircleBufferGeometry extends BufferGeometry { * @param [radius=1] * @param [segments=8] * @param [thetaStart=0] - * @param [widthSegments=Math.PI * 2] + * @param [thetaLength=Math.PI * 2] */ constructor( radius?: number,
false
Other
mrdoob
three.js
6e6cb3bb651740ff87df93d1190110c169cfdd59.json
Fix typo in ConeGeometry (again)
src/geometries/ConeGeometry.d.ts
@@ -5,7 +5,7 @@ export class ConeGeometry extends CylinderGeometry { /** * @param [radius=1] — Radius of the cone base. * @param [height=1] — Height of the cone. - * @param [radiusSegments=8] — Number of segmented faces around the circumference of the cone. + * @param [radialSegments=8] — Number of segmented faces around the circumference of the cone. * @param [heightSegments=1] — Number of rows of faces along the height of the cone. * @param [openEnded=false] — A Boolean indicating whether the base of the cone is open or capped. * @param [thetaStart=0] @@ -14,8 +14,8 @@ export class ConeGeometry extends CylinderGeometry { constructor( radius?: number, height?: number, - radialSegment?: number, - heightSegment?: number, + radialSegments?: number, + heightSegments?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number
false
Other
mrdoob
three.js
7fac5aa010769750c040ae8ced46bb9fb0ab418e.json
Fix typo in ConeBufferGeometry (again)
src/geometries/ConeBufferGeometry.d.ts
@@ -5,7 +5,7 @@ export class ConeBufferGeometry extends CylinderBufferGeometry { /** * @param [radius=1] — Radius of the cone base. * @param [height=1] — Height of the cone. - * @param [radialSegment=8] — Number of segmented faces around the circumference of the cone. + * @param [radialSegments=8] — Number of segmented faces around the circumference of the cone. * @param [heightSegments=1] — Number of rows of faces along the height of the cone. * @param [openEnded=false] — A Boolean indicating whether the base of the cone is open or capped. * @param [thetaStart=0] @@ -14,8 +14,8 @@ export class ConeBufferGeometry extends CylinderBufferGeometry { constructor( radius?: number, height?: number, - radialSegment?: number, - heightSegment?: number, + radialSegments?: number, + heightSegments?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number
false
Other
mrdoob
three.js
da17ebe2f3ed2c29bef33a438913fe637c98a675.json
Fix typo in ConeBufferGeometry
src/geometries/ConeBufferGeometry.d.ts
@@ -5,7 +5,7 @@ export class ConeBufferGeometry extends CylinderBufferGeometry { /** * @param [radius=1] — Radius of the cone base. * @param [height=1] — Height of the cone. - * @param [radiusSegments=8] — Number of segmented faces around the circumference of the cone. + * @param [radialSegment=8] — Number of segmented faces around the circumference of the cone. * @param [heightSegments=1] — Number of rows of faces along the height of the cone. * @param [openEnded=false] — A Boolean indicating whether the base of the cone is open or capped. * @param [thetaStart=0]
false
Other
mrdoob
three.js
5e2fe49cec5606e6138a1a59e022d5b2c0e32097.json
Fix typo in CylinderGeometry
src/geometries/CylinderGeometry.d.ts
@@ -6,7 +6,7 @@ export class CylinderGeometry extends Geometry { * @param [radiusTop=1] — Radius of the cylinder at the top. * @param [radiusBottom=1] — Radius of the cylinder at the bottom. * @param [height=1] — Height of the cylinder. - * @param [radiusSegments=8] — Number of segmented faces around the circumference of the cylinder. + * @param [radialSegments=8] — Number of segmented faces around the circumference of the cylinder. * @param [heightSegments=1] — Number of rows of faces along the height of the cylinder. * @param [openEnded=false] - A Boolean indicating whether or not to cap the ends of the cylinder. * @param [thetaStart=0] @@ -16,7 +16,7 @@ export class CylinderGeometry extends Geometry { radiusTop?: number, radiusBottom?: number, height?: number, - radiusSegments?: number, + radialSegments?: number, heightSegments?: number, openEnded?: boolean, thetaStart?: number,
false
Other
mrdoob
three.js
9d521b63ee2ed91f1fd186d999d7efb278aa25d9.json
Fix TSDoc for CylinderBufferGeometry
src/geometries/CylinderBufferGeometry.d.ts
@@ -6,7 +6,7 @@ export class CylinderBufferGeometry extends BufferGeometry { * @param [radiusTop=1] — Radius of the cylinder at the top. * @param [radiusBottom=1] — Radius of the cylinder at the bottom. * @param [height=1] — Height of the cylinder. - * @param [radiusSegments=8] — Number of segmented faces around the circumference of the cylinder. + * @param [radialSegments=8] — Number of segmented faces around the circumference of the cylinder. * @param [heightSegments=1] — Number of rows of faces along the height of the cylinder. * @param [openEnded=false] - A Boolean indicating whether or not to cap the ends of the cylinder. * @param [thetaStart=0]
false
Other
mrdoob
three.js
43fe1848cb4fcbf75a252bf77588c2bcf2a0577b.json
Fix TSDoc for ConeBufferGeometry
src/geometries/ConeBufferGeometry.d.ts
@@ -3,14 +3,13 @@ import { CylinderBufferGeometry } from './CylinderBufferGeometry'; export class ConeBufferGeometry extends CylinderBufferGeometry { /** - * @param [radiusTop=0] — Radius of the cylinder at the top. - * @param [radiusBottom=1] — Radius of the cylinder at the bottom. - * @param [height=1] — Height of the cylinder. - * @param [radiusSegments=8] — Number of segmented faces around the circumference of the cylinder. - * @param [heightSegments=1] — Number of rows of faces along the height of the cylinder. - * @param [openEnded=false] - A Boolean indicating whether or not to cap the ends of the cylinder. + * @param [radius=1] — Radius of the cone base. + * @param [height=1] — Height of the cone. + * @param [radiusSegments=8] — Number of segmented faces around the circumference of the cone. + * @param [heightSegments=1] — Number of rows of faces along the height of the cone. + * @param [openEnded=false] — A Boolean indicating whether the base of the cone is open or capped. * @param [thetaStart=0] - * @param [widthSegments=Math.PI * 2] + * @param [thetaLength=Math.PI * 2] */ constructor( radius?: number,
false
Other
mrdoob
three.js
59c7df7268da43b7bbe8a54fabfb7d46cff67653.json
Fix TSDoc for CylinderGeometry
src/geometries/CylinderGeometry.d.ts
@@ -10,7 +10,7 @@ export class CylinderGeometry extends Geometry { * @param [heightSegments=1] — Number of rows of faces along the height of the cylinder. * @param [openEnded=false] - A Boolean indicating whether or not to cap the ends of the cylinder. * @param [thetaStart=0] - * @param [widthSegments=Math.PI * 2] + * @param [thetaLength=Math.PI * 2] */ constructor( radiusTop?: number,
false
Other
mrdoob
three.js
0a1c4ec2e92a05af817815f4d1fcfd2587afe8fb.json
Fix ConeGeometry TSDoc
src/geometries/ConeGeometry.d.ts
@@ -3,14 +3,13 @@ import { CylinderGeometry } from './CylinderGeometry'; export class ConeGeometry extends CylinderGeometry { /** - * @param [radiusTop=0] — Radius of the cylinder at the top. - * @param [radiusBottom=1] — Radius of the cylinder at the bottom. - * @param [height=1] — Height of the cylinder. - * @param [radiusSegments=8] — Number of segmented faces around the circumference of the cylinder. - * @param [heightSegments=1] — Number of rows of faces along the height of the cylinder. - * @param [openEnded=false] - A Boolean indicating whether or not to cap the ends of the cylinder. + * @param [radius=1] — Radius of the cone base. + * @param [height=1] — Height of the cone. + * @param [radiusSegments=8] — Number of segmented faces around the circumference of the cone. + * @param [heightSegments=1] — Number of rows of faces along the height of the cone. + * @param [openEnded=false] — A Boolean indicating whether the base of the cone is open or capped. * @param [thetaStart=0] - * @param [widthSegments=Math.PI * 2] + * @param [thetaLength=Math.PI * 2] */ constructor( radius?: number,
false
Other
mrdoob
three.js
455aea186f4c6f85185774b3c4d40b1e32a3598a.json
fix param comment for thetaLength
src/geometries/CylinderBufferGeometry.d.ts
@@ -10,7 +10,7 @@ export class CylinderBufferGeometry extends BufferGeometry { * @param [heightSegments=1] — Number of rows of faces along the height of the cylinder. * @param [openEnded=false] - A Boolean indicating whether or not to cap the ends of the cylinder. * @param [thetaStart=0] - * @param [widthSegments=Math.PI * 2] + * @param [thetaLength=Math.PI * 2] */ constructor( radiusTop?: number,
false
Other
mrdoob
three.js
e89611f6b056d13b0722811e1934f6af43785c12.json
Remove time variable
examples/webgl_shadow_contact.html
@@ -261,7 +261,7 @@ } - function animate( time ) { + function animate( ) { requestAnimationFrame( animate );
false
Other
mrdoob
three.js
1df61f9c7723dd76841ccf865b0d96574881c7eb.json
Add plane to contact shadow example
examples/webgl_shadow_contact.html
@@ -37,15 +37,21 @@ const CAMERA_HEIGHT = 0.3; var state = { - blur: 3.5, - darkness: 1, - opacity: 1, + shadow: { + blur: 3.5, + darkness: 1, + opacity: 1, + }, + plane: { + color: '#ffffff', + opacity: 1, + }, showWireframe: false, }; var shadowGroup, renderTarget, renderTargetBlur, shadowCamera, cameraHelper, depthMaterial, horizontalBlurMaterial, verticalBlurMaterial; - var planeGeometry, planeMaterial, plane, blurPlane; + var plane, blurPlane, fillPlane; init(); animate(); @@ -104,13 +110,13 @@ // make a plane and make it face up - planeGeometry = new THREE.PlaneBufferGeometry( PLANE_WIDTH, PLANE_HEIGHT ).rotateX( Math.PI / 2 ); - planeMaterial = new THREE.MeshBasicMaterial( { + var planeGeometry = new THREE.PlaneBufferGeometry( PLANE_WIDTH, PLANE_HEIGHT ).rotateX( Math.PI / 2 ); + var material = new THREE.MeshBasicMaterial( { map: renderTarget.texture, - opacity: state.opacity, + opacity: state.shadow.opacity, transparent: true, } ); - plane = new THREE.Mesh( planeGeometry, planeMaterial ); + plane = new THREE.Mesh( planeGeometry, material ); shadowGroup.add( plane ); // the y from the texture is flipped! @@ -121,6 +127,17 @@ blurPlane.visible = false; shadowGroup.add( blurPlane ); + // the plane with the color of the ground + var material = new THREE.MeshBasicMaterial( { + color: state.plane.color, + opacity: state.plane.opacity, + transparent: true, + } ); + fillPlane = new THREE.Mesh( planeGeometry, material ); + fillPlane.rotateX( Math.PI ); + fillPlane.position.y -= 0.00001; + shadowGroup.add( fillPlane ); + // the camera to render the depth material from shadowCamera = new THREE.OrthographicCamera( - PLANE_WIDTH / 2, PLANE_WIDTH / 2, PLANE_HEIGHT / 2, - PLANE_HEIGHT / 2, 0, CAMERA_HEIGHT ); shadowCamera.rotation.x = Math.PI / 2; // get the camera to look up @@ -130,12 +147,11 @@ // like MeshDepthMaterial, but goes from black to transparent depthMaterial = new THREE.MeshDepthMaterial(); - depthMaterial.userData.darkness = { value: state.darkness }; + depthMaterial.userData.darkness = { value: state.shadow.darkness }; depthMaterial.onBeforeCompile = function ( shader ) { shader.uniforms.darkness = depthMaterial.userData.darkness; shader.fragmentShader = ` - #define DEPTH_PACKING 3200 uniform float darkness; ${shader.fragmentShader.replace( 'gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );', @@ -156,19 +172,34 @@ // gui = new GUI(); + var shadowFolder = gui.addFolder( 'shadow' ); + shadowFolder.open(); + var planeFolder = gui.addFolder( 'plane' ); + planeFolder.open(); + + + shadowFolder.add( state.shadow, 'blur', 0, 15, 0.1 ); + shadowFolder.add( state.shadow, 'darkness', 1, 5, 0.1 ).onChange( function () { + depthMaterial.userData.darkness.value = state.shadow.darkness; - gui.add( state, 'blur', 0, 15, 0.1 ); - gui.add( state, 'darkness', 1, 5, 0.1 ).onChange( function () { + } ); + shadowFolder.add( state.shadow, 'opacity', 0, 1, 0.01 ).onChange( function () { - depthMaterial.userData.darkness.value = state.darkness; + plane.material.opacity = state.shadow.opacity; } ); - gui.add( state, 'opacity', 0, 1, 0.01 ).onChange( function () { + planeFolder.addColor( state.plane, 'color' ).onChange( function () { - planeMaterial.opacity = state.opacity; + fillPlane.material.color = new THREE.Color( state.plane.color ); } ); + planeFolder.add( state.plane, 'opacity', 0, 1, 0.01 ).onChange( function () { + + fillPlane.material.opacity = state.plane.opacity; + + } ); + gui.add( state, 'showWireframe', true ).onChange( function () { if ( state.showWireframe ) { @@ -245,10 +276,11 @@ // - // remove the background and force the depthMaterial to everything + // remove the background var initialBackground = scene.background; scene.background = null; + // force the depthMaterial to everything cameraHelper.visible = false; scene.overrideMaterial = depthMaterial; @@ -260,11 +292,11 @@ scene.overrideMaterial = null; cameraHelper.visible = true; - blurShadow( state.blur ); + blurShadow( state.shadow.blur ); // a second pass to reduce the artifacts // (0.4 is the minimum blur amout so that the artifacts are gone) - blurShadow( state.blur * 0.4 ); + blurShadow( state.shadow.blur * 0.4 ); // reset and render the normal scene renderer.setRenderTarget( null );
false
Other
mrdoob
three.js
2508e47271b1c0bd3fa7cc980b87bf0c1d027363.json
Update stats in reder
examples/webgl_shadow_contact.html
@@ -270,6 +270,7 @@ scene.background = initialBackground; renderer.render( scene, camera ); + stats.update(); }
false
Other
mrdoob
three.js
39d5365adbd1763057201cfe879d8a68ce417323.json
reverse changes in core files
src/renderers/shaders/ShaderChunk.d.ts
@@ -43,9 +43,6 @@ export let ShaderChunk: { equirect_vert: string; fog_fragment: string; fog_pars_fragment: string; - geometry_decode_pars_vertex: string; - geometry_decode_normal_vertex: string; - geometry_decode_vertex: string; linedashed_frag: string; linedashed_vert: string; lightmap_fragment: string;
true
Other
mrdoob
three.js
39d5365adbd1763057201cfe879d8a68ce417323.json
reverse changes in core files
src/renderers/shaders/ShaderChunk.js
@@ -33,9 +33,6 @@ import fog_vertex from './ShaderChunk/fog_vertex.glsl.js'; import fog_pars_vertex from './ShaderChunk/fog_pars_vertex.glsl.js'; import fog_fragment from './ShaderChunk/fog_fragment.glsl.js'; import fog_pars_fragment from './ShaderChunk/fog_pars_fragment.glsl.js'; -import geometry_decode_pars_vertex from './ShaderChunk/geometry_decode_pars_vertex.glsl'; -import geometry_decode_normal_vertex from './ShaderChunk/geometry_decode_normal_vertex.glsl'; -import geometry_decode_vertex from './ShaderChunk/geometry_decode_vertex.glsl'; import gradientmap_pars_fragment from './ShaderChunk/gradientmap_pars_fragment.glsl.js'; import lightmap_fragment from './ShaderChunk/lightmap_fragment.glsl.js'; import lightmap_pars_fragment from './ShaderChunk/lightmap_pars_fragment.glsl.js'; @@ -167,9 +164,6 @@ export var ShaderChunk = { fog_pars_vertex: fog_pars_vertex, fog_fragment: fog_fragment, fog_pars_fragment: fog_pars_fragment, - geometry_decode_pars_vertex: geometry_decode_pars_vertex, - geometry_decode_normal_vertex: geometry_decode_normal_vertex, - geometry_decode_vertex: geometry_decode_vertex, gradientmap_pars_fragment: gradientmap_pars_fragment, lightmap_fragment: lightmap_fragment, lightmap_pars_fragment: lightmap_pars_fragment,
true
Other
mrdoob
three.js
39d5365adbd1763057201cfe879d8a68ce417323.json
reverse changes in core files
src/renderers/shaders/ShaderChunk/geometry_decode_normal_vertex.glsl.js
@@ -1,5 +0,0 @@ -export default /* glsl */` -#ifdef USE_PACKED_NORMAL - objectNormal = decodeNormal(objectNormal); -#endif -`;
true
Other
mrdoob
three.js
39d5365adbd1763057201cfe879d8a68ce417323.json
reverse changes in core files
src/renderers/shaders/ShaderChunk/geometry_decode_pars_vertex.glsl.js
@@ -1,64 +0,0 @@ -export default /* glsl */` -#ifdef USE_PACKED_NORMAL -#if USE_PACKED_NORMAL == 0 - vec3 decodeNormal(vec3 packedNormal) - { - float x = packedNormal.x * 2.0 - 1.0; - float y = packedNormal.y * 2.0 - 1.0; - vec2 scth = vec2(sin(x * PI), cos(x * PI)); - vec2 scphi = vec2(sqrt(1.0 - y * y), y); - return normalize( vec3(scth.y * scphi.x, scth.x * scphi.x, scphi.y) ); - } -#endif - -#if USE_PACKED_NORMAL == 1 - vec3 decodeNormal(vec3 packedNormal) - { - vec3 v = vec3(packedNormal.xy, 1.0 - abs(packedNormal.x) - abs(packedNormal.y)); - if (v.z < 0.0) - { - v.xy = (1.0 - abs(v.yx)) * vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0); - } - return normalize(v); - } -#endif - -#if USE_PACKED_NORMAL == 2 - vec3 decodeNormal(vec3 packedNormal) - { - vec3 v = (packedNormal * 2.0) - 1.0; - return normalize(v); - } -#endif -#endif - -#ifdef USE_PACKED_POSITION -#if USE_PACKED_POSITION == 0 - uniform mat4 quantizeMatPos; -#endif -#endif - -#ifdef USE_PACKED_UV -#if USE_PACKED_UV == 1 - uniform mat3 quantizeMatUV; -#endif -#endif - -#ifdef USE_PACKED_UV -#if USE_PACKED_UV == 0 - vec2 decodeUV(vec2 packedUV) - { - vec2 uv = (packedUV * 2.0) - 1.0; - return uv; - } -#endif - -#if USE_PACKED_UV == 1 - vec2 decodeUV(vec2 packedUV) - { - vec2 uv = ( vec3(packedUV, 1.0) * quantizeMatUV ).xy; - return uv; - } -#endif -#endif -`;
true
Other
mrdoob
three.js
39d5365adbd1763057201cfe879d8a68ce417323.json
reverse changes in core files
src/renderers/shaders/ShaderChunk/geometry_decode_vertex.glsl.js
@@ -1,13 +0,0 @@ -export default /* glsl */` -#ifdef USE_PACKED_POSITION - #if USE_PACKED_POSITION == 0 - transformed = ( vec4(transformed, 1.0) * quantizeMatPos ).xyz; - #endif -#endif - -#ifdef USE_UV - #ifdef USE_PACKED_UV - vUv = decodeUV(vUv); - #endif -#endif -`;
true
Other
mrdoob
three.js
32f3fe47c4d8265fd49dea4a2b43ec92699082c6.json
Fix CSM shader
examples/jsm/csm/Shader.js
@@ -79,38 +79,46 @@ IncidentLight directLight; #endif #if defined( USE_SHADOWMAP ) && defined( CSM_FADE ) + vec2 cascade; + float cascadeCenter; + float closestEdge; + float margin; + float csmx; + float csmy; + + #unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight ); // NOTE: Depth gets larger away from the camera. // cascade.x is closer, cascade.y is further - vec2 cascade = CSM_cascades[ i ]; - float cascadeCenter = ( cascade.x + cascade.y ) / 2.0; - float closestEdge = linearDepth < cascadeCenter ? cascade.x : cascade.y; - float margin = 0.25 * pow( closestEdge, 2.0 ); - float csmx = cascade.x - margin / 2.0; - float csmy = cascade.y + margin / 2.0; - if( i < NUM_DIR_LIGHT_SHADOWS && linearDepth >= csmx && ( linearDepth < csmy || i == CSM_CASCADES - 1 ) ) { + cascade = CSM_cascades[ i ]; + cascadeCenter = ( cascade.x + cascade.y ) / 2.0; + closestEdge = linearDepth < cascadeCenter ? cascade.x : cascade.y; + margin = 0.25 * pow( closestEdge, 2.0 ); + csmx = cascade.x - margin / 2.0; + csmy = cascade.y + margin / 2.0; + if( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS && linearDepth >= csmx && ( linearDepth < csmy || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 ) ) { float dist = min( linearDepth - csmx, csmy - linearDepth ); float ratio = clamp( dist / margin, 0.0, 1.0 ); - if( i < NUM_DIR_LIGHT_SHADOWS ) { + if( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) { vec3 prevColor = directLight.color; directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - bool shouldFadeLastCascade = i == CSM_CASCADES - 1 && linearDepth > cascadeCenter; + bool shouldFadeLastCascade = UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth > cascadeCenter; directLight.color = mix( prevColor, directLight.color, shouldFadeLastCascade ? ratio : 1.0 ); } ReflectedLight prevLight = reflectedLight; RE_Direct( directLight, geometry, material, reflectedLight ); - bool shouldBlend = i != CSM_CASCADES - 1 || i == CSM_CASCADES - 1 && linearDepth < cascadeCenter; + bool shouldBlend = UNROLLED_LOOP_INDEX != CSM_CASCADES - 1 || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth < cascadeCenter; float blendRatio = shouldBlend ? ratio : 1.0; reflectedLight.directDiffuse = mix( prevLight.directDiffuse, reflectedLight.directDiffuse, blendRatio ); @@ -121,6 +129,7 @@ IncidentLight directLight; } } + #unroll_loop_end #else #pragma unroll_loop
false
Other
mrdoob
three.js
3beb92a363b4ba05fbeb4bf9d686487e437d8aac.json
Remove need to pass camera matrix world to update
examples/jsm/csm/CSM.js
@@ -23,7 +23,6 @@ const _cameraToLightMatrix = new Matrix4(); const _lightSpaceFrustum = new Frustum(); const _frustum = new Frustum(); const _center = new Vector3(); -const _size = new Vector3(); const _bbox = new Box3(); const _uniformArray = []; const _logArray = []; @@ -207,8 +206,9 @@ export default class CSM { } - update( cameraMatrix ) { + update() { + const camera = this.camera; const frustums = this.frustums; for ( let i = 0; i < frustums.length; i ++ ) { @@ -217,7 +217,7 @@ export default class CSM { const texelWidth = ( shadowCam.right - shadowCam.left ) / this.shadowMapSize; const texelHeight = ( shadowCam.top - shadowCam.bottom ) / this.shadowMapSize; light.shadow.camera.updateMatrixWorld( true ); - _cameraToLightMatrix.multiplyMatrices( light.shadow.camera.matrixWorldInverse, cameraMatrix ); + _cameraToLightMatrix.multiplyMatrices( light.shadow.camera.matrixWorldInverse, camera.matrixWorld ); frustums[ i ].toSpace( _cameraToLightMatrix, _lightSpaceFrustum ); const nearVerts = _lightSpaceFrustum.vertices.near;
true
Other
mrdoob
three.js
3beb92a363b4ba05fbeb4bf9d686487e437d8aac.json
Remove need to pass camera matrix world to update
examples/webgl_shadowmap_csm.html
@@ -224,7 +224,7 @@ requestAnimationFrame( animate ); camera.updateMatrixWorld(); - csm.update( camera.matrixWorld ); + csm.update(); controls.update(); if ( params.orthographic ) {
true
Other
mrdoob
three.js
159da0de8e515c935d44bea5921fb1c18180776b.json
Use alert to make users more aware of errors
editor/js/Loader.js
@@ -232,7 +232,7 @@ var Loader = function ( editor ) { if ( isGLTF1( contents ) ) { - console.error( 'Import of glTF asset not possible. Only versions >= 2.0 are supported. Please try to upgrade the file to glTF 2.0 using glTF-Pipeline.' ); + alert( 'Import of glTF asset not possible. Only versions >= 2.0 are supported. Please try to upgrade the file to glTF 2.0 using glTF-Pipeline.' ); } else { @@ -303,7 +303,7 @@ var Loader = function ( editor ) { } catch ( error ) { - console.error( error ); + alert( error ); return; }
false
Other
mrdoob
three.js
a921b43d7387b617d3682c112a86c1d5743a59ca.json
Add documentation for DataTexture2DArray
docs/api/en/textures/DataTexture2DArray.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8" /> + <base href="../../../" /> + <script src="list.js"></script> + <script src="page.js"></script> + <link type="text/css" rel="stylesheet" href="page.css" /> + </head> + <body> + [page:Texture] &rarr; + + <h1>[name]</h1> + + <p class="desc">Creates an array of textures directly from raw data, width and height and depth.</p> + + + <h2>Constructor</h2> + + <h3>[name]( data, width, height, depth )</h3> + <p> + The data argument must be an [link:https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView ArrayBufferView]. + The properties inherited from [page:Texture] are the default, except magFilter and minFilter default to THREE.NearestFilter. The properties flipY and generateMipmaps are intially set to false. + </p> + <p> + The interpretation of the data depends on type and format: + If the type is THREE.UnsignedByteType, a Uint8Array will be useful for addressing the texel data. + If the format is THREE.RGBAFormat, data needs four values for one texel; Red, Green, Blue and Alpha (typically the opacity). Similarly, THREE.RGBFormat specifies a format where only three values are used for each texel.<br /> + + For the packed types, THREE.UnsignedShort4444Type, THREE.UnsignedShort5551Type or THREE.UnsignedShort565Type, all color components of one texel can be addressed as bitfields within an integer element of a Uint16Array.<br /> + + In order to use the types THREE.FloatType and THREE.HalfFloatType, the WebGL implementation must support the respective extensions OES_texture_float and OES_texture_half_float. In order to use THREE.LinearFilter for component-wise, bilinear interpolation of the texels based on these types, the WebGL extensions OES_texture_float_linear or OES_texture_half_float_linear must also be present. + </p> + + <h2>Code Example</h2> + + <p>This creates a [name] where each texture has a different color.</p> + + <code> + // create a buffer with color data + + var size = width * height; + var data = new Uint8Array( 3 * size * depth ); + + + for ( var i = 0; i < depth; i ++ ) { + + var color = new THREE.Color( Math.random(), Math.random(), Math.random() ); + var r = Math.floor( color.r * 255 ); + var g = Math.floor( color.g * 255 ); + var b = Math.floor( color.b * 255 ); + + for ( var j = 0; j < size; j ++ ) { + + var stride = ( i * size + j ) * 3; + + data[ stride ] = r; + data[ stride + 1 ] = g; + data[ stride + 2 ] = b; + + } + } + + // used the buffer to create a [name] + + var texture = new THREE.DataTexture2DArray( data, width, height, depth ); + texture.format = THREE.RGBFormat; + texture.type = THREE.UnsignedByteType; + </code> + + <h2>Properties</h2> + + <p> + See the base [page:Texture Texture] class for common properties. + </p> + + <h3>[property:Image image]</h3> + <p> + Overridden with a record type holding data, width and height and depth. + </p> + + <h2>Methods</h2> + + <p> + See the base [page:Texture Texture] class for common methods. + </p> + + <h2>Source</h2> + + <p> + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + </p> + </body> +</html>
true
Other
mrdoob
three.js
a921b43d7387b617d3682c112a86c1d5743a59ca.json
Add documentation for DataTexture2DArray
docs/api/zh/textures/DataTexture2DArray.html
@@ -0,0 +1,94 @@ +<!DOCTYPE html> +<html lang="zh"> + <head> + <meta charset="utf-8" /> + <base href="../../../" /> + <script src="list.js"></script> + <script src="page.js"></script> + <link type="text/css" rel="stylesheet" href="page.css" /> + </head> + <body> + [page:Texture] &rarr; + + <h1>[name]</h1> + + <p class="desc">Creates an array of textures directly from raw data, width and height and depth.</p> + + + <h2>Constructor</h2> + + <h3>[name]( data, width, height, depth )</h3> + <p> + The data argument must be an [link:https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView ArrayBufferView]. + The properties inherited from [page:Texture] are the default, except magFilter and minFilter default to THREE.NearestFilter. The properties flipY and generateMipmaps are intially set to false. + </p> + <p> + The interpretation of the data depends on type and format: + If the type is THREE.UnsignedByteType, a Uint8Array will be useful for addressing the texel data. + If the format is THREE.RGBAFormat, data needs four values for one texel; Red, Green, Blue and Alpha (typically the opacity). Similarly, THREE.RGBFormat specifies a format where only three values are used for each texel.<br /> + + For the packed types, THREE.UnsignedShort4444Type, THREE.UnsignedShort5551Type or THREE.UnsignedShort565Type, all color components of one texel can be addressed as bitfields within an integer element of a Uint16Array.<br /> + + In order to use the types THREE.FloatType and THREE.HalfFloatType, the WebGL implementation must support the respective extensions OES_texture_float and OES_texture_half_float. In order to use THREE.LinearFilter for component-wise, bilinear interpolation of the texels based on these types, the WebGL extensions OES_texture_float_linear or OES_texture_half_float_linear must also be present. + </p> + + <h2>代码示例</h2> + + <p>This creates a [name] where each texture has a different color.</p> + + <code> + // create a buffer with color data + + var size = width * height; + var data = new Uint8Array( 3 * size * depth ); + + + for ( var i = 0; i < depth; i ++ ) { + + var color = new THREE.Color( Math.random(), Math.random(), Math.random() ); + var r = Math.floor( color.r * 255 ); + var g = Math.floor( color.g * 255 ); + var b = Math.floor( color.b * 255 ); + + for ( var j = 0; j < size; j ++ ) { + + var stride = ( i * size + j ) * 3; + + data[ stride ] = r; + data[ stride + 1 ] = g; + data[ stride + 2 ] = b; + + } + } + + // used the buffer to create a [name] + + var texture = new THREE.DataTexture2DArray( data, width, height, depth ); + texture.format = THREE.RGBFormat; + texture.type = THREE.UnsignedByteType; + </code> + + <h2>Properties</h2> + + <p> + See the base [page:Texture Texture] class for common properties. + </p> + + <h3>[property:Image image]</h3> + <p> + Overridden with a record type holding data, width and height and depth. + </p> + + <h2>Methods</h2> + + <p> + See the base [page:Texture Texture] class for common methods. + </p> + + <h2>Source</h2> + + <p> + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + </p> + </body> +</html>
true
Other
mrdoob
three.js
a921b43d7387b617d3682c112a86c1d5743a59ca.json
Add documentation for DataTexture2DArray
docs/list.js
@@ -338,6 +338,7 @@ var list = { "CompressedTexture": "api/en/textures/CompressedTexture", "CubeTexture": "api/en/textures/CubeTexture", "DataTexture": "api/en/textures/DataTexture", + "DataTexture2DArray": "api/en/textures/DataTexture2DArray", "DataTexture3D": "api/en/textures/DataTexture3D", "DepthTexture": "api/en/textures/DepthTexture", "Texture": "api/en/textures/Texture", @@ -796,6 +797,7 @@ var list = { "CompressedTexture": "api/zh/textures/CompressedTexture", "CubeTexture": "api/zh/textures/CubeTexture", "DataTexture": "api/zh/textures/DataTexture", + "DataTexture2DArray": "api/zh/textures/DataTexture2DArray", "DataTexture3D": "api/zh/textures/DataTexture3D", "DepthTexture": "api/zh/textures/DepthTexture", "Texture": "api/zh/textures/Texture",
true
Other
mrdoob
three.js
9175e81dabdffd8967fbf4bf3288de7e4669e302.json
Replace var with let or const in WebGLMorphTargets
src/renderers/webgl/WebGLMorphtargets.js
@@ -19,9 +19,9 @@ function WebGLMorphtargets( gl ) { const influencesList = {}; const morphInfluences = new Float32Array( 8 ); - var workInfluences = []; + const workInfluences = []; - for ( var i = 0; i < 8; i ++ ) { + for ( let i = 0; i < 8; i ++ ) { workInfluences[ i ] = [ i, 0 ]; @@ -85,8 +85,8 @@ function WebGLMorphtargets( gl ) { workInfluences.sort( numericalSort ); - var morphTargets = material.morphTargets && geometry.morphAttributes.position; - var morphNormals = material.morphNormals && geometry.morphAttributes.normal; + const morphTargets = material.morphTargets && geometry.morphAttributes.position; + const morphNormals = material.morphNormals && geometry.morphAttributes.normal; let morphInfluencesSum = 0;
false