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 | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_shading_physical.html | @@ -264,7 +264,7 @@
// EVENTS
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
// GUI
| true |
Other | mrdoob | three.js | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_shadowmap.html | @@ -122,7 +122,7 @@
//
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
window.addEventListener( 'keydown', onKeyDown, false );
} | true |
Other | mrdoob | three.js | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_shadowmap_pcss.html | @@ -256,7 +256,7 @@
//
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
}
| true |
Other | mrdoob | three.js | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_shadowmap_performance.html | @@ -116,7 +116,7 @@
//
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
}
| true |
Other | mrdoob | three.js | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_shadowmap_pointlight.html | @@ -119,7 +119,7 @@
//
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
}
| true |
Other | mrdoob | three.js | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_shadowmap_viewer.html | @@ -36,7 +36,7 @@
initMisc();
document.body.appendChild( renderer.domElement );
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
}
| true |
Other | mrdoob | three.js | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_shadowmap_vsm.html | @@ -53,7 +53,7 @@
} );
document.body.appendChild( renderer.domElement );
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
}
| true |
Other | mrdoob | three.js | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_shadowmesh.html | @@ -61,7 +61,7 @@
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
document.getElementById( "container" ).appendChild( renderer.domElement );
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
camera.position.set( 0, 2.5, 10 );
scene.add( camera ); | true |
Other | mrdoob | three.js | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_simple_gi.html | @@ -191,7 +191,7 @@
controls.minDistance = 1;
controls.maxDistance = 10;
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
}
| true |
Other | mrdoob | three.js | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_sprites.html | @@ -104,7 +104,7 @@
//
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
}
| true |
Other | mrdoob | three.js | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_sprites_nodes.html | @@ -181,7 +181,7 @@
// Events
//
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
onWindowResize();
animate(); | true |
Other | mrdoob | three.js | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_tonemapping.html | @@ -123,7 +123,7 @@
render();
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
gui = new GUI();
| true |
Other | mrdoob | three.js | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_trails.html | @@ -66,7 +66,7 @@
//
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
}
| true |
Other | mrdoob | three.js | 96eb4cef277e2a15c2e7c359f2be5a5fb3c01455.json | Remove third parameter from resize listener | examples/webgl_video_kinect.html | @@ -165,7 +165,7 @@
//
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize );
}
| true |
Other | mrdoob | three.js | c214c8a5ba8a638a72494e81758a858d25059942.json | Use euclideanModulo in MathUtils.pingPong | src/math/MathUtils.js | @@ -66,7 +66,7 @@ const MathUtils = {
pingPong: function ( x, length = 1 ) {
- return length - Math.abs( x % ( length * 2 ) - length );
+ return length - Math.abs( MathUtils.euclideanModulo( x, length * 2 ) - length );
},
| true |
Other | mrdoob | three.js | c214c8a5ba8a638a72494e81758a858d25059942.json | Use euclideanModulo in MathUtils.pingPong | test/unit/src/math/MathUtils.tests.js | @@ -157,7 +157,7 @@ export default QUnit.module( 'Maths', () => {
assert.strictEqual( MathUtils.pingPong( 2.5 ), 0.5, "Value at 2.5 is 0.5" );
assert.strictEqual( MathUtils.pingPong( 2.5, 2 ), 1.5, "Value at 2.5 with length of 2 is 1.5" );
- assert.strictEqual( MathUtils.pingPong( - 2 ), 0, "Value at -2 is 0" );
+ assert.strictEqual( MathUtils.pingPong( - 1.5 ), 0.5, "Value at -1.5 is 0.5" );
} );
| true |
Other | mrdoob | three.js | e0cf3e37510a80d7de9d2515627ee05202c3ce77.json | Remove geometry check | examples/js/utils/BufferGeometryUtils.js | @@ -628,12 +628,7 @@ THREE.BufferGeometryUtils = {
*/
computeMorphedAttributes: function ( object ) {
- if ( ! object.geometry ) {
-
- console.error( 'Please provide an object with a geometry' );
- return null;
-
- } else if ( ! object.geometry.isBufferGeometry ) {
+ if ( ! object.geometry.isBufferGeometry ) {
console.error( 'Geometry is not a BufferGeometry' );
return null; | true |
Other | mrdoob | three.js | e0cf3e37510a80d7de9d2515627ee05202c3ce77.json | Remove geometry check | examples/jsm/utils/BufferGeometryUtils.js | @@ -640,12 +640,7 @@ var BufferGeometryUtils = {
*/
computeMorphedAttributes: function ( object ) {
- if ( ! object.geometry ) {
-
- console.warn( 'Please provide an object with a geometry' );
- return null;
-
- } else if ( ! object.geometry.isBufferGeometry ) {
+ if ( ! object.geometry.isBufferGeometry ) {
console.warn( 'Geometry is not a BufferGeometry' );
return null; | true |
Other | mrdoob | three.js | c793e60c34983e07c9e198ba4def19fec5d955d9.json | Remove modularize script (#21587) | .github/CONTRIBUTING.md | @@ -5,15 +5,15 @@ It is assumed that you know a little about node.js and git. If not, [here's some
* Install [Node.js](https://nodejs.org/)
* Install [Git](https://git-scm.com/)
-* [Fork](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) three.js
+* [Fork](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) three.js
* Open your OS’s terminal
* Change into the directory you’d like
* Clone your forked repo
git clone https://github.com/[yourgithubname]/three.js.git
* Go into the three.js directory.
-
+
cd ./three.js
* Install the dependencies
@@ -39,20 +39,20 @@ Many linting errors can be fixed automatically by running
npm lint-fix
If you’d like to make a minified version of the build files i.e. ‘build/three.min.js’ run:
-
+
npm run build
## Making changes
When you’ve decided to make changes, start with the following:
* Update your local repo
-
+
git pull https://github.com/mrdoob/three.js.git
git push
* Make a new branch from the dev branch
-
+
git checkout dev
git branch [mychangesbranch]
git checkout [mychangesbranch]
@@ -70,8 +70,8 @@ When you’ve decided to make changes, start with the following:
* If you modify existing code, run relevant examples to check they didn't break and there wasn't performance regress.
* If you add some assets for the examples (models, textures, sounds, etc), make sure they have a proper license allowing for their use here, less restrictive the better. It is unlikely for large assets to be accepted.
* If some issue is relevant to patch / feature, please mention it with hash (e.g. #2774) in a commit message to get cross-reference in GitHub.
-* If you modify files in `examples/js` directory, then don't perform any changes in the `examples/jsm`, JavaScript modules are auto-generated via running `node utils/modularize.js`.
-* If end-to-end test failed in Travis and you are sure that all is correct, make a new screenshots with
+* If you modify files in `examples/jsm` directory, then don't perform any changes in the `examples/js`, non-module files are auto-generated by running `npm run build-examples`.
+* If end-to-end test failed in Travis and you are sure that all is correct, make a new screenshots with
npm run make-screenshot <example_1_name> ...<example_N_name>
| true |
Other | mrdoob | three.js | c793e60c34983e07c9e198ba4def19fec5d955d9.json | Remove modularize script (#21587) | utils/modularize.js | @@ -1,335 +0,0 @@
-var fs = require( 'fs' );
-var os = require( 'os' ), EOL = os.EOL;
-THREE = require( '../build/three.js' );
-
-var srcFolder = __dirname + '/../examples/js/';
-var dstFolder = __dirname + '/../examples/jsm/';
-
-var files = [
- { path: 'animation/AnimationClipCreator.js', dependencies: [], ignoreList: [] },
- { path: 'animation/CCDIKSolver.js', dependencies: [], ignoreList: [ 'SkinnedMesh' ] },
- { path: 'animation/MMDAnimationHelper.js', dependencies: [ { name: 'CCDIKSolver', path: 'animation/CCDIKSolver.js' }, { name: 'MMDPhysics', path: 'animation/MMDPhysics.js' } ], ignoreList: [ 'AnimationClip', 'Audio', 'Camera', 'SkinnedMesh' ] },
- { path: 'animation/MMDPhysics.js', dependencies: [], ignoreList: [ 'SkinnedMesh' ] },
-
- { path: 'cameras/CinematicCamera.js', dependencies: [ { name: 'BokehShader', path: 'shaders/BokehShader2.js' }, { name: 'BokehDepthShader', path: 'shaders/BokehShader2.js' } ], ignoreList: [] },
-
- { path: 'controls/DragControls.js', dependencies: [], ignoreList: [] },
- { path: 'controls/DeviceOrientationControls.js', dependencies: [], ignoreList: [] },
- { path: 'controls/FirstPersonControls.js', dependencies: [], ignoreList: [] },
- { path: 'controls/FlyControls.js', dependencies: [], ignoreList: [] },
- { path: 'controls/OrbitControls.js', dependencies: [], ignoreList: [] },
- { path: 'controls/PointerLockControls.js', dependencies: [], ignoreList: [] },
- { path: 'controls/TrackballControls.js', dependencies: [], ignoreList: [] },
- { path: 'controls/TransformControls.js', dependencies: [], ignoreList: [] },
-
- { path: 'curves/CurveExtras.js', dependencies: [], ignoreList: [] },
- { path: 'curves/NURBSCurve.js', dependencies: [ { name: 'NURBSUtils', path: 'curves/NURBSUtils.js' } ], ignoreList: [] },
- { path: 'curves/NURBSSurface.js', dependencies: [ { name: 'NURBSUtils', path: 'curves/NURBSUtils.js' } ], ignoreList: [] },
- { path: 'curves/NURBSUtils.js', dependencies: [], ignoreList: [] },
-
- { path: 'effects/AnaglyphEffect.js', dependencies: [], ignoreList: [] },
- { path: 'effects/AsciiEffect.js', dependencies: [], ignoreList: [] },
- { path: 'effects/OutlineEffect.js', dependencies: [], ignoreList: [] },
- { path: 'effects/ParallaxBarrierEffect.js', dependencies: [], ignoreList: [] },
- { path: 'effects/PeppersGhostEffect.js', dependencies: [], ignoreList: [] },
- { path: 'effects/StereoEffect.js', dependencies: [], ignoreList: [] },
-
- { path: 'exporters/ColladaExporter.js', dependencies: [], ignoreList: [ 'BufferGeometry' ] },
- { path: 'exporters/DRACOExporter.js', dependencies: [], ignoreList: [ 'Geometry', 'BufferGeometry' ] },
- { path: 'exporters/GLTFExporter.js', dependencies: [], ignoreList: [ 'AnimationClip', 'Camera', 'Geometry', 'Material', 'Mesh', 'Object3D', 'Scenes', 'ShaderMaterial', 'BufferGeometry', 'Texture' ] },
- { path: 'exporters/MMDExporter.js', dependencies: [ { name: 'MMDParser', path: 'libs/mmdparser.module.js' } ], ignoreList: [] },
- { path: 'exporters/OBJExporter.js', dependencies: [], ignoreList: [ 'BufferGeometry' ] },
- { path: 'exporters/PLYExporter.js', dependencies: [], ignoreList: [ 'BufferGeometry' ] },
- { path: 'exporters/STLExporter.js', dependencies: [], ignoreList: [ 'BufferGeometry' ] },
-
- { path: 'geometries/BoxLineGeometry.js', dependencies: [], ignoreList: [] },
- { path: 'geometries/ConvexGeometry.js', dependencies: [ { name: 'ConvexHull', path: 'math/ConvexHull.js' } ], ignoreList: [] },
- { path: 'geometries/DecalGeometry.js', dependencies: [], ignoreList: [ 'Geometry' ] },
- { path: 'geometries/LightningStrike.js', dependencies: [ { name: 'SimplexNoise', path: 'math/SimplexNoise.js' } ], ignoreList: [ 'Mesh' ] },
- { path: 'geometries/ParametricGeometries.js', dependencies: [], ignoreList: [] },
- { path: 'geometries/TeapotGeometry.js', dependencies: [], ignoreList: [] },
-
- { path: 'interactive/SelectionBox.js', dependencies: [], ignoreList: [] },
- { path: 'interactive/SelectionHelper.js', dependencies: [], ignoreList: [] },
-
- { path: 'lights/LightProbeGenerator.js', dependencies: [], ignoreList: [] },
- { path: 'lights/RectAreaLightUniformsLib.js', dependencies: [], ignoreList: [] },
-
- { path: 'lines/Line2.js', dependencies: [ { name: 'LineSegments2', path: 'lines/LineSegments2.js' }, { name: 'LineGeometry', path: 'lines/LineGeometry.js' }, { name: 'LineMaterial', path: 'lines/LineMaterial.js' } ], ignoreList: [] },
- { path: 'lines/LineGeometry.js', dependencies: [ { name: 'LineSegmentsGeometry', path: 'lines/LineSegmentsGeometry.js' } ], ignoreList: [ 'BufferGeometry' ] },
- { path: 'lines/LineMaterial.js', dependencies: [], ignoreList: [] },
- { path: 'lines/LineSegments2.js', dependencies: [ { name: 'LineSegmentsGeometry', path: 'lines/LineSegmentsGeometry.js' }, { name: 'LineMaterial', path: 'lines/LineMaterial.js' } ], ignoreList: [] },
- { path: 'lines/LineSegmentsGeometry.js', dependencies: [], ignoreList: [ 'BufferGeometry' ] },
- { path: 'lines/Wireframe.js', dependencies: [ { name: 'LineSegmentsGeometry', path: 'lines/LineSegmentsGeometry.js' }, { name: 'LineMaterial', path: 'lines/LineMaterial.js' } ], ignoreList: [] },
- { path: 'lines/WireframeGeometry2.js', dependencies: [ { name: 'LineSegmentsGeometry', path: 'lines/LineSegmentsGeometry.js' } ], ignoreList: [] },
-
- { path: 'loaders/3MFLoader.js', dependencies: [ { name: 'fflate', path: 'libs/fflate.module.min.js', importAll: true } ], ignoreList: [] },
- { path: 'loaders/AMFLoader.js', dependencies: [ { name: 'fflate', path: 'libs/fflate.module.min.js', importAll: true } ], ignoreList: [] },
- { path: 'loaders/BasisTextureLoader.js', dependencies: [], ignoreList: [] },
- { path: 'loaders/BVHLoader.js', dependencies: [], ignoreList: [ 'Bones' ] },
- { path: 'loaders/ColladaLoader.js', dependencies: [ { name: 'TGALoader', path: 'loaders/TGALoader.js' } ], ignoreList: [] },
- { path: 'loaders/DDSLoader.js', dependencies: [], ignoreList: [] },
- { path: 'loaders/DRACOLoader.js', dependencies: [], ignoreList: [ 'LoadingManager' ] },
- { path: 'loaders/EXRLoader.js', dependencies: [ { name: 'fflate', path: 'libs/fflate.module.min.js', importAll: true } ], ignoreList: [] },
- { path: 'loaders/FBXLoader.js', dependencies: [ { name: 'fflate', path: 'libs/fflate.module.min.js', importAll: true }, { name: 'NURBSCurve', path: 'curves/NURBSCurve.js' } ], ignoreList: [] },
- { path: 'loaders/GCodeLoader.js', dependencies: [], ignoreList: [] },
- { path: 'loaders/GLTFLoader.js', dependencies: [], ignoreList: [ 'NoSide', 'Matrix2', 'Camera', 'Texture' ] },
- { path: 'loaders/HDRCubeTextureLoader.js', dependencies: [ { name: 'RGBELoader', path: 'loaders/RGBELoader.js' } ], ignoreList: [] },
- { path: 'loaders/KMZLoader.js', dependencies: [ { name: 'ColladaLoader', path: 'loaders/ColladaLoader.js' }, { name: 'fflate', path: 'libs/fflate.module.min.js', importAll: true } ], ignoreList: [] },
- { path: 'loaders/LDrawLoader.js', dependencies: [], ignoreList: [ 'Cache', 'Material', 'Object3D' ] },
- { path: 'loaders/KTXLoader.js', dependencies: [], ignoreList: [] },
- { path: 'loaders/MD2Loader.js', dependencies: [], ignoreList: [] },
- { path: 'loaders/MMDLoader.js', dependencies: [ { name: 'TGALoader', path: 'loaders/TGALoader.js' }, { name: 'MMDParser', path: 'libs/mmdparser.module.js' } ], ignoreList: [ 'Camera', 'LoadingManager' ] },
- { path: 'loaders/MTLLoader.js', dependencies: [], ignoreList: [ 'BackSide', 'DoubleSide', 'ClampToEdgeWrapping', 'MirroredRepeatWrapping' ] },
- { path: 'loaders/NRRDLoader.js', dependencies: [ { name: 'fflate', path: 'libs/fflate.module.min.js', importAll: true }, { name: 'Volume', path: 'misc/Volume.js' } ], ignoreList: [] },
- { path: 'loaders/OBJLoader.js', dependencies: [], ignoreList: [] },
- { path: 'loaders/PCDLoader.js', dependencies: [], ignoreList: [] },
- { path: 'loaders/PDBLoader.js', dependencies: [], ignoreList: [] },
- { path: 'loaders/PLYLoader.js', dependencies: [], ignoreList: [ 'Mesh' ] },
- { path: 'loaders/PRWMLoader.js', dependencies: [], ignoreList: [] },
- { path: 'loaders/PVRLoader.js', dependencies: [], ignoreList: [] },
- { path: 'loaders/RGBELoader.js', dependencies: [], ignoreList: [ 'RGBAFormat' ] },
- { path: 'loaders/STLLoader.js', dependencies: [], ignoreList: [ 'Mesh', 'MeshPhongMaterial' ] },
- { path: 'loaders/SVGLoader.js', dependencies: [], ignoreList: [ 'Color' ] },
- { path: 'loaders/TDSLoader.js', dependencies: [], ignoreList: [] },
- { path: 'loaders/TGALoader.js', dependencies: [], ignoreList: [] },
- { path: 'loaders/TTFLoader.js', dependencies: [ { name: 'opentype', path: 'libs/opentype.module.min.js' } ], ignoreList: [ 'Font' ] },
- { path: 'loaders/VRMLLoader.js', dependencies: [ { name: 'chevrotain', path: 'libs/chevrotain.module.min.js' } ], ignoreList: [] },
- { path: 'loaders/VRMLoader.js', dependencies: [ { name: 'GLTFLoader', path: 'loaders/GLTFLoader.js' } ], ignoreList: [] },
- { path: 'loaders/VTKLoader.js', dependencies: [ { name: 'fflate', path: 'libs/fflate.module.min.js', importAll: true } ], ignoreList: [] },
- { path: 'loaders/XLoader.js', dependencies: [], ignoreList: [] },
-
- { path: 'math/ColorConverter.js', dependencies: [], ignoreList: [] },
- { path: 'math/ConvexHull.js', dependencies: [], ignoreList: [ 'BufferGeometry' ] },
- { path: 'math/ImprovedNoise.js', dependencies: [], ignoreList: [] },
- { path: 'math/Lut.js', dependencies: [], ignoreList: [] },
- { path: 'math/SimplexNoise.js', dependencies: [], ignoreList: [] },
-
- { path: 'misc/ConvexObjectBreaker.js', dependencies: [ { name: 'ConvexGeometry', path: 'geometries/ConvexGeometry.js' } ], ignoreList: [ 'Matrix4' ] },
- { path: 'misc/GPUComputationRenderer.js', dependencies: [], ignoreList: [] },
- { path: 'misc/Gyroscope.js', dependencies: [], ignoreList: [] },
- { path: 'misc/MD2Character.js', dependencies: [ { name: 'MD2Loader', path: 'loaders/MD2Loader.js' } ], ignoreList: [] },
- { path: 'misc/MD2CharacterComplex.js', dependencies: [ { name: 'MD2Loader', path: 'loaders/MD2Loader.js' }, { name: 'MorphBlendMesh', path: 'misc/MorphBlendMesh.js' } ], ignoreList: [] },
- { path: 'misc/MorphAnimMesh.js', dependencies: [], ignoreList: [] },
- { path: 'misc/MorphBlendMesh.js', dependencies: [], ignoreList: [] },
- { path: 'misc/RollerCoaster.js', dependencies: [], ignoreList: [] },
- { path: 'misc/Volume.js', dependencies: [ { name: 'VolumeSlice', path: 'misc/VolumeSlice.js' } ], ignoreList: [] },
- { path: 'misc/VolumeSlice.js', dependencies: [], ignoreList: [] },
-
- { path: 'modifiers/EdgeSplitModifier.js', dependencies: [ { name: 'BufferGeometryUtils', path: 'utils/BufferGeometryUtils.js' } ], ignoreList: [ 'Geometry' ] },
- { path: 'modifiers/SimplifyModifier.js', dependencies: [ { name: 'BufferGeometryUtils', path: 'utils/BufferGeometryUtils.js' } ], ignoreList: [] },
- { path: 'modifiers/TessellateModifier.js', dependencies: [], ignoreList: [] },
-
- { path: 'objects/Lensflare.js', dependencies: [], ignoreList: [] },
- { path: 'objects/LightningStorm.js', dependencies: [ { name: 'LightningStrike', path: 'geometries/LightningStrike.js' } ], ignoreList: [ 'Material' ] },
- { path: 'objects/MarchingCubes.js', dependencies: [], ignoreList: [] },
- { path: 'objects/Reflector.js', dependencies: [], ignoreList: [] },
- { path: 'objects/Refractor.js', dependencies: [], ignoreList: [] },
- { path: 'objects/ReflectorRTT.js', dependencies: [ { name: 'Reflector', path: 'objects/Reflector.js' } ], ignoreList: [] },
- { path: 'objects/ShadowMesh.js', dependencies: [], ignoreList: [] },
- { path: 'objects/Sky.js', dependencies: [], ignoreList: [] },
- { path: 'objects/Water.js', dependencies: [], ignoreList: [] },
- { path: 'objects/Water2.js', dependencies: [ { name: 'Reflector', path: 'objects/Reflector.js' }, { name: 'Refractor', path: 'objects/Refractor.js' } ], ignoreList: [] },
-
- { path: 'postprocessing/AdaptiveToneMappingPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'CopyShader', path: 'shaders/CopyShader.js' }, { name: 'LuminosityShader', path: 'shaders/LuminosityShader.js' }, { name: 'ToneMapShader', path: 'shaders/ToneMapShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/AfterimagePass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'AfterimageShader', path: 'shaders/AfterimageShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/BloomPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'CopyShader', path: 'shaders/CopyShader.js' }, { name: 'ConvolutionShader', path: 'shaders/ConvolutionShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/BokehPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'BokehShader', path: 'shaders/BokehShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/ClearPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' } ], ignoreList: [] },
- { path: 'postprocessing/CubeTexturePass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' } ], ignoreList: [] },
- { path: 'postprocessing/DotScreenPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'DotScreenShader', path: 'shaders/DotScreenShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/EffectComposer.js', dependencies: [ { name: 'CopyShader', path: 'shaders/CopyShader.js' }, { name: 'ShaderPass', path: 'postprocessing/ShaderPass.js' }, { name: 'MaskPass', path: 'postprocessing/MaskPass.js' }, { name: 'ClearMaskPass', path: 'postprocessing/MaskPass.js' } ], ignoreList: [] },
- { path: 'postprocessing/FilmPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'FilmShader', path: 'shaders/FilmShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/GlitchPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'DigitalGlitch', path: 'shaders/DigitalGlitch.js' } ], ignoreList: [] },
- { path: 'postprocessing/HalftonePass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'HalftoneShader', path: 'shaders/HalftoneShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/MaskPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' } ], ignoreList: [] },
- { path: 'postprocessing/OutlinePass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'CopyShader', path: 'shaders/CopyShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/RenderPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' } ], ignoreList: [] },
- { path: 'postprocessing/SAOPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'SAOShader', path: 'shaders/SAOShader.js' }, { name: 'DepthLimitedBlurShader', path: 'shaders/DepthLimitedBlurShader.js' }, { name: 'BlurShaderUtils', path: 'shaders/DepthLimitedBlurShader.js' }, { name: 'CopyShader', path: 'shaders/CopyShader.js' }, { name: 'UnpackDepthRGBAShader', path: 'shaders/UnpackDepthRGBAShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/SavePass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'CopyShader', path: 'shaders/CopyShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/ShaderPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' } ], ignoreList: [] },
- { path: 'postprocessing/SMAAPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'SMAAEdgesShader', path: 'shaders/SMAAShader.js' }, { name: 'SMAAWeightsShader', path: 'shaders/SMAAShader.js' }, { name: 'SMAABlendShader', path: 'shaders/SMAAShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/SSAARenderPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'CopyShader', path: 'shaders/CopyShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/SSAOPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'SimplexNoise', path: 'math/SimplexNoise.js' }, { name: 'SSAOShader', path: 'shaders/SSAOShader.js' }, { name: 'SSAOBlurShader', path: 'shaders/SSAOShader.js' }, { name: 'SSAODepthShader', path: 'shaders/SSAOShader.js' }, { name: 'CopyShader', path: 'shaders/CopyShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/TAARenderPass.js', dependencies: [ { name: 'SSAARenderPass', path: 'postprocessing/SSAARenderPass.js' } ], ignoreList: [] },
- { path: 'postprocessing/TexturePass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'CopyShader', path: 'shaders/CopyShader.js' } ], ignoreList: [] },
- { path: 'postprocessing/UnrealBloomPass.js', dependencies: [ { name: 'Pass', path: 'postprocessing/Pass.js' }, { name: 'CopyShader', path: 'shaders/CopyShader.js' }, { name: 'LuminosityHighPassShader', path: 'shaders/LuminosityHighPassShader.js' } ], ignoreList: [] },
-
- { path: 'renderers/CSS2DRenderer.js', dependencies: [], ignoreList: [] },
- { path: 'renderers/CSS3DRenderer.js', dependencies: [], ignoreList: [] },
- { path: 'renderers/Projector.js', dependencies: [], ignoreList: [ 'BufferGeometry' ] },
- { path: 'renderers/SVGRenderer.js', dependencies: [ { name: 'Projector', path: 'renderers/Projector.js' }, { name: 'RenderableFace', path: 'renderers/Projector.js' }, { name: 'RenderableLine', path: 'renderers/Projector.js' }, { name: 'RenderableSprite', path: 'renderers/Projector.js' } ], ignoreList: [] },
-
- { path: 'shaders/ACESFilmicToneMappingShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/AfterimageShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/BasicShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/BleachBypassShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/BlendShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/BokehShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/BokehShader2.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/BrightnessContrastShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/ColorCorrectionShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/ColorifyShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/ConvolutionShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/CopyShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/DepthLimitedBlurShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/DigitalGlitch.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/DOFMipMapShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/DotScreenShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/FilmShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/FocusShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/FreiChenShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/FresnelShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/FXAAShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/GammaCorrectionShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/GodRaysShader.js', dependencies: [], ignoreList: [ 'MeshDepthMaterial' ] },
- { path: 'shaders/HalftoneShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/HorizontalBlurShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/HorizontalTiltShiftShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/HueSaturationShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/KaleidoShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/LuminosityHighPassShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/LuminosityShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/MirrorShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/NormalMapShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/ParallaxShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/PixelShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/RGBShiftShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/SAOShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/SepiaShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/SMAAShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/SobelOperatorShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/SSAOShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/TechnicolorShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/ToneMapShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/ToonShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/SubsurfaceScatteringShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/TriangleBlurShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/UnpackDepthRGBAShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/VerticalBlurShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/VerticalTiltShiftShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/VignetteShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/VolumeShader.js', dependencies: [], ignoreList: [] },
- { path: 'shaders/WaterRefractionShader.js', dependencies: [], ignoreList: [] },
-
- { path: 'utils/BufferGeometryUtils.js', dependencies: [], ignoreList: [] },
- { path: 'utils/GeometryUtils.js', dependencies: [], ignoreList: [] },
- { path: 'utils/SceneUtils.js', dependencies: [], ignoreList: [] },
- { path: 'utils/ShadowMapViewer.js', dependencies: [ { name: 'UnpackDepthRGBAShader', path: 'shaders/UnpackDepthRGBAShader.js' } ], ignoreList: [] },
- { path: 'utils/SkeletonUtils.js', dependencies: [], ignoreList: [] },
- { path: 'utils/UVsDebug.js', dependencies: [], ignoreList: [ 'SphereGeometry', 'BufferGeometry' ] },
-
- { path: 'WebGL.js', dependencies: [], ignoreList: [] },
-];
-
-for ( var i = 0; i < files.length; i ++ ) {
-
- var file = files[ i ];
- convert( file.path, file.dependencies, file.ignoreList );
-
-}
-
-//
-
-function convert( path, exampleDependencies, ignoreList ) {
-
- var contents = fs.readFileSync( srcFolder + path, 'utf8' );
-
- var classNames = [];
- var coreDependencies = {};
-
- // class name
-
- contents = contents.replace( /THREE\.([a-zA-Z0-9]+) = /g, function ( match, p1 ) {
-
- classNames.push( p1 );
-
- console.log( p1 );
-
- return `var ${p1} = `;
-
- } );
-
- contents = contents.replace( /(\'?)THREE\.([a-zA-Z0-9]+)(\.{0,1})/g, function ( match, p1, p2, p3 ) {
-
- if ( p1 === '\'' ) return match; // Inside a string
- if ( classNames.includes( p2 ) ) return `${p2}${p3}`;
-
- return match;
-
- } );
-
- // methods
-
- contents = contents.replace( /new THREE\.([a-zA-Z0-9]+)\(/g, function ( match, p1 ) {
-
- if ( ignoreList.includes( p1 ) ) return match;
-
- if ( p1 in THREE ) coreDependencies[ p1 ] = true;
-
- return `new ${p1}(`;
-
- } );
-
- // constants
-
- contents = contents.replace( /(\'?)THREE\.([a-zA-Z0-9_]+)/g, function ( match, p1, p2 ) {
-
- if ( ignoreList.includes( p2 ) ) return match;
- if ( p1 === '\'' ) return match; // Inside a string
- if ( classNames.includes( p2 ) ) return p2;
-
- if ( p2 in THREE ) coreDependencies[ p2 ] = true;
-
- // console.log( match, p2 );
-
- return `${p2}`;
-
- } );
-
- //
-
- var keys = Object.keys( coreDependencies )
- .filter( value => ! classNames.includes( value ) )
- .map( value => EOL + '\t' + value )
- .sort()
- .toString();
-
- var imports = [];
-
- // compute path prefix for imports/exports
-
- var level = path.split( '/' ).length - 1;
- var pathPrefix = '../'.repeat( level );
-
- // core imports
-
- if ( keys ) imports.push( `import {${keys}${EOL}} from '${pathPrefix}../../build/three.module.js';` );
-
- // example imports
-
- for ( var dependency of exampleDependencies ) {
-
- if ( dependency.importAll === true ) {
-
- imports.push( `import * as ${dependency.name} from '${pathPrefix}${dependency.path}';` );
-
- } else {
-
- imports.push( `import { ${dependency.name} } from '${pathPrefix}${dependency.path}';` );
-
- }
-
- }
-
- var output = '';
-
- if ( imports.length > 0 ) output += imports.join( EOL ) + EOL + EOL;
-
- output += contents + `${EOL}export { ${classNames.join( ', ' )} };${EOL}`;
-
- // console.log( output );
-
- fs.writeFileSync( dstFolder + path, output, 'utf-8' );
-
-} | true |
Other | mrdoob | three.js | dfc5efcc5bb6522e42324c098acc8e8c21c9fdcd.json | Normalize CSM imports (#21566) | examples/jsm/csm/CSM.js | @@ -7,8 +7,8 @@ import {
Matrix4,
Box3
} from '../../../build/three.module.js';
-import Frustum from './Frustum.js';
-import Shader from './Shader.js';
+import { Frustum } from './Frustum.js';
+import { CSMShader } from './CSMShader.js';
const _cameraToLightMatrix = new Matrix4();
const _lightSpaceFrustum = new Frustum();
@@ -239,8 +239,8 @@ export class CSM {
injectInclude() {
- ShaderChunk.lights_fragment_begin = Shader.lights_fragment_begin;
- ShaderChunk.lights_pars_begin = Shader.lights_pars_begin;
+ ShaderChunk.lights_fragment_begin = CSMShader.lights_fragment_begin;
+ ShaderChunk.lights_pars_begin = CSMShader.lights_pars_begin;
}
| true |
Other | mrdoob | three.js | dfc5efcc5bb6522e42324c098acc8e8c21c9fdcd.json | Normalize CSM imports (#21566) | examples/jsm/csm/CSMShader.js | @@ -1,6 +1,6 @@
import { ShaderChunk } from '../../../build/three.module.js';
-export default {
+const CSMShader = {
lights_fragment_begin: /* glsl */`
GeometricContext geometry;
@@ -231,3 +231,5 @@ uniform float shadowFar;
#endif
` + ShaderChunk.lights_pars_begin
};
+
+export { CSMShader }; | true |
Other | mrdoob | three.js | dfc5efcc5bb6522e42324c098acc8e8c21c9fdcd.json | Normalize CSM imports (#21566) | examples/jsm/csm/Frustum.js | @@ -2,7 +2,7 @@ import { Vector3, Matrix4 } from '../../../build/three.module.js';
const inverseProjectionMatrix = new Matrix4();
-export default class Frustum {
+class Frustum {
constructor( data ) {
@@ -148,3 +148,5 @@ export default class Frustum {
}
}
+
+export { Frustum }; | true |
Other | mrdoob | three.js | 0af5454b19a3cf15fe126e9e767b961de3046713.json | prevent unwanted references (#18564) | src/core/EventDispatcher.js | @@ -77,6 +77,8 @@ Object.assign( EventDispatcher.prototype, {
}
+ event.target = null;
+
}
} | false |
Other | mrdoob | three.js | 232e4e8fcac86aed1bc14424a2f0515207696213.json | fix typo in the doc: Matrix4#makeShear (#22059) | docs/api/en/math/Matrix4.html | @@ -319,12 +319,12 @@ <h3>[method:this makeScale]( [param:Float x], [param:Float y], [param:Float z] )
<h3>[method:this makeShear]( [param:Float xy], [param:Float xz], [param:Float yx], [param:Float yz], [param:Float zx], [param:Float zy] )</h3>
<p>
- [page:Float x] - the amount to shear X by Y.<br />
- [page:Float x] - the amount to shear X by Z.<br />
- [page:Float x] - the amount to shear Y by X.<br />
- [page:Float x] - the amount to shear Y by Z.<br />
- [page:Float y] - the amount to shear Z by X.<br />
- [page:Float z] - the amount to shear Z by Y.<br /><br />
+ [page:Float xy] - the amount to shear X by Y.<br />
+ [page:Float xz] - the amount to shear X by Z.<br />
+ [page:Float yx] - the amount to shear Y by X.<br />
+ [page:Float yz] - the amount to shear Y by Z.<br />
+ [page:Float zx] - the amount to shear Z by X.<br />
+ [page:Float zy] - the amount to shear Z by Y.<br /><br />
Sets this matrix as a shear transform:
<code> | false |
Other | mrdoob | three.js | 6fb297a402a3bf60d11287a37164a42954debd6f.json | fix renderBufferDirect parameter in doc (#22049) | docs/api/en/renderers/WebGLRenderer.html | @@ -409,7 +409,7 @@ <h3>[method:null render]( [param:Object3D scene], [param:Camera camera] )</h3>
[page:WebGLRenderer.autoClearDepth autoClearDepth] properties to false. To forcibly clear one ore more buffers call [page:WebGLRenderer.clear .clear].
</p>
- <h3>[method:null renderBufferDirect]( [param:Camera camera], [param:Fog fog], [param:BufferGeometry geometry], [param:Material material], [param:Object3D object], [param:Object group] )</h3>
+ <h3>[method:null renderBufferDirect]( [param:Camera camera], [param:Scene scene], [param:BufferGeometry geometry], [param:Material material], [param:Object3D object], [param:Object group] )</h3>
<p>Render a buffer geometry group using the camera and with the specified material.</p>
<h3>[method:null renderBufferImmediate]( [param:Object3D object], [param:WebGLProgram program] )</h3> | true |
Other | mrdoob | three.js | 6fb297a402a3bf60d11287a37164a42954debd6f.json | fix renderBufferDirect parameter in doc (#22049) | docs/api/zh/renderers/WebGLRenderer.html | @@ -363,7 +363,7 @@ <h3>[method:null render]( [param:Object3D scene], [param:Camera camera] )</h3>
即便forceClear设为true, 也可以通过将[page:WebGLRenderer.autoClearColor autoClearColor]、[page:WebGLRenderer.autoClearStencil autoClearStencil]或[page:WebGLRenderer.autoClearDepth autoClearDepth]属性的值设为false来阻止对应缓存被清除。
</p>
- <h3>[method:null renderBufferDirect]( [param:Camera camera], [param:Fog fog], [param:BufferGeometry geometry], [param:Material material], [param:Object3D object], [param:Object group] )</h3>
+ <h3>[method:null renderBufferDirect]( [param:Camera camera], [param:Scene scene], [param:BufferGeometry geometry], [param:Material material], [param:Object3D object], [param:Object group] )</h3>
<p>使用相机和指定材质渲染缓冲几何组。</p>
<h3>[method:null renderBufferImmediate]( [param:Object3D object], [param:WebGLProgram program] )</h3> | true |
Other | mrdoob | three.js | 0aa0fa7dea0d600500eab5b43df30dba0321227c.json | Add license comment to fflate. | examples/js/libs/fflate.min.js | @@ -1 +1,7 @@
+/*!
+fflate - fast JavaScript compression/decompression
+<https://101arrowz.github.io/fflate>
+Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
+Subset included: synchronous unzip, gunzip, and unzlib
+*/
!function(f){typeof exports=="object"&&typeof module!="undefined"?module.exports=f():typeof define=='function'&&define.amd?define([],f):(typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"&&self).fflate=f()}(function(_e){"use strict";var _e={},r=Uint8Array,n=Uint16Array,e=Uint32Array,t=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),a=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),i=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(r,t){for(var a=new n(31),i=0;i<31;++i)a[i]=t+=1<<r[i-1];var o=new e(a[30]);for(i=1;i<30;++i)for(var f=a[i];f<a[i+1];++f)o[f]=f-a[i]<<5|i;return[a,o]},f=o(t,2),u=f[0],v=f[1];u[28]=258,v[258]=28;for(var c=o(a,0),l=c[0],w=(c[1],new n(32768)),h=0;h<32768;++h){var s=(43690&h)>>>1|(21845&h)<<1;s=(61680&(s=(52428&s)>>>2|(13107&s)<<2))>>>4|(3855&s)<<4,w[h]=((65280&s)>>>8|(255&s)<<8)>>>1}var d=function(r,e){for(var t=r.length,a=0,i=new n(e);a<t;++a)++i[r[a]-1];var o=new n(e);for(a=0;a<e;++a)o[a]=o[a-1]+i[a-1]<<1;var f=new n(1<<e),u=15-e;for(a=0;a<t;++a)if(r[a])for(var v=a<<4|r[a],c=e-r[a],l=o[r[a]-1]++<<c,h=l|(1<<c)-1;l<=h;++l)f[w[l]>>>u]=v;return f},p=new r(288);for(h=0;h<144;++h)p[h]=8;for(h=144;h<256;++h)p[h]=9;for(h=256;h<280;++h)p[h]=7;for(h=280;h<288;++h)p[h]=8;var g=new r(32);for(h=0;h<32;++h)g[h]=5;var y=d(p,9),b=d(g,5),x=function(r){for(var n=r[0],e=1;e<r.length;++e)r[e]>n&&(n=r[e]);return n},z=function(r,n,e){var t=n/8>>0;return(r[t]|r[t+1]<<8)>>>(7&n)&e},C=function(r,n){var e=n/8>>0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>>(7&n)},m=function(r){return(r/8>>0)+(7&r&&1)},S=function(t,a,i){(null==a||a<0)&&(a=0),(null==i||i>t.length)&&(i=t.length);var o=new(t instanceof n?n:t instanceof e?e:r)(i-a);return o.set(t.subarray(a,i)),o},F=function(n,e){var o=n.length,f=!e;e||(e=new r(3*o));var v,c,w,h,s=function(n){var t=e.length;if(n>t){var a=new r(Math.max(2*t,n));a.set(e),e=a}},p=0,g=0,F=0;if(p&&!v)return e;var E=8*o;do{p=z(n,g,1);var O=z(n,g+1,3);if(g+=3,O){if(1==O)v=y,c=b,w=9,h=5;else{if(2!=O)throw"invalid block type";var U=z(n,g,31)+257,k=z(n,g+10,15)+4,A=U+z(n,g+5,31)+1;g+=14;for(var D=new r(A),T=new r(19),M=0;M<k;++M)T[i[M]]=z(n,g+3*M,7);g+=3*k;var j=x(T),q=(1<<j)-1,B=d(T,j);for(M=0;M<A;){var G=B[z(n,g,q)];if(g+=15&G,(Y=G>>>4)<16)D[M++]=Y;else{var H=0,I=0;for(16==Y?(I=3+z(n,g,3),g+=2,H=D[M-1]):17==Y?(I=3+z(n,g,7),g+=3):18==Y&&(I=11+z(n,g,127),g+=7);I--;)D[M++]=H}}var J=D.subarray(0,U),K=D.subarray(U);w=x(J),h=x(K),v=d(J,w),c=d(K,h)}if(g>E)throw"unexpected EOF";f&&s(F+131072);for(var L=(1<<w)-1,N=(1<<h)-1;;){var P=(H=v[C(n,g)&L])>>>4;if((g+=15&H)>E)throw"unexpected EOF";if(!H)throw"invalid length/literal";if(P<256)e[F++]=P;else{if(256==P)break;var Q=P-254;if(P>264){var R=t[M=P-257];Q=z(n,g,(1<<R)-1)+u[M],g+=R}var V=c[C(n,g)&N],W=V>>>4;if(!V)throw"invalid distance";g+=15&V;K=l[W];if(W>3){R=a[W];K+=C(n,g)&(1<<R)-1,g+=R}if(g>E)throw"unexpected EOF";f&&s(F+131072);for(var X=F+Q;F<X;F+=4)e[F]=e[F-K],e[F+1]=e[F+1-K],e[F+2]=e[F+2-K],e[F+3]=e[F+3-K];F=X}}}else{var Y,Z=n[(Y=m(g)+4)-4]|n[Y-3]<<8,$=Y+Z;if($>o)throw"unexpected EOF";f&&s(F+Z),e.set(n.subarray(Y,$),F),F+=Z,g=8*$}}while(!p);return F==e.length?e:S(e,0,F)},E=function(r,n){return r[n]|r[n+1]<<8},O=function(r,n){return(r[n]|r[n+1]<<8|r[n+2]<<16)+2*(r[n+3]<<23)},U=function(r){if(31!=r[0]||139!=r[1]||8!=r[2])throw"invalid gzip data";var n=r[3],e=10;4&n&&(e+=r[10]|2+(r[11]<<8));for(var t=(n>>3&1)+(n>>4&1);t>0;t-=!r[e++]);return e+(2&n)},k=function(r){var n=r.length;return(r[n-4]|r[n-3]<<8|r[n-2]<<16)+2*(r[n-1]<<23)},A=function(r){if(8!=(15&r[0])||r[0]>>>4>7||(r[0]<<8|r[1])%31)throw"invalid zlib data";if(32&r[1])throw"invalid zlib data: preset dictionaries not supported"};function D(r,n){return F(r,n)}function T(n,e){return F(n.subarray(U(n),-8),e||new r(k(n)))}_e.gunzipSync=T;function M(r,n){return F((A(r),r.subarray(2,-4)),n)}_e.unzlibSync=M;function j(r,n){var e="";if(!n&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(r);for(var t=0;t<r.length;){var a=r[t++];a<128||n?e+=String.fromCharCode(a):a<224?e+=String.fromCharCode((31&a)<<6|63&r[t++]):a<240?e+=String.fromCharCode((15&a)<<12|(63&r[t++])<<6|63&r[t++]):(a=((15&a)<<18|(63&r[t++])<<12|(63&r[t++])<<6|63&r[t++])-65536,e+=String.fromCharCode(55296|a>>10,56320|1023&a))}return e}_e.strFromU8=j;var q=function(r,n){return n+30+E(r,n+26)+E(r,n+28)},B=function(r,n,e){var t=E(r,n+28),a=j(r.subarray(n+46,n+46+t),!(2048&E(r,n+8))),i=n+46+t,o=e?G(r,i):[O(r,n+20),O(r,n+24),O(r,n+42)],f=o[0],u=o[1],v=o[2];return[E(r,n+10),f,u,a,i+E(r,n+30)+E(r,n+32),v]},G=function(r,n){for(;1!=E(r,n);n+=4+E(r,n+2));return[O(r,n+12),O(r,n+4),O(r,n+20)]};_e.unzipSync=function(n){for(var e={},t=n.length-22;101010256!=O(n,t);--t)if(!t||n.length-t>65558)throw"invalid zip file";var a=E(n,t+8);if(!a)return{};var i=O(n,t+16),o=4294967295==i;if(o){if(t=O(n,t-12),101075792!=O(n,t))throw"invalid zip file";a=O(n,t+32),i=O(n,t+48)}for(var f=0;f<a;++f){var u=B(n,i,o),v=u[0],c=u[1],l=u[2],w=u[3],h=u[4],s=u[5],d=q(n,s);if(i=h,v){if(8!=v)throw"unknown compression type "+v;e[w]=D(n.subarray(d,d+c),new r(l))}else e[w]=S(n,d,d+c)}return e};return _e}) | true |
Other | mrdoob | three.js | 0aa0fa7dea0d600500eab5b43df30dba0321227c.json | Add license comment to fflate. | examples/jsm/libs/fflate.module.min.js | @@ -1 +1,7 @@
+/*!
+fflate - fast JavaScript compression/decompression
+<https://101arrowz.github.io/fflate>
+Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
+Subset included: synchronous unzip, gunzip, and unzlib
+*/
"use strict";var r=Uint8Array,n=Uint16Array,e=Uint32Array,t=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),a=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),i=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(r,t){for(var a=new n(31),i=0;i<31;++i)a[i]=t+=1<<r[i-1];var o=new e(a[30]);for(i=1;i<30;++i)for(var f=a[i];f<a[i+1];++f)o[f]=f-a[i]<<5|i;return[a,o]},f=o(t,2),u=f[0],v=f[1];u[28]=258,v[258]=28;for(var c=o(a,0),l=c[0],w=(c[1],new n(32768)),h=0;h<32768;++h){var s=(43690&h)>>>1|(21845&h)<<1;s=(61680&(s=(52428&s)>>>2|(13107&s)<<2))>>>4|(3855&s)<<4,w[h]=((65280&s)>>>8|(255&s)<<8)>>>1}var d=function(r,e){for(var t=r.length,a=0,i=new n(e);a<t;++a)++i[r[a]-1];var o=new n(e);for(a=0;a<e;++a)o[a]=o[a-1]+i[a-1]<<1;var f=new n(1<<e),u=15-e;for(a=0;a<t;++a)if(r[a])for(var v=a<<4|r[a],c=e-r[a],l=o[r[a]-1]++<<c,h=l|(1<<c)-1;l<=h;++l)f[w[l]>>>u]=v;return f},p=new r(288);for(h=0;h<144;++h)p[h]=8;for(h=144;h<256;++h)p[h]=9;for(h=256;h<280;++h)p[h]=7;for(h=280;h<288;++h)p[h]=8;var g=new r(32);for(h=0;h<32;++h)g[h]=5;var y=d(p,9),b=d(g,5),x=function(r){for(var n=r[0],e=1;e<r.length;++e)r[e]>n&&(n=r[e]);return n},z=function(r,n,e){var t=n/8>>0;return(r[t]|r[t+1]<<8)>>>(7&n)&e},C=function(r,n){var e=n/8>>0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>>(7&n)},m=function(r){return(r/8>>0)+(7&r&&1)},S=function(t,a,i){(null==a||a<0)&&(a=0),(null==i||i>t.length)&&(i=t.length);var o=new(t instanceof n?n:t instanceof e?e:r)(i-a);return o.set(t.subarray(a,i)),o},F=function(n,e){var o=n.length,f=!e;e||(e=new r(3*o));var v,c,w,h,s=function(n){var t=e.length;if(n>t){var a=new r(Math.max(2*t,n));a.set(e),e=a}},p=0,g=0,F=0;if(p&&!v)return e;var E=8*o;do{p=z(n,g,1);var O=z(n,g+1,3);if(g+=3,O){if(1==O)v=y,c=b,w=9,h=5;else{if(2!=O)throw"invalid block type";var U=z(n,g,31)+257,k=z(n,g+10,15)+4,A=U+z(n,g+5,31)+1;g+=14;for(var D=new r(A),T=new r(19),M=0;M<k;++M)T[i[M]]=z(n,g+3*M,7);g+=3*k;var j=x(T),q=(1<<j)-1,B=d(T,j);for(M=0;M<A;){var G=B[z(n,g,q)];if(g+=15&G,(Y=G>>>4)<16)D[M++]=Y;else{var H=0,I=0;for(16==Y?(I=3+z(n,g,3),g+=2,H=D[M-1]):17==Y?(I=3+z(n,g,7),g+=3):18==Y&&(I=11+z(n,g,127),g+=7);I--;)D[M++]=H}}var J=D.subarray(0,U),K=D.subarray(U);w=x(J),h=x(K),v=d(J,w),c=d(K,h)}if(g>E)throw"unexpected EOF";f&&s(F+131072);for(var L=(1<<w)-1,N=(1<<h)-1;;){var P=(H=v[C(n,g)&L])>>>4;if((g+=15&H)>E)throw"unexpected EOF";if(!H)throw"invalid length/literal";if(P<256)e[F++]=P;else{if(256==P)break;var Q=P-254;if(P>264){var R=t[M=P-257];Q=z(n,g,(1<<R)-1)+u[M],g+=R}var V=c[C(n,g)&N],W=V>>>4;if(!V)throw"invalid distance";g+=15&V;K=l[W];if(W>3){R=a[W];K+=C(n,g)&(1<<R)-1,g+=R}if(g>E)throw"unexpected EOF";f&&s(F+131072);for(var X=F+Q;F<X;F+=4)e[F]=e[F-K],e[F+1]=e[F+1-K],e[F+2]=e[F+2-K],e[F+3]=e[F+3-K];F=X}}}else{var Y,Z=n[(Y=m(g)+4)-4]|n[Y-3]<<8,$=Y+Z;if($>o)throw"unexpected EOF";f&&s(F+Z),e.set(n.subarray(Y,$),F),F+=Z,g=8*$}}while(!p);return F==e.length?e:S(e,0,F)},E=function(r,n){return r[n]|r[n+1]<<8},O=function(r,n){return(r[n]|r[n+1]<<8|r[n+2]<<16)+2*(r[n+3]<<23)},U=function(r){if(31!=r[0]||139!=r[1]||8!=r[2])throw"invalid gzip data";var n=r[3],e=10;4&n&&(e+=r[10]|2+(r[11]<<8));for(var t=(n>>3&1)+(n>>4&1);t>0;t-=!r[e++]);return e+(2&n)},k=function(r){var n=r.length;return(r[n-4]|r[n-3]<<8|r[n-2]<<16)+2*(r[n-1]<<23)},A=function(r){if(8!=(15&r[0])||r[0]>>>4>7||(r[0]<<8|r[1])%31)throw"invalid zlib data";if(32&r[1])throw"invalid zlib data: preset dictionaries not supported"};function D(r,n){return F(r,n)}function T(n,e){return F(n.subarray(U(n),-8),e||new r(k(n)))};export var gunzipSync=T;function M(r,n){return F((A(r),r.subarray(2,-4)),n)};export var unzlibSync=M;function j(r,n){var e="";if(!n&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(r);for(var t=0;t<r.length;){var a=r[t++];a<128||n?e+=String.fromCharCode(a):a<224?e+=String.fromCharCode((31&a)<<6|63&r[t++]):a<240?e+=String.fromCharCode((15&a)<<12|(63&r[t++])<<6|63&r[t++]):(a=((15&a)<<18|(63&r[t++])<<12|(63&r[t++])<<6|63&r[t++])-65536,e+=String.fromCharCode(55296|a>>10,56320|1023&a))}return e};export var strFromU8=j;var q=function(r,n){return n+30+E(r,n+26)+E(r,n+28)},B=function(r,n,e){var t=E(r,n+28),a=j(r.subarray(n+46,n+46+t),!(2048&E(r,n+8))),i=n+46+t,o=e?G(r,i):[O(r,n+20),O(r,n+24),O(r,n+42)],f=o[0],u=o[1],v=o[2];return[E(r,n+10),f,u,a,i+E(r,n+30)+E(r,n+32),v]},G=function(r,n){for(;1!=E(r,n);n+=4+E(r,n+2));return[O(r,n+12),O(r,n+4),O(r,n+20)]};export var unzipSync=function(n){for(var e={},t=n.length-22;101010256!=O(n,t);--t)if(!t||n.length-t>65558)throw"invalid zip file";var a=E(n,t+8);if(!a)return{};var i=O(n,t+16),o=4294967295==i;if(o){if(t=O(n,t-12),101075792!=O(n,t))throw"invalid zip file";a=O(n,t+32),i=O(n,t+48)}for(var f=0;f<a;++f){var u=B(n,i,o),v=u[0],c=u[1],l=u[2],w=u[3],h=u[4],s=u[5],d=q(n,s);if(i=h,v){if(8!=v)throw"unknown compression type "+v;e[w]=D(n.subarray(d,d+c),new r(l))}else e[w]=S(n,d,d+c)}return e} | true |
Other | mrdoob | three.js | 19dbe70f46da8bd9831da4de429b6768ac0fb92a.json | Fix objectPath formatting
Fixed objectPath formatting to support Windows PC file paths separated by "\". | utils/packLDrawModel.js | @@ -172,7 +172,7 @@ function parseObject( fileName, isRoot ) {
}
- var objectPath = path.join( prefix, fileName );
+ var objectPath = path.join( prefix, fileName ).trim().replace( /\\/g, '/' );
if ( ! objectContent ) {
| false |
Other | mrdoob | three.js | 3bc9e619f7822cf5bbd95ed8495c2063f6e26b6f.json | Remove converter scripts. | utils/converters/README.md | @@ -1,18 +0,0 @@
-Utilities for converting model files to the Three.js JSON format.
-It's necessary to install the [esm](https://www.npmjs.com/package/esm) npm package before you can use the converters.
-
-## obj2three.js
-
-Usage:
-
-```
-node -r esm obj2three.js model.obj
-```
-
-## fbx2three.js
-
-Usage:
-
-```
-node -r esm fbx2three.js model.fbx
-``` | true |
Other | mrdoob | three.js | 3bc9e619f7822cf5bbd95ed8495c2063f6e26b6f.json | Remove converter scripts. | utils/converters/fbx2three.js | @@ -1,81 +0,0 @@
-import fs from 'fs';
-import path from 'path';
-
-import { FBXLoader } from '../../examples/jsm/loaders/FBXLoader.js';
-import { ImageLoader, ImageUtils, LoaderUtils } from '../../build/three.module.js';
-
-if ( process.argv.length <= 2 ) {
-
- console.log( `Usage: ${path.basename( __filename )} model.fbx` );
- process.exit( - 1 );
-
-}
-
-//
-
-const PRECISION = 6;
-
-function parseNumber( key, value ) {
-
- return typeof value === 'number' ? parseFloat( value.toFixed( PRECISION ) ) : value;
-
-}
-
-global.window = {
- innerWidth: 1024,
- innerHeight: 768,
- URL: {
-
- createObjectURL: function () {
-
- throw new Error( 'fbx2three: Images in binary format not yet supported.' );
-
- }
-
- }
-};
-
-// HTML Images are not available, so use a Buffer instead.
-ImageLoader.prototype.load = function ( url, onLoad ) {
-
- if ( this.path !== undefined ) url = this.path + url;
-
- // If image isn't found, try to ignore it.
- if ( ! fs.existsSync( url ) ) {
-
- onLoad( new Buffer( '' ) );
- return;
-
- }
-
- onLoad( fs.readFileSync( url ) );
-
-};
-
-// Convert image buffer to data URL.
-ImageUtils.getDataURL = function ( image ) {
-
- if ( ! ( image instanceof Buffer ) ) {
-
- throw new Error( 'fbx2three: Image should be loaded as Buffer.' );
-
- }
-
- let dataURL = 'data:';
- dataURL += this.format === THREE.RGBAFormat ? 'image/png' : 'image/jpeg';
- dataURL += ';base64,';
- dataURL += image.toString( 'base64' );
- return dataURL;
-
-};
-
-//
-
-const file = process.argv[ 2 ];
-const resourceDirectory = LoaderUtils.extractUrlBase( file );
-const loader = new FBXLoader();
-
-const arraybuffer = fs.readFileSync( file ).buffer;
-const object = loader.parse( arraybuffer, resourceDirectory );
-const content = JSON.stringify( object.toJSON(), parseNumber );
-fs.writeFileSync( path.basename( file, '.fbx' ) + '.json', content, 'utf8' ); | true |
Other | mrdoob | three.js | 3bc9e619f7822cf5bbd95ed8495c2063f6e26b6f.json | Remove converter scripts. | utils/converters/obj2three.js | @@ -1,29 +0,0 @@
-import fs from 'fs';
-import path from 'path';
-
-import { OBJLoader } from '../../examples/jsm/loaders/OBJLoader.js';
-
-if ( process.argv.length <= 2 ) {
-
- console.log( "Usage: " + path.basename( __filename ) + " model.obj" );
- process.exit( - 1 );
-
-}
-
-//
-
-const PRECISION = 6;
-
-function parseNumber( key, value ) {
-
- return typeof value === 'number' ? parseFloat( value.toFixed( PRECISION ) ) : value;
-
-}
-
-const file = process.argv[ 2 ];
-const loader = new OBJLoader();
-
-const text = fs.readFileSync( file, 'utf8' );
-
-const content = JSON.stringify( loader.parse( text ).toJSON(), parseNumber );
-fs.writeFileSync( path.basename( file, '.obj' ) + '.json', content, 'utf8' ); | true |
Other | mrdoob | three.js | 528193fdac968ed7d872a5e5c6f63012b8a89ac9.json | Remove extension from node exports | package.json | @@ -10,8 +10,8 @@
"import": "./build/three.module.js",
"require": "./build/three.cjs"
},
- "./examples/jsm/*": "./examples/jsm/*.js",
- "./src/*": "./src/*.js"
+ "./examples/jsm/*": "./examples/jsm/*",
+ "./src/*": "./src/*"
},
"repository": {
"type": "git", | false |
Other | mrdoob | three.js | 98f64b0030da65117057190fb871c6be9baab811.json | Convert vertex colors to Linear from sRGB (#23340) | examples/jsm/loaders/OBJLoader.js | @@ -11,7 +11,8 @@ import {
MeshPhongMaterial,
Points,
PointsMaterial,
- Vector3
+ Vector3,
+ Color
} from 'three';
// o object_name | g group_name
@@ -30,6 +31,8 @@ const _vC = new Vector3();
const _ab = new Vector3();
const _cb = new Vector3();
+const _color = new Color();
+
function ParserState() {
const state = {
@@ -536,12 +539,13 @@ class OBJLoader extends Loader {
);
if ( data.length >= 7 ) {
- state.colors.push(
+ _color.setRGB(
parseFloat( data[ 4 ] ),
parseFloat( data[ 5 ] ),
parseFloat( data[ 6 ] )
+ ).convertSRGBToLinear();
- );
+ state.colors.push( _color.r, _color.g, _color.b );
} else {
| false |
Other | mrdoob | three.js | 484f9e24f25cceaf68fd8684e021f3e57579ab19.json | Update LICENSE (#23131) | LICENSE | @@ -1,6 +1,6 @@
The MIT License
-Copyright © 2010-2021 three.js authors
+Copyright © 2010-2022 three.js authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal | false |
Other | mrdoob | three.js | a221c4a17770c4b79ba9b4055acb3e0ba4fd4f55.json | Add isObject3D unittest (#23121) | test/unit/src/core/Object3D.tests.js | @@ -122,9 +122,13 @@ export default QUnit.module( 'Core', () => {
} );
// PUBLIC STUFF
- QUnit.todo( 'isObject3D', ( assert ) => {
+ QUnit.test( 'isObject3D', ( assert ) => {
- assert.ok( false, 'everything\'s gonna be alright' );
+ const object = new Object3D();
+ assert.ok( object.isObject3D, 'Object3D.isObject3D should be true' );
+
+ const object2 = {};
+ assert.ok( object2.isObject3D === undefined, 'other object isObject3D should be undefined' );
} );
| false |
Other | mrdoob | three.js | 0b035d06ad39b342d2169548115089de13d4d7d0.json | Add a placeholder to the examples (#23045)
* Add a placeholder to the examples
* add placeholder to coverage
* cleanup placeholder
* make it contained in index.html
* remove favicons | examples/index.html | @@ -114,6 +114,13 @@ <h1><a href="https://threejs.org">three.js</a></h1>
}
+ if ( viewer.src === '' ) {
+
+ viewer.srcdoc = document.getElementById( 'PlaceholderHTML' ).innerHTML;
+ viewer.style.display = 'unset';
+
+ }
+
filterInput.value = extractQuery();
if ( filterInput.value !== '' ) {
@@ -283,7 +290,7 @@ <h1><a href="https://threejs.org">three.js</a></h1>
if ( search ) {
- let link = sectionLink.href.split( /[?#]/ )[ 0 ];
+ const link = sectionLink.href.split( /[?#]/ )[ 0 ];
sectionLink.href = `${link}?q=${search}`;
} else {
@@ -391,6 +398,32 @@ <h1><a href="https://threejs.org">three.js</a></h1>
}
</script>
-
+ <template id="PlaceholderHTML">
+ <!DOCTYPE html>
+ <html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>three.js examples</title>
+ <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+ <link rel="stylesheet" type="text/css" href="../files/main.css">
+ <style>
+ section {
+ color: rgb(117, 117, 117);
+ padding: 1em;
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ margin-right: -50%;
+ transform: translate(-50%, -50%)
+ }
+ </style>
+ </head>
+ <body>
+ <section>
+ <p>Select an example from the sidebar.</p>
+ </section>
+ </body>
+ </html>
+ </template>
</body>
</html> | false |
Other | mrdoob | three.js | ab69febff58bc0c42920eeb0ffa514de759c531d.json | add getTypedArray unittest (#23051) | test/unit/src/utils.tests.js | @@ -1,6 +1,6 @@
/* global QUnit */
-import { arrayMin, arrayMax } from '../../../src/utils';
+import { arrayMin, arrayMax, getTypedArray } from '../../../src/utils';
QUnit.module( 'utils', () => {
@@ -29,4 +29,18 @@ QUnit.module( 'utils', () => {
} );
+ QUnit.test( 'getTypedArray', ( assert ) => {
+
+ assert.ok( getTypedArray( 'Int8Array', Buffer.from( '', 'utf8' ) ) instanceof Int8Array, 'Int8Array' );
+ assert.ok( getTypedArray( 'Uint8Array', Buffer.from( '', 'utf8' ) ) instanceof Uint8Array, 'Uint8Array' );
+ assert.ok( getTypedArray( 'Uint8ClampedArray', Buffer.from( '', 'utf8' ) ) instanceof Uint8ClampedArray, 'Uint8ClampedArray' );
+ assert.ok( getTypedArray( 'Int16Array', Buffer.from( '', 'utf8' ) ) instanceof Int16Array, 'Int16Array' );
+ assert.ok( getTypedArray( 'Uint16Array', Buffer.from( '', 'utf8' ) ) instanceof Uint16Array, 'Uint16Array' );
+ assert.ok( getTypedArray( 'Int32Array', Buffer.from( '', 'utf8' ) ) instanceof Int32Array, 'Int32Array' );
+ assert.ok( getTypedArray( 'Uint32Array', Buffer.from( '', 'utf8' ) ) instanceof Uint32Array, 'Uint32Array' );
+ assert.ok( getTypedArray( 'Float32Array', Buffer.from( '', 'utf8' ) ) instanceof Float32Array, 'Float32Array' );
+ assert.ok( getTypedArray( 'Float64Array', Buffer.from( '', 'utf8' ) ) instanceof Float64Array, 'Float64Array' );
+
+ } );
+
} ); | false |
Other | mrdoob | three.js | 9dee529ef9256719725787bdd15c31d1ed768164.json | Fix a typo related to the STEP MathNode (#23042) | examples/jsm/renderers/nodes/math/MathNode.js | @@ -187,7 +187,7 @@ class MathNode extends TempNode {
} else if ( method === MathNode.STEP ) {
params.push(
- b.build( builder, builder.getTypeLength( a.getNodeType( builder ) ) === 1 ? 'float' : inputType ),
+ a.build( builder, builder.getTypeLength( a.getNodeType( builder ) ) === 1 ? 'float' : inputType ),
b.build( builder, inputType )
);
| false |
Other | mrdoob | three.js | 2e17ddbacb5b4e994f59b418b1b82f1b1b15943c.json | Improve webgl_loader_svg.html (#23040) | examples/webgl_loader_svg.html | @@ -22,17 +22,13 @@
<script type="module">
import * as THREE from '../build/three.module.js';
-
- import Stats from './jsm/libs/stats.module.js';
-
import { GUI } from './jsm/libs/lil-gui.module.min.js';
import { OrbitControls } from './jsm/controls/OrbitControls.js';
import { SVGLoader } from './jsm/loaders/SVGLoader.js';
- let renderer, stats, scene, camera, gui, guiData;
+ let renderer, scene, camera, gui, guiData;
init();
- animate();
//
@@ -55,15 +51,11 @@
//
const controls = new OrbitControls( camera, renderer.domElement );
+ controls.addEventListener( 'change', render );
controls.screenSpacePanning = true;
//
- stats = new Stats();
- container.appendChild( stats.dom );
-
- //
-
window.addEventListener( 'resize', onWindowResize );
guiData = {
@@ -222,6 +214,8 @@
scene.add( group );
+ render();
+
} );
}
@@ -235,15 +229,6 @@
}
- function animate() {
-
- requestAnimationFrame( animate );
-
- render();
- stats.update();
-
- }
-
function render() {
renderer.render( scene, camera ); | false |
Other | mrdoob | three.js | 48a642ec2174a3d17a5302d53e88eb29983ef6f7.json | change default value of fog property | docs/api/en/materials/SpriteMaterial.html | @@ -67,7 +67,7 @@ <h3>[property:Color color]</h3>
<p>[page:Color] of the material, by default set to white (0xffffff). The [page:.map] is mutiplied by the color.</p>
<h3>[property:boolean fog]</h3>
- <p>Whether or not this material affected by the scene's fog. Default is false</p>
+ <p>Whether or not this material affected by the scene's fog. Default is true</p>
<h3>[property:Texture map]</h3>
<p>The texture map. Default is null.</p> | false |
Other | mrdoob | three.js | 5c81a64e0c48e40120dfcfa60ee3e51ea5da6bbc.json | Move extension name to EXTENSIONS dictionary | examples/js/loaders/GLTFLoader.js | @@ -333,6 +333,7 @@ THREE.GLTFLoader = ( function () {
KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',
KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: 'KHR_materials_pbrSpecularGlossiness',
KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',
+ KHR_TEXTURE_BASISU: 'KHR_texture_basisu',
KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
MSFT_TEXTURE_DDS: 'MSFT_texture_dds'
@@ -559,7 +560,7 @@ THREE.GLTFLoader = ( function () {
function GLTFTextureBasisU( parser ) {
this.parser = parser;
- this.name = "KHR_texture_basisu";
+ this.name = EXTENSIONS.KHR_TEXTURE_BASISU;
}
| true |
Other | mrdoob | three.js | 5c81a64e0c48e40120dfcfa60ee3e51ea5da6bbc.json | Move extension name to EXTENSIONS dictionary | examples/jsm/loaders/GLTFLoader.js | @@ -398,6 +398,7 @@ var GLTFLoader = ( function () {
KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',
KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: 'KHR_materials_pbrSpecularGlossiness',
KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',
+ KHR_TEXTURE_BASISU: 'KHR_texture_basisu',
KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
MSFT_TEXTURE_DDS: 'MSFT_texture_dds'
@@ -624,7 +625,7 @@ var GLTFLoader = ( function () {
function GLTFTextureBasisU( parser ) {
this.parser = parser;
- this.name = "KHR_texture_basisu";
+ this.name = EXTENSIONS.KHR_TEXTURE_BASISU;
}
| true |
Other | mrdoob | three.js | 80a9ebe566736fcb34b0c732ea4ea620c182b414.json | Set sRGB encoding. Also some clean up. | examples/webgl_materials_cubemap_dynamic.html | @@ -28,7 +28,7 @@
textureLoader.load( 'textures/2294472375_24a3b8ef46_o.jpg', function ( texture ) {
- texture.mapping = THREE.UVMapping;
+ texture.encoding = THREE.sRGBEncoding;
init( texture );
animate();
@@ -40,37 +40,45 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
+ document.body.appendChild( renderer.domElement );
+
+ renderer.outputEncoding = THREE.sRGBEncoding;
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
// background
- var options = {
- generateMipmaps: true,
- minFilter: THREE.LinearMipmapLinearFilter,
- magFilter: THREE.LinearFilter
- };
-
+ var options = {}; // none required
scene.background = new THREE.WebGLCubeRenderTarget( 1024, options ).fromEquirectangularTexture( renderer, texture );
//
- cubeRenderTarget1 = new THREE.WebGLCubeRenderTarget( 256, { format: THREE.RGBFormat, generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );
+ cubeRenderTarget1 = new THREE.WebGLCubeRenderTarget( 256, {
+ format: THREE.RGBFormat,
+ generateMipmaps: true,
+ minFilter: THREE.LinearMipmapLinearFilter,
+ encoding: THREE.sRGBEncoding // temporary -- to prevent the material's shader from recompiling every frame
+ } );
+
cubeCamera1 = new THREE.CubeCamera( 1, 1000, cubeRenderTarget1 );
- scene.add( cubeCamera1 );
- cubeRenderTarget2 = new THREE.WebGLCubeRenderTarget( 256, { format: THREE.RGBFormat, generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );
- cubeCamera2 = new THREE.CubeCamera( 1, 1000, cubeRenderTarget2 );
- scene.add( cubeCamera2 );
+ cubeRenderTarget2 = new THREE.WebGLCubeRenderTarget( 256, {
+ format: THREE.RGBFormat,
+ generateMipmaps: true,
+ minFilter: THREE.LinearMipmapLinearFilter,
+ encoding: THREE.sRGBEncoding
+ } );
- document.body.appendChild( renderer.domElement );
+ cubeCamera2 = new THREE.CubeCamera( 1, 1000, cubeRenderTarget2 );
//
material = new THREE.MeshBasicMaterial( {
- envMap: cubeRenderTarget2.texture
+ envMap: cubeRenderTarget2.texture,
+ combine: THREE.MultiplyOperation,
+ reflectivity: 1
} );
sphere = new THREE.Mesh( new THREE.IcosahedronBufferGeometry( 20, 3 ), material );
@@ -79,7 +87,7 @@
cube = new THREE.Mesh( new THREE.BoxBufferGeometry( 20, 20, 20 ), material );
scene.add( cube );
- torus = new THREE.Mesh( new THREE.TorusKnotBufferGeometry( 10, 5, 100, 25 ), material );
+ torus = new THREE.Mesh( new THREE.TorusKnotBufferGeometry( 10, 5, 128, 16 ), material );
scene.add( torus );
// | false |
Other | mrdoob | three.js | a56e9baae23cb2e2abbae73606dda1694548f29f.json | Retain filter settings | src/renderers/WebGLCubeRenderTarget.js | @@ -37,6 +37,10 @@ WebGLCubeRenderTarget.prototype.fromEquirectangularTexture = function ( renderer
this.texture.format = texture.format;
this.texture.encoding = texture.encoding;
+ this.texture.generateMipmaps = texture.generateMipmaps;
+ this.texture.minFilter = texture.minFilter;
+ this.texture.magFilter = texture.magFilter;
+
const scene = new Scene();
const shader = { | false |
Other | mrdoob | three.js | cfd945d1f8b8e88f32e9a6c02656d7a5c9d90d91.json | Set flipY to false | examples/webgl_buffergeometry_instancing_interleaved.html | @@ -109,6 +109,7 @@
var material = new THREE.MeshBasicMaterial();
material.map = new THREE.TextureLoader().load( 'textures/crate.gif' );
+ material.map.flipY = false;
// per instance data
| false |
Other | mrdoob | three.js | bb913300c78cd0b5b33c9323f1b89c4dff22456f.json | Fix loading files without BasisU extensions | examples/jsm/loaders/GLTFLoader.js | @@ -637,7 +637,7 @@ var GLTFLoader = ( function () {
if ( ! textureDef.extensions || ! textureDef.extensions[ this.name ] ) {
- return Promise.resolve();
+ return null;
}
@@ -2078,7 +2078,6 @@ var GLTFLoader = ( function () {
var parser = this;
var json = this.json;
var options = this.options;
- var textureLoader = this.textureLoader;
var textureDef = json.textures[ textureIndex ];
@@ -2096,7 +2095,7 @@ var GLTFLoader = ( function () {
}
- return loadTextureImage( textureIndex, source );
+ return this.loadTextureImage( textureIndex, source );
};
GLTFParser.prototype.loadTextureImage = function ( textureIndex, source, loaderOverride ) {
@@ -2105,7 +2104,10 @@ var GLTFLoader = ( function () {
var json = this.json;
var options = this.options;
+ var textureLoader = this.textureLoader;
+
var textureDef = json.textures[ textureIndex ];
+ var textureExtensions = textureDef.extensions || {};
var URL = self.URL || self.webkitURL;
@@ -2203,7 +2205,6 @@ var GLTFLoader = ( function () {
};
-
/**
* Asynchronously assigns a texture to the given material parameters.
* @param {Object} materialParams | false |
Other | mrdoob | three.js | e76ae5cf4cb31b428f178ed8f0d775cb16874354.json | Update chinese docs with corresponding text. | docs/api/zh/extras/core/CurvePath.html | @@ -50,7 +50,7 @@ <h3>[method:null closePath]()</h3>
<p>添加一条[page:LineCurve lineCurve]用于闭合路径。</p>
<h3>[method:Array getCurveLengths]()</h3>
- <p>将[page:.curves]数组中曲线的长度相加。</p>
+ <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> | false |
Other | mrdoob | three.js | 71c8b3f6cbf8da5d1939608314002b70a3d4a2d7.json | Map more surfaces as horizontal-like (#21875) | src/geometries/ExtrudeGeometry.js | @@ -731,7 +731,7 @@ const WorldUVGenerator = {
const d_y = vertices[ indexD * 3 + 1 ];
const d_z = vertices[ indexD * 3 + 2 ];
- if ( Math.abs( a_y - b_y ) < 0.01 ) {
+ if ( Math.abs( a_y - b_y ) < Math.abs( a_x - b_x ) ) {
return [
new Vector2( a_x, 1 - a_z ), | false |
Other | mrdoob | three.js | 6ae46407ec2b17c63759acdb72d6d3b4a7924697.json | Update Spherical.html (#21873) | docs/api/zh/math/Spherical.html | @@ -19,10 +19,10 @@ <h3>[name]( [param:Float radius], [param:Float phi], [param:Float theta] )</h3>
<p>
[page:Float radius] - 半径值,或者说从该点到原点的
[link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance](欧几里得距离,即直线距离)。默认值为*1.0*。<br />
- [page:Float phi] - polar angle in radians from the y (up) axis. Default is *0*.<br />
- [page:Float theta] - equator angle in radians around the y (up) axis. Default is *0*.<br /><br />
+ [page:Float phi] - 与 y (up) 轴的极坐标角(以弧度为单位)。 默认值为 *0*。<br />
+ [page:Float theta] - 绕 y (up) 轴的赤道角(以弧度为单位)。 默认值为 *0*。<br /><br />
- The poles (phi) are at the positive and negative y axis. The equator (theta) starts at positive z.
+ 极点(φ phi)位于正 y 轴和负 y 轴上。赤道(θ theta)从正 z 开始。
</p>
| false |
Other | mrdoob | three.js | 09a68603cda2e17bf1a60988fa124132ee5f86fa.json | Update GLTFExporter.js (#21858)
* Update GLTFExporter.js
* Update GLTFExporter.js | examples/js/exporters/GLTFExporter.js | @@ -1080,7 +1080,7 @@
if ( material.emissive ) {
- // emissiveFactor
+ // note: `emissive` is not scaled by `material.emissiveIntensity` for now to accommodate glTF spec. see #21849.
const emissive = material.emissive.toArray();
if ( ! equalArray( emissive, [ 0, 0, 0 ] ) ) { | true |
Other | mrdoob | three.js | 09a68603cda2e17bf1a60988fa124132ee5f86fa.json | Update GLTFExporter.js (#21858)
* Update GLTFExporter.js
* Update GLTFExporter.js | examples/jsm/exporters/GLTFExporter.js | @@ -1176,7 +1176,7 @@ class GLTFWriter {
if ( material.emissive ) {
- // emissiveFactor
+ // note: `emissive` is not scaled by `material.emissiveIntensity` for now to accommodate glTF spec. see #21849.
const emissive = material.emissive.toArray();
if ( ! equalArray( emissive, [ 0, 0, 0 ] ) ) { | true |
Other | mrdoob | three.js | 39bff4a955304d23f6de79edabd712acbac9e6da.json | Respect morph targets in OutlinePass (#21836) | examples/js/postprocessing/OutlinePass.js | @@ -395,7 +395,7 @@
#include <project_vertex>
vPosition = mvPosition;
- vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
+ vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );
projTexCoord = textureMatrix * worldPosition;
}`, | true |
Other | mrdoob | three.js | 39bff4a955304d23f6de79edabd712acbac9e6da.json | Respect morph targets in OutlinePass (#21836) | examples/jsm/postprocessing/OutlinePass.js | @@ -453,7 +453,7 @@ class OutlinePass extends Pass {
#include <project_vertex>
vPosition = mvPosition;
- vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
+ vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );
projTexCoord = textureMatrix * worldPosition;
}`, | true |
Other | mrdoob | three.js | 9e22a6a250fada8e4c6eae57355e76709f5ecbd7.json | Update Core.html (#24422) | docs/api/en/constants/Core.html | @@ -50,6 +50,14 @@ <h2>Mouse Buttons</h2>
THREE.MOUSE.RIGHT
</code>
+ <h2>Touch Actions</h2>
+ <code>
+THREE.TOUCH.ROTATE
+THREE.TOUCH.PAN
+THREE.TOUCH.DOLLY_PAN
+THREE.TOUCH.DOLLY_ROTATE
+ </code>
+
<h2>Source</h2>
<p> | false |
Other | mrdoob | three.js | 920a716c719f79ec0705d777c7e174513dcbd4f6.json | Add @deprecated to RGBFormat (#24426)
* Update constants.js
* Update constants.js
Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org> | src/constants.js | @@ -85,7 +85,7 @@ export const UnsignedShort4444Type = 1017;
export const UnsignedShort5551Type = 1018;
export const UnsignedInt248Type = 1020;
export const AlphaFormat = 1021;
-export const RGBFormat = 1022;
+export const RGBFormat = 1022; // @deprecated since r137
export const RGBAFormat = 1023;
export const LuminanceFormat = 1024;
export const LuminanceAlphaFormat = 1025; | false |
Other | mrdoob | three.js | a907060783c020581eaeedd6cde05cbb6c0e0802.json | Update MaterialLoader.js (#24402)
Adding the field glslVersion | src/loaders/MaterialLoader.js | @@ -225,6 +225,7 @@ class MaterialLoader extends Loader {
if ( json.defines !== undefined ) material.defines = json.defines;
if ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;
if ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;
+ if ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;
if ( json.extensions !== undefined ) {
| false |
Other | mrdoob | three.js | 03f35a96ae36507a2d234f6f0726dd64393ee49d.json | Remove workaround for Adreno (#24399) | examples/jsm/nodes/math/MathNode.js | @@ -1,6 +1,5 @@
import TempNode from '../core/TempNode.js';
import ExpressionNode from '../core/ExpressionNode.js';
-import JoinNode from '../utils/JoinNode.js';
import SplitNode from '../utils/SplitNode.js';
import OperatorNode from './OperatorNode.js';
@@ -131,17 +130,7 @@ class MathNode extends TempNode {
const isWebGL = builder.renderer.isWebGLRenderer === true;
- if ( isWebGL && ( method === MathNode.DFDX || method === MathNode.DFDY ) && output === 'vec3' ) {
-
- // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
-
- return new JoinNode( [
- new MathNode( method, new SplitNode( a, 'x' ) ),
- new MathNode( method, new SplitNode( a, 'y' ) ),
- new MathNode( method, new SplitNode( a, 'z' ) )
- ] ).build( builder );
-
- } else if ( method === MathNode.TRANSFORM_DIRECTION ) {
+ if ( method === MathNode.TRANSFORM_DIRECTION ) {
// dir can be either a direction vector or a normal vector
// upper-left 3x3 of matrix is assumed to be orthogonal | false |
Other | mrdoob | three.js | d9a8da2290719e6224104ebd55ab71b38e578d74.json | Remove workaround for Adreno bug (#24390) | src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js | @@ -24,11 +24,9 @@ export default /* glsl */`
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
- // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
-
- vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
- vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
- vec3 vN = surf_norm; // normalized
+ vec3 vSigmaX = dFdx( surf_pos.xyz );
+ vec3 vSigmaY = dFdy( surf_pos.xyz );
+ vec3 vN = surf_norm; // normalized
vec3 R1 = cross( vSigmaY, vN );
vec3 R2 = cross( vN, vSigmaX ); | true |
Other | mrdoob | three.js | d9a8da2290719e6224104ebd55ab71b38e578d74.json | Remove workaround for Adreno bug (#24390) | src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js | @@ -19,10 +19,8 @@ export default /* glsl */`
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
- // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
-
- vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
- vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
+ vec3 q0 = dFdx( eye_pos.xyz );
+ vec3 q1 = dFdy( eye_pos.xyz );
vec2 st0 = dFdx( vUv.st );
vec2 st1 = dFdy( vUv.st );
| true |
Other | mrdoob | three.js | 96bc672f4b17482b3a8e20680aaf723def1933b1.json | Simplify implementation of PlaneHelper (#24378)
* Simplify implementation of PlaneHelper
* Remove unnecessary include file | src/helpers/PlaneHelper.js | @@ -4,15 +4,14 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
import { MeshBasicMaterial } from '../materials/MeshBasicMaterial.js';
import { Float32BufferAttribute } from '../core/BufferAttribute.js';
import { BufferGeometry } from '../core/BufferGeometry.js';
-import { FrontSide, BackSide } from '../constants.js';
class PlaneHelper extends Line {
constructor( plane, size = 1, hex = 0xffff00 ) {
const color = hex;
- const positions = [ 1, - 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0 ];
+ const positions = [ 1, - 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, - 1, 0, 1, 1, 0 ];
const geometry = new BufferGeometry();
geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
@@ -26,7 +25,7 @@ class PlaneHelper extends Line {
this.size = size;
- const positions2 = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, - 1, 1, 1, - 1, 1 ];
+ const positions2 = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ];
const geometry2 = new BufferGeometry();
geometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );
@@ -38,16 +37,14 @@ class PlaneHelper extends Line {
updateMatrixWorld( force ) {
- let scale = - this.plane.constant;
+ this.position.set( 0, 0, 0 );
- if ( Math.abs( scale ) < 1e-8 ) scale = 1e-8; // sign does not matter
-
- this.scale.set( 0.5 * this.size, 0.5 * this.size, scale );
-
- this.children[ 0 ].material.side = ( scale < 0 ) ? BackSide : FrontSide; // renderer flips side when determinant < 0; flipping not wanted here
+ this.scale.set( 0.5 * this.size, 0.5 * this.size, 1 );
this.lookAt( this.plane.normal );
+ this.translateZ( - this.plane.constant );
+
super.updateMatrixWorld( force );
} | false |
Other | mrdoob | three.js | a7de96e860559468081f752bee37220a307f8f73.json | fix property (#23658) | examples/jsm/controls/TrackballControls.js | @@ -703,7 +703,7 @@ class TrackballControls extends EventDispatcher {
case 2:
_state = STATE.TOUCH_ZOOM_PAN;
- _moveCurr.copy( getMouseOnCircle( event.pageX - _movePrev.pageX, event.pageY - _movePrev.pageY ) );
+ _moveCurr.copy( getMouseOnCircle( event.pageX - _movePrev.x, event.pageY - _movePrev.y ) );
_movePrev.copy( _moveCurr );
break;
| false |
Other | mrdoob | three.js | ac69703e278a5c1326f62bf02f61db19f847c391.json | Add buffer() function (#23656) | examples/jsm/nodes/ShaderNode.js | @@ -5,6 +5,7 @@ import AttributeNode from './core/AttributeNode.js';
// input nodes
import BoolNode from './inputs/BoolNode.js';
+import BufferNode from './inputs/BufferNode.js';
import ColorNode from './inputs/ColorNode.js';
import FloatNode from './inputs/FloatNode.js';
import IntNode from './inputs/IntNode.js';
@@ -285,6 +286,7 @@ export const addTo = ( varNode, ...params ) => {
export const uv = new ShaderNodeProxy( UVNode );
export const attribute = new ShaderNodeProxy( AttributeNode );
+export const buffer = new ShaderNodeProxy( BufferNode );
export const texture = new ShaderNodeProxy( TextureNode );
export const add = new ShaderNodeProxy( OperatorNode, '+' ); | false |
Other | mrdoob | three.js | a65c32328f7ac4c602079ca51078e3e4fee3123e.json | Fix normalized morph color attribute (#23654) | src/renderers/webgl/WebGLMorphtargets.js | @@ -139,7 +139,7 @@ function WebGLMorphtargets( gl, capabilities, textures ) {
morph.fromBufferAttribute( morphColor, j );
- if ( morphColor.normalized === true ) denormalize( morph, morphNormal );
+ if ( morphColor.normalized === true ) denormalize( morph, morphColor );
buffer[ offset + stride + 8 ] = morph.x;
buffer[ offset + stride + 9 ] = morph.y; | false |
Other | mrdoob | three.js | 8323901ec2af183d9361d7c50c5d45e731792798.json | Add BoolNode and UintNode (#23636) | examples/jsm/nodes/ShaderNode.js | @@ -4,9 +4,11 @@ import VarNode from './core/VarNode.js';
import AttributeNode from './core/AttributeNode.js';
// input nodes
+import BoolNode from './inputs/BoolNode.js';
import ColorNode from './inputs/ColorNode.js';
import FloatNode from './inputs/FloatNode.js';
import IntNode from './inputs/IntNode.js';
+import UintNode from './inputs/UintNode.js';
import Vector2Node from './inputs/Vector2Node.js';
import Vector3Node from './inputs/Vector3Node.js';
import Vector4Node from './inputs/Vector4Node.js';
@@ -259,6 +261,8 @@ const ConvertType = function ( nodeClass, type, valueClass = null, valueComponen
export const float = new ConvertType( FloatNode, 'float' );
export const int = new ConvertType( IntNode, 'int' );
+export const uint = new ConvertType( UintNode, 'uint' );
+export const bool = new ConvertType( BoolNode, 'bool' );
export const color = new ConvertType( ColorNode, 'color', Color );
export const vec2 = new ConvertType( Vector2Node, 'vec2', Vector2, 2 ); | true |
Other | mrdoob | three.js | 8323901ec2af183d9361d7c50c5d45e731792798.json | Add BoolNode and UintNode (#23636) | examples/jsm/nodes/core/NodeBuilder.js | @@ -155,7 +155,10 @@ class NodeBuilder {
// rename to generate
getConst( type, value ) {
- if ( type === 'float' ) return value + ( value % 1 ? '' : '.0' );
+ if ( type === 'float' ) return toFloat( value );
+ if ( type === 'int' ) return `${ Math.round( value ) }`;
+ if ( type === 'uint' ) return ( value >= 0 ) ? `${ Math.round( value ) }` : '0';
+ if ( type === 'bool' ) return value ? 'true' : 'false';
if ( type === 'vec2' ) return `${ this.getType( 'vec2' ) }( ${ toFloat( value.x ) }, ${ toFloat( value.y ) } )`;
if ( type === 'vec3' ) return `${ this.getType( 'vec3' ) }( ${ toFloat( value.x ) }, ${ toFloat( value.y ) }, ${ toFloat( value.z ) } )`;
if ( type === 'vec4' ) return `${ this.getType( 'vec4' ) }( ${ toFloat( value.x ) }, ${ toFloat( value.y ) }, ${ toFloat( value.z ) }, ${ toFloat( value.w ) } )`;
@@ -275,7 +278,7 @@ class NodeBuilder {
const vecNum = /vec([2-4])/.exec( vecType );
if ( vecNum !== null ) return Number( vecNum[ 1 ] );
- if ( vecType === 'float' || vecType === 'bool' ) return 1;
+ if ( vecType === 'float' || vecType === 'bool' || vecType === 'int' || vecType === 'uint' ) return 1;
return 0;
@@ -600,37 +603,65 @@ class NodeBuilder {
switch ( typeToType ) {
case 'int to float' : return `${ this.getType( 'float' ) }( ${ snippet } )`;
+ case 'int to uint' : return `${ this.getType( 'uint' ) }( ${ snippet } )`;
+ case 'int to bool' : return `${ this.getType( 'bool' ) }( ${ snippet } )`;
case 'int to vec2' : return `${ this.getType( 'vec2' ) }( ${ this.getType( 'float' ) }( ${ snippet } ) )`;
case 'int to vec3' : return `${ this.getType( 'vec3' ) }( ${ this.getType( 'float' ) }( ${ snippet } ) )`;
case 'int to vec4' : return `${ this.getType( 'vec4' ) }( ${ this.getType( 'vec3' ) }( ${ this.getType( 'float' ) }( ${ snippet } ) ), 1.0 )`;
+ case 'uint to float' : return `${ this.getType( 'float' ) }( ${ snippet } )`;
+ case 'uint to int' : return `${ this.getType( 'int' ) }( ${ snippet } )`;
+ case 'uint to bool' : return `${ this.getType( 'bool' ) }( ${ snippet } )`;
+ case 'uint to vec2' : return `${ this.getType( 'vec2' ) }( ${ this.getType( 'float' ) }( ${ snippet } ) )`;
+ case 'uint to vec3' : return `${ this.getType( 'vec3' ) }( ${ this.getType( 'float' ) }( ${ snippet } ) )`;
+ case 'uint to vec4' : return `${ this.getType( 'vec4' ) }( ${ this.getType( 'vec3' ) }( ${ this.getType( 'float' ) }( ${ snippet } ) ), 1.0 )`;
+
+ case 'bool to float' : return `${ this.getType( 'float' ) }( ${ snippet } )`;
+ case 'bool to int' : return `${ this.getType( 'int' ) }( ${ snippet } )`;
+ case 'bool to uint' : return `${ this.getType( 'uint' ) }( ${ snippet } )`;
+ case 'bool to vec2' : return `${ this.getType( 'vec2' ) }( ${ this.getType( 'float' ) }( ${ snippet } ) )`;
+ case 'bool to vec3' : return `${ this.getType( 'vec3' ) }( ${ this.getType( 'float' ) }( ${ snippet } ) )`;
+ case 'bool to vec4' : return `${ this.getType( 'vec4' ) }( ${ this.getType( 'vec3' ) }( ${ this.getType( 'float' ) }( ${ snippet } ) ), 1.0 )`;
+
case 'float to int' : return `${ this.getType( 'int' ) }( ${ snippet } )`;
+ case 'float to uint' : return `${ this.getType( 'uint' ) }( ${ snippet } )`;
+ case 'float to bool' : return `${ this.getType( 'bool' ) }( ${ snippet } )`;
case 'float to vec2' : return `${ this.getType( 'vec2' ) }( ${ snippet } )`;
case 'float to vec3' : return `${ this.getType( 'vec3' ) }( ${ snippet } )`;
case 'float to vec4' : return `${ this.getType( 'vec4' ) }( ${ this.getType( 'vec3' ) }( ${ snippet } ), 1.0 )`;
case 'vec2 to int' : return `${ this.getType( 'int' ) }( ${ snippet }.x )`;
+ case 'vec2 to uint' : return `${ this.getType( 'uint' ) }( ${ snippet }.x )`;
+ case 'vec2 to bool' : return `${ this.getType( 'bool' ) }( ${ snippet }.x )`;
case 'vec2 to float' : return `${ snippet }.x`;
case 'vec2 to vec3' : return `${ this.getType( 'vec3' ) }( ${ snippet }, 0.0 )`;
case 'vec2 to vec4' : return `${ this.getType( 'vec4' ) }( ${ snippet }.xy, 0.0, 1.0 )`;
case 'vec3 to int' : return `${ this.getType( 'int' ) }( ${ snippet }.x )`;
+ case 'vec3 to uint' : return `${ this.getType( 'uint' ) }( ${ snippet }.x )`;
+ case 'vec3 to bool' : return `${ this.getType( 'bool' ) }( ${ snippet }.x )`;
case 'vec3 to float' : return `${ snippet }.x`;
case 'vec3 to vec2' : return `${ snippet }.xy`;
case 'vec3 to vec4' : return `${ this.getType( 'vec4' ) }( ${ snippet }, 1.0 )`;
case 'vec4 to int' : return `${ this.getType( 'int' ) }( ${ snippet }.x )`;
+ case 'vec4 to uint' : return `${ this.getType( 'uint' ) }( ${ snippet }.x )`;
+ case 'vec4 to bool' : return `${ this.getType( 'bool' ) }( ${ snippet }.x )`;
case 'vec4 to float' : return `${ snippet }.x`;
case 'vec4 to vec2' : return `${ snippet }.xy`;
case 'vec4 to vec3' : return `${ snippet }.xyz`;
- case 'mat3 to int' : return `${ this.getType( 'int' ) }( ${ snippet } * ${ this.getType( 'vec3' ) }( 1.0 ) ).x`;
+ case 'mat3 to int' : return `${ this.getType( 'int' ) }( ( ${ snippet } * ${ this.getType( 'vec3' ) }( 1.0 ) ).x )`;
+ case 'mat3 to uint' : return `${ this.getType( 'uint' ) }( ( ${ snippet } * ${ this.getType( 'vec3' ) }( 1.0 ) ).x )`;
+ case 'mat3 to bool' : return `${ this.getType( 'bool' ) }( ( ${ snippet } * ${ this.getType( 'vec3' ) }( 1.0 ) ).x )`;
case 'mat3 to float' : return `( ${ snippet } * ${ this.getType( 'vec3' ) }( 1.0 ) ).x`;
case 'mat3 to vec2' : return `( ${ snippet } * ${ this.getType( 'vec3' ) }( 1.0 ) ).xy`;
case 'mat3 to vec3' : return `( ${ snippet } * ${ this.getType( 'vec3' ) }( 1.0 ) ).xyz`;
case 'mat3 to vec4' : return `${ this.getType( 'vec4' ) }( ${ snippet } * ${ this.getType( 'vec3' ) }( 1.0 ), 1.0 )`;
- case 'mat4 to int' : return `${ this.getType( 'int' ) }( ${ snippet } * ${ this.getType( 'vec4' ) }( 1.0 ) ).x`;
+ case 'mat4 to int' : return `${ this.getType( 'int' ) }( ( ${ snippet } * ${ this.getType( 'vec4' ) }( 1.0 ) ).x )`;
+ case 'mat4 to uint' : return `${ this.getType( 'uint' ) }( ( ${ snippet } * ${ this.getType( 'vec4' ) }( 1.0 ) ).x )`;
+ case 'mat4 to bool' : return `${ this.getType( 'bool' ) }( ( ${ snippet } * ${ this.getType( 'vec4' ) }( 1.0 ) ).x )`;
case 'mat4 to float' : return `( ${ snippet } * ${ this.getType( 'vec4' ) }( 1.0 ) ).x`;
case 'mat4 to vec2' : return `( ${ snippet } * ${ this.getType( 'vec4' ) }( 1.0 ) ).xy`;
case 'mat4 to vec3' : return `( ${ snippet } * ${ this.getType( 'vec4' ) }( 1.0 ) ).xyz`; | true |
Other | mrdoob | three.js | 8323901ec2af183d9361d7c50c5d45e731792798.json | Add BoolNode and UintNode (#23636) | examples/jsm/nodes/inputs/BoolNode.js | @@ -0,0 +1,33 @@
+import InputNode from '../core/InputNode.js';
+
+class BoolNode extends InputNode {
+
+ constructor( value = false ) {
+
+ super( 'bool' );
+
+ this.value = value;
+
+ }
+
+ serialize( data ) {
+
+ super.serialize( data );
+
+ data.value = this.value;
+
+ }
+
+ deserialize( data ) {
+
+ super.serialize( data );
+
+ this.value = data.value;
+
+ }
+
+}
+
+BoolNode.prototype.isBoolNode = true;
+
+export default BoolNode; | true |
Other | mrdoob | three.js | 8323901ec2af183d9361d7c50c5d45e731792798.json | Add BoolNode and UintNode (#23636) | examples/jsm/nodes/inputs/UintNode.js | @@ -0,0 +1,33 @@
+import InputNode from '../core/InputNode.js';
+
+class UintNode extends InputNode {
+
+ constructor( value = 0 ) {
+
+ super( 'uint' );
+
+ this.value = value;
+
+ }
+
+ serialize( data ) {
+
+ super.serialize( data );
+
+ data.value = this.value;
+
+ }
+
+ deserialize( data ) {
+
+ super.serialize( data );
+
+ this.value = data.value;
+
+ }
+
+}
+
+UintNode.prototype.isUintNode = true;
+
+export default UintNode; | true |
Other | mrdoob | three.js | 8323901ec2af183d9361d7c50c5d45e731792798.json | Add BoolNode and UintNode (#23636) | examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js | @@ -31,6 +31,8 @@ import { getRoughness } from 'three-nodes/functions/PhysicalMaterialFunctions.js
const wgslTypeLib = {
float: 'f32',
int: 'i32',
+ uint: 'u32',
+ bool: 'bool',
vec2: 'vec2<f32>',
vec3: 'vec3<f32>',
vec4: 'vec4<f32>', | true |
Other | mrdoob | three.js | 6fb8b456657239afd9fabde4ff78dc5905f7e368.json | remove eslint errors in docs folder (#22941) | docs/index.html | @@ -404,7 +404,7 @@ <h1><a href="https://threejs.org">three.js</a></h1>
if ( search ) {
- let link = sectionLink.href.split( /[?#]/ )[ 0 ];
+ const link = sectionLink.href.split( /[?#]/ )[ 0 ];
sectionLink.href = `${link}?q=${search}`;
} else {
@@ -458,7 +458,7 @@ <h1><a href="https://threejs.org">three.js</a></h1>
// Routing
- function setUrlFragment( pageName ) { // eslint-disable-line no-undef
+ function setUrlFragment( pageName ) { // eslint-disable-line no-unused-vars
// Handle navigation from the subpages (iframes):
// First separate the member (if existing) from the page name, | true |
Other | mrdoob | three.js | 6fb8b456657239afd9fabde4ff78dc5905f7e368.json | remove eslint errors in docs folder (#22941) | docs/scenes/bones-browser.html | @@ -42,7 +42,7 @@
Vector3,
Uint16BufferAttribute,
WebGLRenderer
- } from "../../build/three.module.js";
+ } from '../../build/three.module.js';
import { GUI } from '../../examples/jsm/libs/lil-gui.module.min.js';
import { OrbitControls } from '../../examples/jsm/controls/OrbitControls.js';
@@ -52,6 +52,7 @@
const state = {
animateBones: false
};
+
function initScene() {
@@ -186,21 +187,21 @@
function setupDatGui() {
- let folder = gui.addFolder( "General Options" );
+ let folder = gui.addFolder( 'General Options' );
- folder.add( state, "animateBones" );
- folder.controllers[ 0 ].name( "Animate Bones" );
+ folder.add( state, 'animateBones' );
+ folder.controllers[ 0 ].name( 'Animate Bones' );
- folder.add( mesh, "pose" );
- folder.controllers[ 1 ].name( ".pose()" );
+ folder.add( mesh, 'pose' );
+ folder.controllers[ 1 ].name( '.pose()' );
const bones = mesh.skeleton.bones;
for ( let i = 0; i < bones.length; i ++ ) {
const bone = bones[ i ];
- folder = gui.addFolder( "Bone " + i );
+ folder = gui.addFolder( 'Bone ' + i );
folder.add( bone.position, 'x', - 10 + bone.position.x, 10 + bone.position.x );
folder.add( bone.position, 'y', - 10 + bone.position.y, 10 + bone.position.y );
@@ -214,17 +215,17 @@
folder.add( bone.scale, 'y', 0, 2 );
folder.add( bone.scale, 'z', 0, 2 );
- folder.controllers[ 0 ].name( "position.x" );
- folder.controllers[ 1 ].name( "position.y" );
- folder.controllers[ 2 ].name( "position.z" );
+ folder.controllers[ 0 ].name( 'position.x' );
+ folder.controllers[ 1 ].name( 'position.y' );
+ folder.controllers[ 2 ].name( 'position.z' );
- folder.controllers[ 3 ].name( "rotation.x" );
- folder.controllers[ 4 ].name( "rotation.y" );
- folder.controllers[ 5 ].name( "rotation.z" );
+ folder.controllers[ 3 ].name( 'rotation.x' );
+ folder.controllers[ 4 ].name( 'rotation.y' );
+ folder.controllers[ 5 ].name( 'rotation.z' );
- folder.controllers[ 6 ].name( "scale.x" );
- folder.controllers[ 7 ].name( "scale.y" );
- folder.controllers[ 8 ].name( "scale.z" );
+ folder.controllers[ 6 ].name( 'scale.x' );
+ folder.controllers[ 7 ].name( 'scale.y' );
+ folder.controllers[ 8 ].name( 'scale.z' );
}
| true |
Other | mrdoob | three.js | b63ffffb6bb7f2fde9160d775b25d288926f7cf5.json | fix recent webxr changes (#22918) | src/renderers/webxr/WebXRManager.js | @@ -13,9 +13,10 @@ import {
DepthStencilFormat,
RGBAFormat,
RGBFormat,
+ sRGBEncoding,
UnsignedByteType,
UnsignedShortType,
- UnsignedInt248Type,
+ UnsignedInt248Type
} from '../../constants.js';
class WebXRManager extends EventDispatcher {
@@ -269,7 +270,7 @@ class WebXRManager extends EventDispatcher {
if ( attributes.depth ) {
- glDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT16;
+ glDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;
depthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;
depthType = attributes.stencil ? UnsignedInt248Type : UnsignedShortType;
@@ -299,6 +300,7 @@ class WebXRManager extends EventDispatcher {
stencilBuffer: attributes.stencil,
ignoreDepth: glProjLayer.ignoreDepthValues,
useRenderToTexture: hasMultisampledRenderToTexture,
+ encoding: sRGBEncoding
} );
} else {
@@ -312,6 +314,7 @@ class WebXRManager extends EventDispatcher {
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
stencilBuffer: attributes.stencil,
ignoreDepth: glProjLayer.ignoreDepthValues,
+ encoding: sRGBEncoding
} );
} | false |
Other | mrdoob | three.js | c748762b7e2fd7fff6882e7c08402633edda8137.json | Introduce FramebufferTexture. (#22916) | examples/jsm/objects/Lensflare.js | @@ -2,14 +2,12 @@ import {
AdditiveBlending,
Box2,
BufferGeometry,
- ClampToEdgeWrapping,
Color,
- DataTexture,
+ FramebufferTexture,
InterleavedBuffer,
InterleavedBufferAttribute,
Mesh,
MeshBasicMaterial,
- NearestFilter,
RGBFormat,
RawShaderMaterial,
Vector2,
@@ -34,17 +32,8 @@ class Lensflare extends Mesh {
// textures
- const tempMap = new DataTexture( new Uint8Array( 16 * 16 * 3 ), 16, 16, RGBFormat );
- tempMap.minFilter = NearestFilter;
- tempMap.magFilter = NearestFilter;
- tempMap.wrapS = ClampToEdgeWrapping;
- tempMap.wrapT = ClampToEdgeWrapping;
-
- const occlusionMap = new DataTexture( new Uint8Array( 16 * 16 * 3 ), 16, 16, RGBFormat );
- occlusionMap.minFilter = NearestFilter;
- occlusionMap.magFilter = NearestFilter;
- occlusionMap.wrapS = ClampToEdgeWrapping;
- occlusionMap.wrapT = ClampToEdgeWrapping;
+ const tempMap = new FramebufferTexture( 16, 16, RGBFormat );
+ const occlusionMap = new FramebufferTexture( 16, 16, RGBFormat );
// material
| true |
Other | mrdoob | three.js | c748762b7e2fd7fff6882e7c08402633edda8137.json | Introduce FramebufferTexture. (#22916) | examples/jsm/utils/RoughnessMipmapper.js | @@ -14,7 +14,8 @@ import {
PlaneGeometry,
RawShaderMaterial,
Vector2,
- WebGLRenderTarget
+ WebGLRenderTarget,
+ FramebufferTexture
} from '../../../build/three.module.js';
const _mipmapMaterial = _getMipmapMaterial();
@@ -68,42 +69,27 @@ class RoughnessMipmapper {
}
- if ( width !== roughnessMap.image.width || height !== roughnessMap.image.height ) {
+ const newRoughnessTexture = new FramebufferTexture( width, height, roughnessMap.format );
+ newRoughnessTexture.wrapS = roughnessMap.wrapS;
+ newRoughnessTexture.wrapT = roughnessMap.wrapT;
+ newRoughnessTexture.minFilter = roughnessMap.minFilter;
+ newRoughnessTexture.magFilter = roughnessMap.magFilter;
- const params = {
- wrapS: roughnessMap.wrapS,
- wrapT: roughnessMap.wrapT,
- magFilter: roughnessMap.magFilter,
- minFilter: roughnessMap.minFilter,
- depthBuffer: false
- };
+ material.roughnessMap = newRoughnessTexture;
- const newRoughnessTarget = new WebGLRenderTarget( width, height, params );
+ if ( material.metalnessMap == roughnessMap ) material.metalnessMap = material.roughnessMap;
- newRoughnessTarget.texture.generateMipmaps = true;
+ if ( material.aoMap == roughnessMap ) material.aoMap = material.roughnessMap;
- // Setting the render target causes the memory to be allocated.
+ // Copy UV transform parameters
- _renderer.setRenderTarget( newRoughnessTarget );
+ material.roughnessMap.offset.copy( roughnessMap.offset );
+ material.roughnessMap.repeat.copy( roughnessMap.repeat );
+ material.roughnessMap.center.copy( roughnessMap.center );
+ material.roughnessMap.rotation = roughnessMap.rotation;
- material.roughnessMap = newRoughnessTarget.texture;
-
- if ( material.metalnessMap == roughnessMap ) material.metalnessMap = material.roughnessMap;
-
- if ( material.aoMap == roughnessMap ) material.aoMap = material.roughnessMap;
-
- // Copy UV transform parameters
-
- material.roughnessMap.offset.copy( roughnessMap.offset );
- material.roughnessMap.repeat.copy( roughnessMap.repeat );
- material.roughnessMap.center.copy( roughnessMap.center );
- material.roughnessMap.rotation = roughnessMap.rotation;
- material.roughnessMap.image = roughnessMap.image;
-
- material.roughnessMap.matrixAutoUpdate = roughnessMap.matrixAutoUpdate;
- material.roughnessMap.matrix.copy( roughnessMap.matrix );
-
- }
+ material.roughnessMap.matrixAutoUpdate = roughnessMap.matrixAutoUpdate;
+ material.roughnessMap.matrix.copy( roughnessMap.matrix );
_mipmapMaterial.uniforms.roughnessMap.value = roughnessMap;
@@ -133,8 +119,6 @@ class RoughnessMipmapper {
_renderer.copyFramebufferToTexture( position, material.roughnessMap, mip );
- _mipmapMaterial.uniforms.roughnessMap.value = material.roughnessMap;
-
}
if ( roughnessMap !== material.roughnessMap ) roughnessMap.dispose(); | true |
Other | mrdoob | three.js | c748762b7e2fd7fff6882e7c08402633edda8137.json | Introduce FramebufferTexture. (#22916) | examples/webgl_framebuffer_texture.html | @@ -95,9 +95,7 @@
//
- const data = new Uint8Array( textureSize * textureSize * 3 );
-
- texture = new THREE.DataTexture( data, textureSize, textureSize, THREE.RGBFormat );
+ texture = new THREE.FramebufferTexture( textureSize, textureSize, THREE.RGBFormat );
texture.minFilter = THREE.NearestFilter;
texture.magFilter = THREE.NearestFilter;
| true |
Other | mrdoob | three.js | c748762b7e2fd7fff6882e7c08402633edda8137.json | Introduce FramebufferTexture. (#22916) | src/Three.js | @@ -26,6 +26,7 @@ export { Line } from './objects/Line.js';
export { Points } from './objects/Points.js';
export { Group } from './objects/Group.js';
export { VideoTexture } from './textures/VideoTexture.js';
+export { FramebufferTexture } from './textures/FramebufferTexture.js';
export { DataTexture } from './textures/DataTexture.js';
export { DataTexture2DArray } from './textures/DataTexture2DArray.js';
export { DataTexture3D } from './textures/DataTexture3D.js'; | true |
Other | mrdoob | three.js | c748762b7e2fd7fff6882e7c08402633edda8137.json | Introduce FramebufferTexture. (#22916) | src/renderers/WebGLRenderer.js | @@ -2038,6 +2038,13 @@ function WebGLRenderer( parameters = {} ) {
this.copyFramebufferToTexture = function ( position, texture, level = 0 ) {
+ if ( texture.isFramebufferTexture !== true ) {
+
+ console.error( 'THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.' );
+ return;
+
+ }
+
const levelScale = Math.pow( 2, - level );
const width = Math.floor( texture.image.width * levelScale );
const height = Math.floor( texture.image.height * levelScale ); | true |
Other | mrdoob | three.js | c748762b7e2fd7fff6882e7c08402633edda8137.json | Introduce FramebufferTexture. (#22916) | src/renderers/webgl/WebGLTextures.js | @@ -709,6 +709,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
state.texImage3D( _gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
+ } else if ( texture.isFramebufferTexture ) {
+
+ // texture data extracted from framebuffers require mutuable textures defined via gl.copyTexImage2D()
+
} else {
// regular Texture (image, video, canvas) | true |
Other | mrdoob | three.js | c748762b7e2fd7fff6882e7c08402633edda8137.json | Introduce FramebufferTexture. (#22916) | src/textures/FramebufferTexture.js | @@ -0,0 +1,25 @@
+import { Texture } from './Texture.js';
+import { NearestFilter } from '../constants.js';
+
+class FramebufferTexture extends Texture {
+
+ constructor( width, height, format ) {
+
+ super( { width, height } );
+
+ this.format = format;
+
+ this.magFilter = NearestFilter;
+ this.minFilter = NearestFilter;
+
+ this.generateMipmaps = false;
+
+ this.needsUpdate = true;
+
+ }
+
+}
+
+FramebufferTexture.prototype.isFramebufferTexture = true;
+
+export { FramebufferTexture }; | true |
Other | mrdoob | three.js | 92bb9158efc0d52fb95d12bf474dc857e8e3c639.json | Fix collada transparency handling. (#22907)
According to the official collada specification, the opaque attribute for the transparent object is optional, and the default value is 'A_ONE'. | examples/jsm/loaders/ColladaLoader.js | @@ -1276,7 +1276,7 @@ class ColladaLoader extends Loader {
break;
case 'transparent':
data[ child.nodeName ] = {
- opaque: child.getAttribute( 'opaque' ),
+ opaque: child.hasAttribute( 'opaque' ) ? child.getAttribute( 'opaque' ) : 'A_ONE',
data: parseEffectParameter( child )
};
break;
@@ -1737,7 +1737,6 @@ class ColladaLoader extends Loader {
material.opacity = color[ 0 ] * transparency.float;
break;
default:
- material.opacity = 1 - transparency.float;
console.warn( 'THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.', transparent.opaque );
} | false |
Other | mrdoob | three.js | 8fc1cecff0e02308788215ce02fb4390794188b1.json | Fix a typo (#22905)
Remove the dot from the final menu element.
🐬 | manual/list.json | @@ -49,7 +49,7 @@
"Billboards and Facades": "en/billboards",
"Freeing Resources": "en/cleanup",
"Making Voxel Geometry (Minecraft)": "en/voxel-geometry",
- "Start making a Game.": "en/game"
+ "Start making a Game": "en/game"
},
"WebXR": {
"VR - Basics": "en/webxr",
@@ -110,7 +110,7 @@
"Billboards and Facades": "fr/billboards",
"Freeing Resources": "fr/cleanup",
"Making Voxel Geometry (Minecraft)": "fr/voxel-geometry",
- "Start making a Game.": "fr/game"
+ "Start making a Game": "fr/game"
},
"WebXR": {
"VR - Basics": "fr/webxr",
@@ -171,7 +171,7 @@
"Billboards and Facades": "ja/billboards",
"Freeing Resources": "ja/cleanup",
"Making Voxel Geometry (Minecraft)": "ja/voxel-geometry",
- "Start making a Game.": "ja/game"
+ "Start making a Game": "ja/game"
},
"WebXR": {
"VR - Basics": "ja/webxr",
@@ -293,7 +293,7 @@
"Billboards and Facades": "ru/billboards",
"Freeing Resources": "ru/cleanup",
"Making Voxel Geometry (Minecraft)": "ru/voxel-geometry",
- "Start making a Game.": "ru/game"
+ "Start making a Game": "ru/game"
},
"WebXR": {
"VR - Basics": "ru/webxr",
@@ -348,7 +348,7 @@
"Billboards and Facades": "zh/billboards",
"Freeing Resources": "zh/cleanup",
"Making Voxel Geometry (Minecraft)": "zh/voxel-geometry",
- "Start making a Game.": "zh/game"
+ "Start making a Game": "zh/game"
},
"WebXR": {
"VR - Basics": "zh/webxr", | false |
Other | mrdoob | three.js | 1d544d0fd254775c36e222e088833a3d4b3c2220.json | Remove LogLuv encoding from the shaders (#22876)
* Remove logLuv encoding from the shaders
* Update constants | docs/api/en/constants/Textures.html | @@ -561,7 +561,6 @@ <h2>Encoding</h2>
THREE.sRGBEncoding
THREE.GammaEncoding
THREE.RGBEEncoding
- THREE.LogLuvEncoding
THREE.RGBM7Encoding
THREE.RGBM16Encoding
THREE.RGBDEncoding | true |
Other | mrdoob | three.js | 1d544d0fd254775c36e222e088833a3d4b3c2220.json | Remove LogLuv encoding from the shaders (#22876)
* Remove logLuv encoding from the shaders
* Update constants | examples/jsm/nodes/utils/ColorSpaceNode.js | @@ -197,7 +197,6 @@ ColorSpaceNode.Nodes = ( function () {
}`
);
-
const LinearToRGBD = new FunctionNode( /* glsl */`
vec3 LinearToRGBD( in vec4 value, in float maxRange ) {
@@ -209,45 +208,6 @@ ColorSpaceNode.Nodes = ( function () {
}`
);
- // LogLuv reference: http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html
-
- // M matrix, for encoding
-
- const cLogLuvM = new ConstNode( 'const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );' );
-
- const LinearToLogLuv = new FunctionNode( /* glsl */`
- vec4 LinearToLogLuv( in vec4 value ) {
-
- vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
- Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));
- vec4 vResult;
- vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
- float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
- vResult.w = fract(Le);
- vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;
- return vResult;
-
- }`
- , [ cLogLuvM ] );
-
- // Inverse M matrix, for decoding
-
- const cLogLuvInverseM = new ConstNode( 'const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );' );
-
- const LogLuvToLinear = new FunctionNode( /* glsl */`
- vec4 LogLuvToLinear( in vec4 value ) {
-
- float Le = value.z * 255.0 + value.w;
- vec3 Xp_Y_XYZp;
- Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);
- Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
- Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
- vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
- return vec4( max(vRGB, 0.0), 1.0 );
-
- }`
- , [ cLogLuvInverseM ] );
-
return {
LinearToLinear: LinearToLinear,
GammaToLinear: GammaToLinear,
@@ -259,11 +219,7 @@ ColorSpaceNode.Nodes = ( function () {
RGBMToLinear: RGBMToLinear,
LinearToRGBM: LinearToRGBM,
RGBDToLinear: RGBDToLinear,
- LinearToRGBD: LinearToRGBD,
- cLogLuvM: cLogLuvM,
- LinearToLogLuv: LinearToLogLuv,
- cLogLuvInverseM: cLogLuvInverseM,
- LogLuvToLinear: LogLuvToLinear
+ LinearToRGBD: LinearToRGBD
};
} )();
@@ -285,9 +241,6 @@ ColorSpaceNode.LINEAR_TO_RGBM = 'LinearToRGBM';
ColorSpaceNode.RGBD_TO_LINEAR = 'RGBDToLinear';
ColorSpaceNode.LINEAR_TO_RGBD = 'LinearToRGBD';
-ColorSpaceNode.LINEAR_TO_LOG_LUV = 'LinearToLogLuv';
-ColorSpaceNode.LOG_LUV_TO_LINEAR = 'LogLuvToLinear';
-
ColorSpaceNode.getEncodingComponents = function ( encoding ) {
switch ( encoding ) { | true |
Other | mrdoob | three.js | 1d544d0fd254775c36e222e088833a3d4b3c2220.json | Remove LogLuv encoding from the shaders (#22876)
* Remove logLuv encoding from the shaders
* Update constants | examples/jsm/renderers/nodes/display/ColorSpaceNode.js | @@ -3,7 +3,7 @@ import { ShaderNode } from '../ShaderNode.js';
import { LinearEncoding/*,
sRGBEncoding, RGBEEncoding, RGBM7Encoding, RGBM16Encoding,
- RGBDEncoding, GammaEncoding, LogLuvEncoding*/ } from 'three';
+ RGBDEncoding, GammaEncoding*/ } from 'three';
export const LinearToLinear = new ShaderNode( ( inputs ) => {
@@ -30,8 +30,6 @@ function getEncodingComponents ( encoding ) {
return [ 'RGBD', new FloatNode( 256.0 ).setConst( true ) ];
case GammaEncoding:
return [ 'Gamma', new CodeNode( 'float( GAMMA_FACTOR )' ) ];
- case LogLuvEncoding:
- return [ 'LogLuv' ];
*/
}
@@ -55,9 +53,6 @@ class ColorSpaceNode extends TempNode {
static RGBD_TO_LINEAR = 'RGBDToLinear';
static LINEAR_TO_RGBD = 'LinearToRGBD';
-
- static LINEAR_TO_LOG_LUV = 'LinearToLogLuv';
- static LOG_LUV_TO_LINEAR = 'LogLuvToLinear';
*/
constructor( method, node ) {
| true |
Other | mrdoob | three.js | 1d544d0fd254775c36e222e088833a3d4b3c2220.json | Remove LogLuv encoding from the shaders (#22876)
* Remove logLuv encoding from the shaders
* Update constants | src/constants.js | @@ -159,7 +159,6 @@ export const LinearEncoding = 3000;
export const sRGBEncoding = 3001;
export const GammaEncoding = 3007;
export const RGBEEncoding = 3002;
-export const LogLuvEncoding = 3003;
export const RGBM7Encoding = 3004;
export const RGBM16Encoding = 3005;
export const RGBDEncoding = 3006; | true |
Other | mrdoob | three.js | 1d544d0fd254775c36e222e088833a3d4b3c2220.json | Remove LogLuv encoding from the shaders (#22876)
* Remove logLuv encoding from the shaders
* Update constants | src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js | @@ -59,31 +59,4 @@ vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
D = clamp( floor( D ) / 255.0, 0.0, 1.0 );
return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
}
-
-// LogLuv reference: http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html
-
-// M matrix, for encoding
-const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
-vec4 LinearToLogLuv( in vec4 value ) {
- vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
- Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
- vec4 vResult;
- vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
- float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
- vResult.w = fract( Le );
- vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;
- return vResult;
-}
-
-// Inverse M matrix, for decoding
-const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
-vec4 LogLuvToLinear( in vec4 value ) {
- float Le = value.z * 255.0 + value.w;
- vec3 Xp_Y_XYZp;
- Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );
- Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
- Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
- vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
- return vec4( max( vRGB, 0.0 ), 1.0 );
-}
`; | true |
Other | mrdoob | three.js | 1d544d0fd254775c36e222e088833a3d4b3c2220.json | Remove LogLuv encoding from the shaders (#22876)
* Remove logLuv encoding from the shaders
* Update constants | src/renderers/webgl/WebGLProgram.js | @@ -1,7 +1,7 @@
import { WebGLUniforms } from './WebGLUniforms.js';
import { WebGLShader } from './WebGLShader.js';
import { ShaderChunk } from '../shaders/ShaderChunk.js';
-import { RGBFormat, NoToneMapping, AddOperation, MixOperation, MultiplyOperation, CubeRefractionMapping, CubeUVRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, VSMShadowMap, ACESFilmicToneMapping, CineonToneMapping, CustomToneMapping, ReinhardToneMapping, LinearToneMapping, GammaEncoding, RGBDEncoding, RGBM16Encoding, RGBM7Encoding, RGBEEncoding, sRGBEncoding, LinearEncoding, LogLuvEncoding, GLSL3 } from '../../constants.js';
+import { RGBFormat, NoToneMapping, AddOperation, MixOperation, MultiplyOperation, CubeRefractionMapping, CubeUVRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, VSMShadowMap, ACESFilmicToneMapping, CineonToneMapping, CustomToneMapping, ReinhardToneMapping, LinearToneMapping, GammaEncoding, RGBDEncoding, RGBM16Encoding, RGBM7Encoding, RGBEEncoding, sRGBEncoding, LinearEncoding, GLSL3 } from '../../constants.js';
let programIdCount = 0;
@@ -37,8 +37,6 @@ function getEncodingComponents( encoding ) {
return [ 'RGBD', '( value, 256.0 )' ];
case GammaEncoding:
return [ 'Gamma', '( value, float( GAMMA_FACTOR ) )' ];
- case LogLuvEncoding:
- return [ 'LogLuv', '( value )' ];
default:
console.warn( 'THREE.WebGLProgram: Unsupported encoding:', encoding );
return [ 'Linear', '( value )' ]; | true |
Other | mrdoob | three.js | 1d544d0fd254775c36e222e088833a3d4b3c2220.json | Remove LogLuv encoding from the shaders (#22876)
* Remove logLuv encoding from the shaders
* Update constants | test/unit/src/constants.tests.js | @@ -133,7 +133,6 @@ export default QUnit.module( 'Constants', () => {
assert.equal( Constants.sRGBEncoding, 3001, 'sRGBEncoding is equal to 3001' );
assert.equal( Constants.GammaEncoding, 3007, 'GammaEncoding is equal to 3007' );
assert.equal( Constants.RGBEEncoding, 3002, 'RGBEEncoding is equal to 3002' );
- assert.equal( Constants.LogLuvEncoding, 3003, 'LogLuvEncoding is equal to 3003' );
assert.equal( Constants.RGBM7Encoding, 3004, 'RGBM7Encoding is equal to 3004' );
assert.equal( Constants.RGBM16Encoding, 3005, 'RGBM16Encoding is equal to 3005' );
assert.equal( Constants.RGBDEncoding, 3006, 'RGBDEncoding is equal to 3006' ); | true |
Other | mrdoob | three.js | 00434467a99a50ef9beeaa15ebb5c743bbb9e197.json | expose raycaster in drag control (#22851) | examples/js/controls/DragControls.js | @@ -65,6 +65,12 @@
}
+ function getRaycaster() {
+
+ return _raycaster;
+
+ }
+
function onPointerMove( event ) {
if ( scope.enabled === false ) return; | true |
Other | mrdoob | three.js | 00434467a99a50ef9beeaa15ebb5c743bbb9e197.json | expose raycaster in drag control (#22851) | examples/jsm/controls/DragControls.js | @@ -64,6 +64,12 @@ class DragControls extends EventDispatcher {
}
+ function getRaycaster() {
+
+ return _raycaster;
+
+ }
+
function onPointerMove( event ) {
if ( scope.enabled === false ) return; | true |
Other | mrdoob | three.js | 9b86245eafd2c71ace83688ad0f20de1750f2968.json | Add WebGLShaderCache. (#23022) | src/renderers/WebGLRenderer.js | @@ -573,6 +573,7 @@ function WebGLRenderer( parameters = {} ) {
cubeuvmaps.dispose();
objects.dispose();
bindingStates.dispose();
+ programCache.dispose();
xr.dispose();
@@ -657,6 +658,12 @@ function WebGLRenderer( parameters = {} ) {
} );
+ if ( material.isShaderMaterial ) {
+
+ programCache.releaseShaderCache( material );
+
+ }
+
}
} | true |
Other | mrdoob | three.js | 9b86245eafd2c71ace83688ad0f20de1750f2968.json | Add WebGLShaderCache. (#23022) | src/renderers/webgl/WebGLPrograms.js | @@ -1,13 +1,14 @@
import { BackSide, DoubleSide, CubeUVRefractionMapping, CubeUVReflectionMapping, LinearEncoding, sRGBEncoding, ObjectSpaceNormalMap, TangentSpaceNormalMap, NoToneMapping, RGBAFormat, UnsignedByteType } from '../../constants.js';
import { Layers } from '../../core/Layers.js';
import { WebGLProgram } from './WebGLProgram.js';
+import { WebGLShaderCache } from './WebGLShaderCache.js';
import { ShaderLib } from '../shaders/ShaderLib.js';
import { UniformsUtils } from '../shaders/UniformsUtils.js';
-import { hashString } from '../../utils.js';
function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping ) {
const _programLayers = new Layers();
+ const _customShaders = new WebGLShaderCache();
const programs = [];
const isWebGL2 = capabilities.isWebGL2;
@@ -127,6 +128,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
}
let vertexShader, fragmentShader;
+ let customVertexShaderID, customFragmentShaderID;
if ( shaderID ) {
@@ -140,6 +142,11 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
vertexShader = material.vertexShader;
fragmentShader = material.fragmentShader;
+ _customShaders.update( material );
+
+ customVertexShaderID = _customShaders.getVertexShaderID( material );
+ customFragmentShaderID = _customShaders.getFragmentShaderID( material );
+
}
const currentRenderTarget = renderer.getRenderTarget();
@@ -158,6 +165,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
fragmentShader: fragmentShader,
defines: material.defines,
+ customVertexShaderID: customVertexShaderID,
+ customFragmentShaderID: customFragmentShaderID,
+
isRawShaderMaterial: material.isRawShaderMaterial === true,
glslVersion: material.glslVersion,
@@ -296,8 +306,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
} else {
- array.push( hashString( parameters.fragmentShader ) );
- array.push( hashString( parameters.vertexShader ) );
+ array.push( parameters.customVertexShaderID );
+ array.push( parameters.customFragmentShaderID );
}
@@ -549,14 +559,28 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
}
+ function releaseShaderCache( material ) {
+
+ _customShaders.remove( material );
+
+ }
+
+ function dispose() {
+
+ _customShaders.dispose();
+
+ }
+
return {
getParameters: getParameters,
getProgramCacheKey: getProgramCacheKey,
getUniforms: getUniforms,
acquireProgram: acquireProgram,
releaseProgram: releaseProgram,
+ releaseShaderCache: releaseShaderCache,
// Exposed for resource monitoring & error feedback via renderer.info:
- programs: programs
+ programs: programs,
+ dispose: dispose
};
} | true |
Other | mrdoob | three.js | 9b86245eafd2c71ace83688ad0f20de1750f2968.json | Add WebGLShaderCache. (#23022) | src/renderers/webgl/WebGLShaderCache.js | @@ -0,0 +1,120 @@
+let _id = 0;
+
+class WebGLShaderCache {
+
+ constructor() {
+
+ this.shaderCache = new Map();
+ this.materialCache = new Map();
+
+ }
+
+ update( material ) {
+
+ const vertexShader = material.vertexShader;
+ const fragmentShader = material.fragmentShader;
+
+ const vertexShaderStage = this._getShaderStage( vertexShader );
+ const fragmentShaderStage = this._getShaderStage( fragmentShader );
+
+ const materialShaders = this._getShaderCacheForMaterial( material );
+
+ if ( materialShaders.has( vertexShaderStage ) === false ) {
+
+ materialShaders.add( vertexShaderStage );
+ vertexShaderStage.usedTimes ++;
+
+ }
+
+ if ( materialShaders.has( fragmentShaderStage ) === false ) {
+
+ materialShaders.add( fragmentShaderStage );
+ fragmentShaderStage.usedTimes ++;
+
+ }
+
+ return this;
+
+ }
+
+ remove( material ) {
+
+ const materialShaders = this.materialCache.get( material );
+
+ for ( const shaderStage of materialShaders ) {
+
+ shaderStage.usedTimes --;
+
+ if ( shaderStage.usedTimes === 0 ) this.shaderCache.delete( shaderStage );
+
+ }
+
+ this.materialCache.delete( material );
+
+ return this;
+
+ }
+
+ getVertexShaderID( material ) {
+
+ return this._getShaderStage( material.vertexShader ).id;
+
+ }
+
+ getFragmentShaderID( material ) {
+
+ return this._getShaderStage( material.fragmentShader ).id;
+
+ }
+
+ dispose() {
+
+ this.shaderCache.clear();
+ this.materialCache.clear();
+
+ }
+
+ _getShaderCacheForMaterial( material ) {
+
+ const cache = this.materialCache;
+
+ if ( cache.has( material ) === false ) {
+
+ cache.set( material, new Set() );
+
+ }
+
+ return cache.get( material );
+
+ }
+
+ _getShaderStage( code ) {
+
+ const cache = this.shaderCache;
+
+ if ( cache.has( code ) === false ) {
+
+ const stage = new WebGLShaderStage();
+ cache.set( code, stage );
+
+ }
+
+ return cache.get( code );
+
+ }
+
+}
+
+class WebGLShaderStage {
+
+ constructor() {
+
+ this.id = _id ++;
+
+ this.usedTimes = 0;
+
+ }
+
+}
+
+export { WebGLShaderCache }; | true |
Other | mrdoob | three.js | 9b86245eafd2c71ace83688ad0f20de1750f2968.json | Add WebGLShaderCache. (#23022) | src/utils.js | @@ -54,40 +54,4 @@ function createElementNS( name ) {
}
-/**
- * cyrb53 hash for string from: https://stackoverflow.com/a/52171480
- *
- * Public Domain, @bryc - https://stackoverflow.com/users/815680/bryc
- *
- * It is roughly similar to the well-known MurmurHash/xxHash algorithms. It uses a combination
- * of multiplication and Xorshift to generate the hash, but not as thorough. As a result it's
- * faster than either would be in JavaScript and significantly simpler to implement. Keep in
- * mind this is not a secure algorithm, if privacy/security is a concern, this is not for you.
- *
- * @param {string} str
- * @param {number} seed, default 0
- * @returns number
- */
-function hashString( str, seed = 0 ) {
-
- let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
-
- for ( let i = 0, ch; i < str.length; i ++ ) {
-
- ch = str.charCodeAt( i );
-
- h1 = Math.imul( h1 ^ ch, 2654435761 );
-
- h2 = Math.imul( h2 ^ ch, 1597334677 );
-
- }
-
- h1 = Math.imul( h1 ^ ( h1 >>> 16 ), 2246822507 ) ^ Math.imul( h2 ^ ( h2 >>> 13 ), 3266489909 );
-
- h2 = Math.imul( h2 ^ ( h2 >>> 16 ), 2246822507 ) ^ Math.imul( h1 ^ ( h1 >>> 13 ), 3266489909 );
-
- return 4294967296 * ( 2097151 & h2 ) + ( h1 >>> 0 );
-
-}
-
-export { arrayMin, arrayMax, getTypedArray, createElementNS, hashString };
+export { arrayMin, arrayMax, getTypedArray, createElementNS }; | true |
Other | mrdoob | three.js | d80a715d0114903be289cd22312c2bcc287e5202.json | Fix RoughnessMipmapper (#22985)
* use proper filtering
* Fixed RoughnessMipmapper
* Update RoughnessMipmapper.js
* Update WebGLTextures.js
* Update WebGLTextures.js
* Update WebGLTextures.js
Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org> | examples/jsm/utils/RoughnessMipmapper.js | @@ -119,9 +119,11 @@ class RoughnessMipmapper {
_renderer.copyFramebufferToTexture( position, material.roughnessMap, mip );
+ _mipmapMaterial.uniforms.roughnessMap.value = material.roughnessMap;
+
}
- if ( roughnessMap !== material.roughnessMap ) roughnessMap.dispose();
+ roughnessMap.dispose();
_renderer.setRenderTarget( oldTarget );
| true |
Other | mrdoob | three.js | d80a715d0114903be289cd22312c2bcc287e5202.json | Fix RoughnessMipmapper (#22985)
* use proper filtering
* Fixed RoughnessMipmapper
* Update RoughnessMipmapper.js
* Update WebGLTextures.js
* Update WebGLTextures.js
* Update WebGLTextures.js
Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org> | src/renderers/WebGLRenderer.js | @@ -2049,21 +2049,9 @@ function WebGLRenderer( parameters = {} ) {
const width = Math.floor( texture.image.width * levelScale );
const height = Math.floor( texture.image.height * levelScale );
- let glFormat = utils.convert( texture.format );
-
- if ( capabilities.isWebGL2 ) {
-
- // Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1120100
- // Not needed in Chrome 93+
-
- if ( glFormat === _gl.RGB ) glFormat = _gl.RGB8;
- if ( glFormat === _gl.RGBA ) glFormat = _gl.RGBA8;
-
- }
-
textures.setTexture2D( texture, 0 );
- _gl.copyTexImage2D( _gl.TEXTURE_2D, level, glFormat, position.x, position.y, width, height, 0 );
+ _gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, position.x, position.y, width, height );
state.unbindTexture();
| true |
Other | mrdoob | three.js | d80a715d0114903be289cd22312c2bcc287e5202.json | Fix RoughnessMipmapper (#22985)
* use proper filtering
* Fixed RoughnessMipmapper
* Update RoughnessMipmapper.js
* Update WebGLTextures.js
* Update WebGLTextures.js
* Update WebGLTextures.js
Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org> | src/renderers/webgl/WebGLTextures.js | @@ -181,9 +181,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
function getMipLevels( texture, image, supportsMips ) {
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) === true ) {
-
- // generated mipmaps via gl.generateMipmap()
+ if ( textureNeedsGenerateMipmaps( texture, supportsMips ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {
return Math.log2( Math.max( image.width, image.height ) ) + 1;
@@ -793,7 +791,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
} else if ( texture.isFramebufferTexture ) {
- // texture data extracted from framebuffers require mutuable textures defined via gl.copyTexImage2D()
+ if ( useTexStorage && allocateMemory ) {
+
+ state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );
+
+ } else {
+
+ state.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
+
+ }
} else {
| true |
Other | mrdoob | three.js | cef1c28b9f57b28791ac74766ee47dc0ac468290.json | add dispose() for SelectionHelper (#22977)
Co-authored-by: pank <pank07@vanke.com> | examples/jsm/interactive/SelectionHelper.js | @@ -18,29 +18,45 @@ class SelectionHelper {
this.isDown = false;
- this.renderer.domElement.addEventListener( 'pointerdown', function ( event ) {
+ this.pointerdownEvent = function ( event ) {
this.isDown = true;
this.onSelectStart( event );
- }.bind( this ) );
+ }.bind( this );
- this.renderer.domElement.addEventListener( 'pointermove', function ( event ) {
+ this.pointermoveEvent = function ( event ) {
if ( this.isDown ) {
this.onSelectMove( event );
}
- }.bind( this ) );
+ }.bind( this );
- this.renderer.domElement.addEventListener( 'pointerup', function ( event ) {
+ this.pointerupEvent = function ( ) {
this.isDown = false;
- this.onSelectOver( event );
+ this.onSelectOver();
- }.bind( this ) );
+ }.bind( this );
+
+ this.renderer.domElement.addEventListener( 'pointerdown', this.pointerdownEvent );
+
+ this.renderer.domElement.addEventListener( 'pointermove', this.pointermoveEvent );
+
+ this.renderer.domElement.addEventListener( 'pointerup', this.pointerupEvent );
+
+ }
+
+ dispose() {
+
+ this.renderer.domElement.removeEventListener( 'pointerdown', this.pointerdownEvent );
+
+ this.renderer.domElement.removeEventListener( 'pointermove', this.pointermoveEvent );
+
+ this.renderer.domElement.removeEventListener( 'pointerup', this.pointerupEvent );
}
| false |
Other | mrdoob | three.js | c495c47aec3772484a0b0c6acc8499a62157568f.json | fix matrix.lookAt parameter document (#22969)
Co-authored-by: webglzhang <49345883@qq.com> | docs/api/en/math/Matrix4.html | @@ -202,9 +202,9 @@ <h3>[method:Float getMaxScaleOnAxis]()</h3>
<h3>[method:this identity]()</h3>
<p>Resets this matrix to the [link:https://en.wikipedia.org/wiki/Identity_matrix identity matrix].</p>
- <h3>[method:this lookAt]( [param:Vector3 eye], [param:Vector3 center], [param:Vector3 up], )</h3>
+ <h3>[method:this lookAt]( [param:Vector3 eye], [param:Vector3 target], [param:Vector3 up], )</h3>
<p>
- Constructs a rotation matrix, looking from [page:Vector3 eye] towards [page:Vector3 center]
+ Constructs a rotation matrix, looking from [page:Vector3 eye] towards [page:Vector3 target]
oriented by the [page:Vector3 up] vector.
</p>
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.