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 | cb441e0cb48e1bcc1c14b2dd8ae273cd44429276.json | Fix translation error | docs/api/zh/geometries/TorusKnotBufferGeometry.html | @@ -10,7 +10,7 @@
<body>
[page:BufferGeometry] →
- <h1>圆环缓冲几何体([name])</h1>
+ <h1>圆环缓冲扭结几何体([name])</h1>
<p class="desc">This is the [page:BufferGeometry] port of [page:TorusKnotGeometry].</p>
| false |
Other | mrdoob | three.js | bdf738fb9048c279b7599889c60800e92e0f2b78.json | Remove unused frustum bounding box | examples/jsm/csm/FrustumBoundingBox.js | @@ -1,83 +0,0 @@
-/**
- * @author vHawk / https://github.com/vHawk/
- */
-
-export default class FrustumBoundingBox {
-
- constructor() {
-
- this.min = {
- x: 0,
- y: 0,
- z: 0
- };
- this.max = {
- x: 0,
- y: 0,
- z: 0
- };
-
- }
-
- fromFrustum( frustum ) {
-
- const vertices = [];
-
- for ( let i = 0; i < 4; i ++ ) {
-
- vertices.push( frustum.vertices.near[ i ] );
- vertices.push( frustum.vertices.far[ i ] );
-
- }
-
- this.min = {
- x: vertices[ 0 ].x,
- y: vertices[ 0 ].y,
- z: vertices[ 0 ].z
- };
- this.max = {
- x: vertices[ 0 ].x,
- y: vertices[ 0 ].y,
- z: vertices[ 0 ].z
- };
-
- for ( let i = 1; i < 8; i ++ ) {
-
- this.min.x = Math.min( this.min.x, vertices[ i ].x );
- this.min.y = Math.min( this.min.y, vertices[ i ].y );
- this.min.z = Math.min( this.min.z, vertices[ i ].z );
- this.max.x = Math.max( this.max.x, vertices[ i ].x );
- this.max.y = Math.max( this.max.y, vertices[ i ].y );
- this.max.z = Math.max( this.max.z, vertices[ i ].z );
-
- }
-
- return this;
-
- }
-
- getSize() {
-
- this.size = {
- x: this.max.x - this.min.x,
- y: this.max.y - this.min.y,
- z: this.max.z - this.min.z
- };
-
- return this.size;
-
- }
-
- getCenter( margin ) {
-
- this.center = {
- x: ( this.max.x + this.min.x ) / 2,
- y: ( this.max.y + this.min.y ) / 2,
- z: this.max.z + margin
- };
-
- return this.center;
-
- }
-
-} | false |
Other | mrdoob | three.js | f54797b4c33aaa51896ba57d9927370feb0eb84f.json | Replace FrustumBoundingBox use with Box3 | examples/jsm/csm/CSM.js | @@ -13,17 +13,18 @@ import {
BufferGeometry,
BufferAttribute,
Line,
- Matrix4
+ Matrix4,
+ Box3
} from '../../../build/three.module.js';
import Frustum from './Frustum.js';
-import FrustumBoundingBox from './FrustumBoundingBox.js';
import Shader from './Shader.js';
const _cameraToLightMatrix = new Matrix4();
const _lightSpaceFrustum = new Frustum();
const _frustum = new Frustum();
const _center = new Vector3();
-const _bbox = new FrustumBoundingBox();
+const _size = new Vector3();
+const _bbox = new Box3();
const _uniformArray = [];
const _logArray = [];
@@ -163,20 +164,24 @@ export default class CSM {
for ( let i = 0; i < this.frustums.length; i ++ ) {
const light = this.lights[ i ];
+ light.shadow.camera.updateMatrixWorld( true );
_cameraToLightMatrix.multiplyMatrices( light.shadow.camera.matrixWorldInverse, cameraMatrix );
this.frustums[ i ].toSpace( _cameraToLightMatrix, _lightSpaceFrustum );
- light.shadow.camera.updateMatrixWorld( true );
+ _bbox.makeEmpty();
+ for ( let j = 0; j < 4; j ++ ) {
- _bbox.fromFrustum( _lightSpaceFrustum );
- _bbox.getSize();
- _bbox.getCenter( this.lightMargin );
+ _bbox.expandByPoint( _lightSpaceFrustum.vertices.near[ j ] );
+ _bbox.expandByPoint( _lightSpaceFrustum.vertices.far[ j ] );
- const squaredBBWidth = Math.max( _bbox.size.x, _bbox.size.y );
+ }
- _center.copy( _bbox.center );
+ _bbox.getSize( _size );
+ _bbox.getCenter( _center );
+ _center.z = _bbox.max.z + this.lightMargin;
_center.applyMatrix4( light.shadow.camera.matrixWorld );
+ const squaredBBWidth = Math.max( _size.x, _size.y );
light.shadow.camera.left = - squaredBBWidth / 2;
light.shadow.camera.right = squaredBBWidth / 2;
light.shadow.camera.top = squaredBBWidth / 2; | false |
Other | mrdoob | three.js | 3e937e9dc08dc48026056e6c689025aa954a5edb.json | remove array creation from `getBreaks` | examples/jsm/csm/CSM.js | @@ -24,6 +24,8 @@ const _lightSpaceFrustum = new Frustum();
const _frustum = new Frustum();
const _center = new Vector3();
const _bbox = new FrustumBoundingBox();
+const _uniformArray = [];
+const _logArray = [];
export default class CSM {
@@ -46,6 +48,7 @@ export default class CSM {
this.customSplitsCallback = data.customSplitsCallback;
this.mainFrustum = new Frustum();
this.frustums = [];
+ this.breaks = [];
this.lights = [];
this.materials = [];
@@ -92,70 +95,64 @@ export default class CSM {
const camera = this.camera;
const far = Math.min(camera.far, this.maxFar);
- this.breaks = [];
+ this.breaks.length = 0;
switch ( this.mode ) {
case 'uniform':
- this.breaks = uniformSplit( this.cascades, camera.near, far );
+ uniformSplit( this.cascades, camera.near, far, this.breaks );
break;
case 'logarithmic':
- this.breaks = logarithmicSplit( this.cascades, camera.near, far );
+ logarithmicSplit( this.cascades, camera.near, far, this.breaks );
break;
case 'practical':
- this.breaks = practicalSplit( this.cascades, camera.near, far, 0.5 );
+ practicalSplit( this.cascades, camera.near, far, 0.5, this.breaks );
break;
case 'custom':
if ( this.customSplitsCallback === undefined ) console.error( 'CSM: Custom split scheme callback not defined.' );
- this.breaks = this.customSplitsCallback( this.cascades, camera.near, far );
+ this.customSplitsCallback( this.cascades, camera.near, far, this.breaks );
break;
}
- function uniformSplit( amount, near, far ) {
-
- const r = [];
+ function uniformSplit( amount, near, far, target ) {
for ( let i = 1; i < amount; i ++ ) {
- r.push( ( near + ( far - near ) * i / amount ) / far );
+ target.push( ( near + ( far - near ) * i / amount ) / far );
}
- r.push( 1 );
- return r;
+ target.push( 1 );
}
- function logarithmicSplit( amount, near, far ) {
-
- const r = [];
+ function logarithmicSplit( amount, near, far, target ) {
for ( let i = 1; i < amount; i ++ ) {
- r.push( ( near * ( far / near ) ** ( i / amount ) ) / far );
+ target.push( ( near * ( far / near ) ** ( i / amount ) ) / far );
}
- r.push( 1 );
- return r;
+ target.push( 1 );
}
- function practicalSplit( amount, near, far, lambda ) {
+ function practicalSplit( amount, near, far, lambda, target ) {
- const log = logarithmicSplit( amount, near, far );
- const uni = uniformSplit( amount, near, far );
- const r = [];
+ _uniformArray.length = 0;
+ _logArray.length = 0;
+ const log = logarithmicSplit( amount, near, far, _logArray );
+ const uni = uniformSplit( amount, near, far, _uniformArray );
for ( let i = 1; i < amount; i ++ ) {
- r.push( MathUtils.lerp( uni[ i - 1 ], log[ i - 1 ], lambda ) );
+ target.push( MathUtils.lerp( _uniformArray[ i - 1 ], _logArray[ i - 1 ], lambda ) );
}
- r.push( 1 );
- return r;
+ target.push( 1 );
}
| false |
Other | mrdoob | three.js | d6ff1df09f8c9c30f7812eda0bf6516832f6671b.json | Fix csm helper | examples/jsm/csm/CSM.js | @@ -21,6 +21,7 @@ import Shader from './Shader.js';
const _cameraToLightMatrix = new Matrix4();
const _lightSpaceFrustum = new Frustum();
+const _frustum = new Frustum();
const _center = new Vector3();
const _bbox = new FrustumBoundingBox();
@@ -276,22 +277,21 @@ export default class CSM {
helper( cameraMatrix ) {
- let frustum;
let geometry, vertices;
const material = new LineBasicMaterial( { color: 0xffffff } );
const object = new Object3D();
for ( let i = 0; i < this.frustums.length; i ++ ) {
- frustum = this.frustums[ i ].toSpace( cameraMatrix );
+ this.frustums[ i ].toSpace( cameraMatrix, _frustum );
geometry = new BufferGeometry();
vertices = [];
for ( let i = 0; i < 5; i ++ ) {
- const point = frustum.vertices.near[ i === 4 ? 0 : i ];
+ const point = _frustum.vertices.near[ i === 4 ? 0 : i ];
vertices.push( point.x, point.y, point.z );
}
@@ -305,7 +305,7 @@ export default class CSM {
for ( let i = 0; i < 5; i ++ ) {
- const point = frustum.vertices.far[ i === 4 ? 0 : i ];
+ const point = _frustum.vertices.far[ i === 4 ? 0 : i ];
vertices.push( point.x, point.y, point.z );
}
@@ -319,8 +319,8 @@ export default class CSM {
geometry = new BufferGeometry();
vertices = [];
- const near = frustum.vertices.near[ i ];
- const far = frustum.vertices.far[ i ];
+ const near = _frustum.vertices.near[ i ];
+ const far = _frustum.vertices.far[ i ];
vertices.push( near.x, near.y, near.z );
vertices.push( far.x, far.y, far.z ); | false |
Other | mrdoob | three.js | e289d72af7a917d2583c234e74832623feb12f79.json | Use cached vectors | examples/jsm/csm/Frustum.js | @@ -45,20 +45,20 @@ export default class Frustum {
// 2 --- 1
// clip space spans from [-1, 1]
- this.vertices.near[ 0 ] = new Vector3( 1, 1, - 1 );
- this.vertices.near[ 1 ] = new Vector3( 1, - 1, - 1 );
- this.vertices.near[ 2 ] = new Vector3( - 1, - 1, - 1 );
- this.vertices.near[ 3 ] = new Vector3( - 1, 1, - 1 );
+ this.vertices.near[ 0 ].set( 1, 1, - 1 );
+ this.vertices.near[ 1 ].set( 1, - 1, - 1 );
+ this.vertices.near[ 2 ].set( - 1, - 1, - 1 );
+ this.vertices.near[ 3 ].set( - 1, 1, - 1 );
this.vertices.near.forEach( function( v ) {
v.applyMatrix4( inverseProjectionMatrix );
} );
- this.vertices.far[ 0 ] = new Vector3( 1, 1, 1 );
- this.vertices.far[ 1 ] = new Vector3( 1, - 1, 1 );
- this.vertices.far[ 2 ] = new Vector3( - 1, - 1, 1 );
- this.vertices.far[ 3 ] = new Vector3( - 1, 1, 1 );
+ this.vertices.far[ 0 ].set( 1, 1, 1 );
+ this.vertices.far[ 1 ].set( 1, - 1, 1 );
+ this.vertices.far[ 2 ].set( - 1, - 1, 1 );
+ this.vertices.far[ 3 ].set( - 1, 1, 1 );
this.vertices.far.forEach( function( v ) {
v.applyMatrix4( inverseProjectionMatrix );
@@ -92,15 +92,15 @@ export default class Frustum {
for ( let j = 0; j < 4; j ++ ) {
- cascade.vertices.near[ j ] = this.vertices.near[ j ].clone();
+ cascade.vertices.near[ j ].copy( this.vertices.near[ j ] );
}
} else {
for ( let j = 0; j < 4; j ++ ) {
- cascade.vertices.near[ j ] = new Vector3().lerpVectors( this.vertices.near[ j ], this.vertices.far[ j ], breaks[ i - 1 ] );
+ cascade.vertices.near[ j ].lerpVectors( this.vertices.near[ j ], this.vertices.far[ j ], breaks[ i - 1 ] );
}
@@ -110,15 +110,15 @@ export default class Frustum {
for ( let j = 0; j < 4; j ++ ) {
- cascade.vertices.far[ j ] = this.vertices.far[ j ].clone();
+ cascade.vertices.far[ j ].copy( this.vertices.far[ j ] );
}
} else {
for ( let j = 0; j < 4; j ++ ) {
- cascade.vertices.far[ j ] = new Vector3().lerpVectors( this.vertices.near[ j ], this.vertices.far[ j ], breaks[ i ] );
+ cascade.vertices.far[ j ].lerpVectors( this.vertices.near[ j ], this.vertices.far[ j ], breaks[ i ] );
}
| false |
Other | mrdoob | three.js | 63502b521e1d50e42f57f24bc5d38b82fa5e0702.json | Support additional attribute types | examples/js/loaders/EXRLoader.js | @@ -1608,6 +1608,24 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
}
+ function parseRational( dataView, offset ) {
+
+ var x = parseUint32( dataView, offset );
+ var y = parseUint32( dataView, offset );
+
+ return [ x, y ];
+
+ }
+
+ function parseTimecode( dataView, offset ) {
+
+ var x = parseUint32( dataView, offset );
+ var y = parseUint32( dataView, offset );
+
+ return [ x, y ];
+
+ }
+
function parseUint32( dataView, offset ) {
var Uint32 = dataView.getUint32( offset.value, true );
@@ -1883,6 +1901,14 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
return parseUint32( dataView, offset );
+ } else if ( type === 'rational' ) {
+
+ return parseRational( dataView, offset );
+
+ } else if ( type === 'timecode' ) {
+
+ return parseTimecode( dataView, offset );
+
} else {
throw 'Cannot parse value for unsupported type: ' + type; | true |
Other | mrdoob | three.js | 63502b521e1d50e42f57f24bc5d38b82fa5e0702.json | Support additional attribute types | examples/jsm/loaders/EXRLoader.js | @@ -1623,6 +1623,24 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
}
+ function parseRational( dataView, offset ) {
+
+ var x = parseUint32( dataView, offset );
+ var y = parseUint32( dataView, offset );
+
+ return [ x, y ];
+
+ }
+
+ function parseTimecode( dataView, offset ) {
+
+ var x = parseUint32( dataView, offset );
+ var y = parseUint32( dataView, offset );
+
+ return [ x, y ];
+
+ }
+
function parseUint32( dataView, offset ) {
var Uint32 = dataView.getUint32( offset.value, true );
@@ -1898,6 +1916,14 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
return parseUint32( dataView, offset );
+ } else if ( type === 'rational' ) {
+
+ return parseRational( dataView, offset );
+
+ } else if ( type === 'timecode' ) {
+
+ return parseTimecode( dataView, offset );
+
} else {
throw 'Cannot parse value for unsupported type: ' + type; | true |
Other | mrdoob | three.js | 958cffb406152839d1117ec3b901d5a1edafb04a.json | Add samples to WebGLMultisampleRenderTarget.d.ts. | src/renderers/WebGLMultisampleRenderTarget.d.ts | @@ -13,4 +13,9 @@ export class WebGLMultisampleRenderTarget extends WebGLRenderTarget {
readonly isWebGLMultisampleRenderTarget: true;
+ /**
+ * Specifies the number of samples to be used for the renderbuffer storage.However, the maximum supported size for multisampling is platform dependent and defined via gl.MAX_SAMPLES.
+ */
+ samples: number;
+
} | false |
Other | mrdoob | three.js | ad01cf9930538dfc66f26086b94fa18ee7399230.json | Correct wrong keyup (Ctrl, 17) to Shift(16)
Should snap to grid while pressing Shift, therefore Shift keyup should disable snapping. | examples/misc_controls_transform.html | @@ -133,7 +133,7 @@
switch ( event.keyCode ) {
- case 17: // Ctrl
+ case 16: // Shift
control.setTranslationSnap( null );
control.setRotationSnap( null );
control.setScaleSnap( null ); | false |
Other | mrdoob | three.js | 7a0674cd1a646a95e2f2139d420539051aa85a7c.json | remove old warning | src/renderers/webgl/WebGLTextures.js | @@ -180,10 +180,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
extensions.get( 'EXT_color_buffer_float' );
- } else if ( internalFormat === _gl.RGB16F || internalFormat === _gl.RGB32F ) {
-
- console.warn( 'THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead.' );
-
}
return internalFormat; | false |
Other | mrdoob | three.js | e5870f75d20abcc0615e47a1065e001da4fd8997.json | Update chinese version
Signed-off-by: martinRenou <martin.renou@gmail.com> | docs/api/zh/renderers/WebGLRenderer.html | @@ -384,12 +384,11 @@ <h3>[method:null render]( [param:Scene scene], [param:Camera camera], [param:Web
<h3>[method:null renderBufferDirect]( [param:Camera camera], [param:Fog fog], [param:Geometry geometry], [param:Material material], [param:Object3D object], [param:Object group] )</h3>
<p>使用相机和指定材质渲染缓冲几何组。</p>
- <h3>[method:null renderBufferImmediate]( [param:Object3D object], [param:shaderprogram program], [param:Material shading] )</h3>
+ <h3>[method:null renderBufferImmediate]( [param:Object3D object], [param:shaderprogram program] )</h3>
<p>object - 一个[page:Object3D]实例<br />
program - 一个shaderProgram实例<br />
- shading - 一个Material实例<br /><br />
- 渲染即使缓冲,由enderImmediateObject对象调用
+ 渲染即使缓冲,由renderObjectImmediate对象调用
</p>
<h3>[method:null setAnimationLoop]( [param:Function callback] )</h3> | false |
Other | mrdoob | three.js | 5256f4c5eebbbb261dad0c963766d57ecd59c4f1.json | Add support for vertex colors | src/renderers/shaders/ShaderLib/meshmatcap_frag.glsl.js | @@ -14,6 +14,7 @@ varying vec3 vViewPosition;
#endif
#include <common>
+#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
@@ -32,6 +33,7 @@ void main() {
#include <logdepthbuf_fragment>
#include <map_fragment>
+ #include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <normal_fragment_begin> | true |
Other | mrdoob | three.js | 5256f4c5eebbbb261dad0c963766d57ecd59c4f1.json | Add support for vertex colors | src/renderers/shaders/ShaderLib/meshmatcap_vert.glsl.js | @@ -11,6 +11,7 @@ varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
+#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
@@ -22,7 +23,7 @@ varying vec3 vViewPosition;
void main() {
#include <uv_vertex>
-
+ #include <color_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex> | true |
Other | mrdoob | three.js | 7a084b1c113714425f92e74a393aadb5b96a22fd.json | Fix docs for renderBufferImmediate
Looking at the code I saw that it actually does not take a Material as
input. I suppose it's a leftover from an old implementation.
Signed-off-by: martinRenou <martin.renou@gmail.com> | docs/api/en/renderers/WebGLRenderer.html | @@ -427,12 +427,11 @@ <h3>[method:null render]( [param:Scene scene], [param:Camera camera] )</h3>
<h3>[method:null renderBufferDirect]( [param:Camera camera], [param:Fog fog], [param:Geometry 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:shaderprogram program], [param:Material shading] )</h3>
+ <h3>[method:null renderBufferImmediate]( [param:Object3D object], [param:shaderprogram program] )</h3>
<p>object - an instance of [page:Object3D]<br />
program - an instance of shaderProgram<br />
- shading - an instance of Material<br /><br />
- Render an immediate buffer. Gets called by renderImmediateObject.
+ Render an immediate buffer. Gets called by renderObjectImmediate.
</p>
<h3>[method:null setAnimationLoop]( [param:Function callback] )</h3> | false |
Other | mrdoob | three.js | b1aab9b78c88e86e16c2281bf01c653b2caa6f07.json | Add discord link in README | README.md | @@ -17,7 +17,8 @@ The aim of the project is to create an easy to use, lightweight, 3D library with
[Migrating](https://github.com/mrdoob/three.js/wiki/Migration-Guide) —
[Questions](http://stackoverflow.com/questions/tagged/three.js) —
[Forum](https://discourse.threejs.org/) —
-[Slack](https://join.slack.com/t/threejs/shared_invite/enQtMzYxMzczODM2OTgxLTQ1YmY4YTQxOTFjNDAzYmQ4NjU2YzRhNzliY2RiNDEyYjU2MjhhODgyYWQ5Y2MyZTU3MWNkOGVmOGRhOTQzYTk)
+[Slack](https://join.slack.com/t/threejs/shared_invite/enQtMzYxMzczODM2OTgxLTQ1YmY4YTQxOTFjNDAzYmQ4NjU2YzRhNzliY2RiNDEyYjU2MjhhODgyYWQ5Y2MyZTU3MWNkOGVmOGRhOTQzYTk) —
+[Discord](https://discordapp.com/invite/HF4UdyF)
### Usage ###
| false |
Other | mrdoob | three.js | 218d8e5b252a5de6af3960865fceb361a7a82c2c.json | Move premultiplied_alpha chunk | examples/js/effects/OutlineEffect.js | @@ -158,10 +158,10 @@ THREE.OutlineEffect = function ( renderer, parameters ) {
" gl_FragColor = vec4( outlineColor, outlineAlpha );",
- " #include <premultiplied_alpha_fragment>",
" #include <tonemapping_fragment>",
" #include <encodings_fragment>",
" #include <fog_fragment>",
+ " #include <premultiplied_alpha_fragment>",
"}"
| true |
Other | mrdoob | three.js | 218d8e5b252a5de6af3960865fceb361a7a82c2c.json | Move premultiplied_alpha chunk | examples/js/lines/LineMaterial.js | @@ -228,10 +228,10 @@ THREE.ShaderLib[ 'line' ] = {
gl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );
- #include <premultiplied_alpha_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
}
` | true |
Other | mrdoob | three.js | 218d8e5b252a5de6af3960865fceb361a7a82c2c.json | Move premultiplied_alpha chunk | examples/js/loaders/LDrawLoader.js | @@ -77,10 +77,10 @@ THREE.LDrawLoader = ( function () {
#include <color_fragment>
outgoingLight = diffuseColor.rgb; // simple shader
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
- #include <premultiplied_alpha_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
}
`;
| true |
Other | mrdoob | three.js | 218d8e5b252a5de6af3960865fceb361a7a82c2c.json | Move premultiplied_alpha chunk | examples/jsm/effects/OutlineEffect.js | @@ -166,10 +166,10 @@ var OutlineEffect = function ( renderer, parameters ) {
" gl_FragColor = vec4( outlineColor, outlineAlpha );",
- " #include <premultiplied_alpha_fragment>",
" #include <tonemapping_fragment>",
" #include <encodings_fragment>",
" #include <fog_fragment>",
+ " #include <premultiplied_alpha_fragment>",
"}"
| true |
Other | mrdoob | three.js | 218d8e5b252a5de6af3960865fceb361a7a82c2c.json | Move premultiplied_alpha chunk | examples/jsm/lines/LineMaterial.js | @@ -236,10 +236,10 @@ ShaderLib[ 'line' ] = {
gl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );
- #include <premultiplied_alpha_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
}
` | true |
Other | mrdoob | three.js | 218d8e5b252a5de6af3960865fceb361a7a82c2c.json | Move premultiplied_alpha chunk | examples/jsm/loaders/LDrawLoader.js | @@ -95,10 +95,10 @@ var LDrawLoader = ( function () {
#include <color_fragment>
outgoingLight = diffuseColor.rgb; // simple shader
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
- #include <premultiplied_alpha_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
}
`;
| true |
Other | mrdoob | three.js | 218d8e5b252a5de6af3960865fceb361a7a82c2c.json | Move premultiplied_alpha chunk | examples/jsm/nodes/materials/nodes/PhongNode.js | @@ -327,10 +327,10 @@ PhongNode.prototype.build = function ( builder ) {
}
output.push(
- "#include <premultiplied_alpha_fragment>",
"#include <tonemapping_fragment>",
"#include <encodings_fragment>",
- "#include <fog_fragment>"
+ "#include <fog_fragment>",
+ "#include <premultiplied_alpha_fragment>"
);
code = output.join( "\n" ); | true |
Other | mrdoob | three.js | 218d8e5b252a5de6af3960865fceb361a7a82c2c.json | Move premultiplied_alpha chunk | src/renderers/shaders/ShaderLib/linedashed_frag.glsl.js | @@ -33,10 +33,10 @@ void main() {
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
- #include <premultiplied_alpha_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
}
`; | true |
Other | mrdoob | three.js | 218d8e5b252a5de6af3960865fceb361a7a82c2c.json | Move premultiplied_alpha chunk | src/renderers/shaders/ShaderLib/meshbasic_frag.glsl.js | @@ -62,10 +62,10 @@ void main() {
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
- #include <premultiplied_alpha_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
}
`; | true |
Other | mrdoob | three.js | 218d8e5b252a5de6af3960865fceb361a7a82c2c.json | Move premultiplied_alpha chunk | src/renderers/shaders/ShaderLib/meshmatcap_frag.glsl.js | @@ -57,10 +57,10 @@ void main() {
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
- #include <premultiplied_alpha_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
}
`; | true |
Other | mrdoob | three.js | 218d8e5b252a5de6af3960865fceb361a7a82c2c.json | Move premultiplied_alpha chunk | src/renderers/shaders/ShaderLib/points_frag.glsl.js | @@ -25,10 +25,10 @@ void main() {
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
- #include <premultiplied_alpha_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
+ #include <premultiplied_alpha_fragment>
}
`; | true |
Other | mrdoob | three.js | 45525ae4c6f4b7ddcb025114f6b9ce5627a892aa.json | Fix d.ts for WebGLShadowMap constructor | src/renderers/webgl/WebGLShadowMap.d.ts | @@ -7,9 +7,8 @@ export class WebGLShadowMap {
constructor(
_renderer: WebGLRenderer,
- _lights: any[],
_objects: any[],
- capabilities: any
+ maxTextureSize: number
);
enabled: boolean; | false |
Other | mrdoob | three.js | b37e9e60d924837e0e2e09f6eef4ab6281ac6e28.json | Fix Ray.lookAt d.ts signature | src/math/Ray.d.ts | @@ -15,7 +15,7 @@ export class Ray {
clone(): this;
copy( ray: Ray ): this;
at( t: number, target: Vector3 ): Vector3;
- lookAt( v: Vector3 ): Vector3;
+ lookAt( v: Vector3 ): Ray;
recast( t: number ): Ray;
closestPointToPoint( point: Vector3, target: Vector3 ): Vector3;
distanceToPoint( point: Vector3 ): number; | false |
Other | mrdoob | three.js | 042adf61f7a98616f259a110ef407704adac6ab6.json | Expose the grip space for XR controllers | src/renderers/webxr/WebXRManager.d.ts | @@ -7,6 +7,7 @@ export class WebXRManager {
enabled: boolean;
getController( id: number ): Group;
+ getControllerGrip( id: number ): Group;
setFramebufferScaleFactor( value: number ): void;
setReferenceSpaceType( value: string ): void;
getSession(): any; | true |
Other | mrdoob | three.js | 042adf61f7a98616f259a110ef407704adac6ab6.json | Expose the grip space for XR controllers | src/renderers/webxr/WebXRManager.js | @@ -52,15 +52,43 @@ function WebXRManager( renderer, gl ) {
if ( controller === undefined ) {
- controller = new Group();
- controller.matrixAutoUpdate = false;
- controller.visible = false;
+ controller = {};
+ controllers[ id ] = controller;
+
+ }
+
+ if ( controller.targetRay === undefined ) {
+
+ controller.targetRay = new Group();
+ controller.targetRay.matrixAutoUpdate = false;
+ controller.targetRay.visible = false;
+
+ }
+
+ return controller.targetRay;
+ };
+
+ this.getControllerGrip = function ( id ) {
+
+ var controller = controllers[ id ];
+
+ if ( controller === undefined ) {
+
+ controller = {};
controllers[ id ] = controller;
}
- return controller;
+ if ( controller.grip === undefined ) {
+
+ controller.grip = new Group();
+ controller.grip.matrixAutoUpdate = false;
+ controller.grip.visible = false;
+
+ }
+
+ return controller.grip;
};
@@ -72,7 +100,17 @@ function WebXRManager( renderer, gl ) {
if ( controller ) {
- controller.dispatchEvent( { type: event.type } );
+ if ( controller.targetRay ) {
+
+ controller.targetRay.dispatchEvent( { type: event.type } );
+
+ }
+
+ if ( controller.grip ) {
+
+ controller.grip.dispatchEvent( { type: event.type } );
+
+ }
}
@@ -82,8 +120,19 @@ function WebXRManager( renderer, gl ) {
inputSourcesMap.forEach( function ( controller, inputSource ) {
- controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
- controller.visible = false;
+ if ( controller.targetRay ) {
+
+ controller.targetRay.dispatchEvent( { type: 'disconnected', data: inputSource } );
+ controller.targetRay.visible = false;
+
+ }
+
+ if ( controller.grip ) {
+
+ controller.grip.dispatchEvent( { type: 'disconnected', data: inputSource } );
+ controller.grip.visible = false;
+
+ }
} );
@@ -197,7 +246,18 @@ function WebXRManager( renderer, gl ) {
if ( controller ) {
- controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
+ if ( controller.targetRay ) {
+
+ controller.targetRay.dispatchEvent( { type: 'disconnected', data: inputSource } );
+
+ }
+
+ if ( controller.grip ) {
+
+ controller.grip.dispatchEvent( { type: 'disconnected', data: inputSource } );
+
+ }
+
inputSourcesMap.delete( inputSource );
}
@@ -213,7 +273,17 @@ function WebXRManager( renderer, gl ) {
if ( controller ) {
- controller.dispatchEvent( { type: 'connected', data: inputSource } );
+ if ( controller.targetRay ) {
+
+ controller.targetRay.dispatchEvent( { type: 'connected', data: inputSource } );
+
+ }
+
+ if ( controller.grip ) {
+
+ controller.grip.dispatchEvent( { type: 'connected', data: inputSource } );
+
+ }
}
@@ -375,23 +445,50 @@ function WebXRManager( renderer, gl ) {
var inputSource = inputSources[ i ];
+ var inputPose = null;
+ var gripPose = null;
+
if ( inputSource ) {
- var inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );
+ if ( controller.targetRay ) {
- if ( inputPose !== null ) {
+ inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );
- controller.matrix.fromArray( inputPose.transform.matrix );
- controller.matrix.decompose( controller.position, controller.rotation, controller.scale );
- controller.visible = true;
+ if ( inputPose !== null ) {
- continue;
+ controller.targetRay.matrix.fromArray( inputPose.transform.matrix );
+ controller.targetRay.matrix.decompose( controller.targetRay.position, controller.targetRay.rotation, controller.targetRay.scale );
+
+ }
+
+ }
+
+ if ( inputSource.gripSpace && controller.grip ) {
+
+ gripPose = frame.getPose( inputSource.gripSpace, referenceSpace );
+
+ if ( gripPose !== null ) {
+
+ controller.grip.matrix.fromArray( gripPose.transform.matrix );
+ controller.grip.matrix.decompose( controller.grip.position, controller.grip.rotation, controller.grip.scale );
+
+ }
}
}
- controller.visible = false;
+ if ( controller.targetRay ) {
+
+ controller.targetRay.visible = inputPose !== null;
+
+ }
+
+ if ( controller.grip ) {
+
+ controller.grip.visible = gripPose !== null;
+
+ }
}
| true |
Other | mrdoob | three.js | 21f8748968c5deac4d20bc1f933d1eea97239047.json | Upgrade dev dependencies. | package-lock.json | @@ -1,6 +1,6 @@
{
"name": "three",
- "version": "0.110.0",
+ "version": "0.112.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -31,21 +31,21 @@
"dev": true
},
"@types/estree": {
- "version": "0.0.40",
- "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.40.tgz",
- "integrity": "sha512-p3KZgMto/JyxosKGmnLDJ/dG5wf+qTRMUjHJcspC2oQKa4jP7mz+tv0ND56lLBu3ojHlhzY33Ol+khLyNmilkA==",
+ "version": "0.0.41",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.41.tgz",
+ "integrity": "sha512-rIAmXyJlqw4KEBO7+u9gxZZSQHaCNnIzYrnNmYVpgfJhxTqO0brCX0SYpqUTkVI5mwwUwzmtspLBGBKroMeynA==",
"dev": true
},
"@types/json-schema": {
- "version": "7.0.3",
- "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.3.tgz",
- "integrity": "sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A==",
+ "version": "7.0.4",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz",
+ "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==",
"dev": true
},
"@types/node": {
- "version": "12.12.14",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.14.tgz",
- "integrity": "sha512-u/SJDyXwuihpwjXy7hOOghagLEV1KdAST6syfnOk6QZAMzZuWZqXy5aYYZbh8Jdpd4escVFP0MvftHNDb9pruA==",
+ "version": "13.1.4",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-13.1.4.tgz",
+ "integrity": "sha512-Lue/mlp2egZJoHXZr4LndxDAd7i/7SQYhV0EjWfb/a4/OZ6tuVwMCVPiwkU5nsEipxEf7hmkSU7Em5VQ8P5NGA==",
"dev": true
},
"@types/webgl2": {
@@ -55,45 +55,45 @@
"dev": true
},
"@typescript-eslint/eslint-plugin": {
- "version": "2.9.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.9.0.tgz",
- "integrity": "sha512-98rfOt3NYn5Gr9wekTB8TexxN6oM8ZRvYuphPs1Atfsy419SDLYCaE30aJkRiiTCwGEY98vOhFsEVm7Zs4toQQ==",
+ "version": "2.15.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.15.0.tgz",
+ "integrity": "sha512-XRJFznI5v4K1WvIrWmjFjBAdQWaUTz4xJEdqR7+wAFsv6Q9dP3mOlE6BMNT3pdlp9eF1+bC5m5LZTmLMqffCVw==",
"dev": true,
"requires": {
- "@typescript-eslint/experimental-utils": "2.9.0",
+ "@typescript-eslint/experimental-utils": "2.15.0",
"eslint-utils": "^1.4.3",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0",
"tsutils": "^3.17.1"
}
},
"@typescript-eslint/experimental-utils": {
- "version": "2.9.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.9.0.tgz",
- "integrity": "sha512-0lOLFdpdJsCMqMSZT7l7W2ta0+GX8A3iefG3FovJjrX+QR8y6htFlFdU7aOVPL6pDvt6XcsOb8fxk5sq+girTw==",
+ "version": "2.15.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.15.0.tgz",
+ "integrity": "sha512-Qkxu5zndY5hqlcQkmA88gfLvqQulMpX/TN91XC7OuXsRf4XG5xLGie0sbpX97o/oeccjeZYRMipIsjKk/tjDHA==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
- "@typescript-eslint/typescript-estree": "2.9.0",
+ "@typescript-eslint/typescript-estree": "2.15.0",
"eslint-scope": "^5.0.0"
}
},
"@typescript-eslint/parser": {
- "version": "2.9.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.9.0.tgz",
- "integrity": "sha512-fJ+dNs3CCvEsJK2/Vg5c2ZjuQ860ySOAsodDPwBaVlrGvRN+iCNC8kUfLFL8cT49W4GSiLPa/bHiMjYXA7EhKQ==",
+ "version": "2.15.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.15.0.tgz",
+ "integrity": "sha512-6iSgQsqAYTaHw59t0tdjzZJluRAjswdGltzKEdLtcJOxR2UVTPHYvZRqkAVGCkaMVb6Fpa60NnuozNCvsSpA9g==",
"dev": true,
"requires": {
"@types/eslint-visitor-keys": "^1.0.0",
- "@typescript-eslint/experimental-utils": "2.9.0",
- "@typescript-eslint/typescript-estree": "2.9.0",
+ "@typescript-eslint/experimental-utils": "2.15.0",
+ "@typescript-eslint/typescript-estree": "2.15.0",
"eslint-visitor-keys": "^1.1.0"
}
},
"@typescript-eslint/typescript-estree": {
- "version": "2.9.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.9.0.tgz",
- "integrity": "sha512-v6btSPXEWCP594eZbM+JCXuFoXWXyF/z8kaSBSdCb83DF+Y7+xItW29SsKtSULgLemqJBT+LpT+0ZqdfH7QVmA==",
+ "version": "2.15.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.15.0.tgz",
+ "integrity": "sha512-L6Pog+w3VZzXkAdyqA0VlwybF8WcwZX+mufso86CMxSdWmcizJ38lgBdpqTbc9bo92iyi0rOvmATKiwl+amjxg==",
"dev": true,
"requires": {
"debug": "^4.1.1",
@@ -103,14 +103,6 @@
"lodash.unescape": "4.0.1",
"semver": "^6.3.0",
"tsutils": "^3.17.1"
- },
- "dependencies": {
- "semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
- "dev": true
- }
}
},
"acorn": {
@@ -153,9 +145,9 @@
}
},
"ansi-regex": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
- "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
"dev": true
},
"ansi-styles": {
@@ -299,14 +291,14 @@
"dev": true
},
"cliui": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz",
- "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==",
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
+ "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
"dev": true,
"requires": {
- "string-width": "^2.1.1",
- "strip-ansi": "^4.0.0",
- "wrap-ansi": "^2.0.0"
+ "string-width": "^3.1.0",
+ "strip-ansi": "^5.2.0",
+ "wrap-ansi": "^5.1.0"
}
},
"clone": {
@@ -339,9 +331,9 @@
},
"dependencies": {
"readable-stream": {
- "version": "2.3.6",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
- "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
+ "version": "2.3.7",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
+ "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"dev": true,
"requires": {
"core-util-is": "~1.0.0",
@@ -364,12 +356,6 @@
}
}
},
- "code-point-at": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
- "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
- "dev": true
- },
"color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
@@ -404,9 +390,9 @@
"dev": true
},
"concurrently": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-5.0.0.tgz",
- "integrity": "sha512-1yDvK8mduTIdxIxV9C60KoiOySUl/lfekpdbI+U5GXaPrgdffEavFa9QZB3vh68oWOpbCC+TuvxXV9YRPMvUrA==",
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-5.0.2.tgz",
+ "integrity": "sha512-iUNVI6PzKO0RVXV9pHWM0khvEbELxf3XLIoChaV6hHyoIaJuxQWZiOwlNysnJX5khsfvIK66+OJqRdbYrdsR1g==",
"dev": true,
"requires": {
"chalk": "^2.4.2",
@@ -415,9 +401,9 @@
"read-pkg": "^4.0.1",
"rxjs": "^6.5.2",
"spawn-command": "^0.0.2-1",
- "supports-color": "^4.5.0",
- "tree-kill": "^1.2.1",
- "yargs": "^12.0.5"
+ "supports-color": "^6.1.0",
+ "tree-kill": "^1.2.2",
+ "yargs": "^13.3.0"
}
},
"core-util-is": {
@@ -443,12 +429,20 @@
"semver": "^5.5.0",
"shebang-command": "^1.2.0",
"which": "^1.2.9"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ }
}
},
"date-fns": {
- "version": "2.4.1",
- "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.4.1.tgz",
- "integrity": "sha512-2RhmH/sjDSCYW2F3ZQxOUx/I7PvzXpi89aQL2d3OAxSTwLx6NilATeUbe0menFE3Lu5lFkOFci36ivimwYHHxw==",
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.8.1.tgz",
+ "integrity": "sha512-EL/C8IHvYRwAHYgFRse4MGAPSqlJVlOrhVYZ75iQBKrnv+ZedmYsgwH3t+BCDuZDXpoo07+q9j4qgSSOa7irJg==",
"dev": true
},
"debug": {
@@ -537,20 +531,11 @@
}
},
"emoji-regex": {
- "version": "8.0.0",
- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
- "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
+ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
"dev": true
},
- "end-of-stream": {
- "version": "1.4.4",
- "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
- "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
- "dev": true,
- "requires": {
- "once": "^1.4.0"
- }
- },
"entities": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
@@ -573,9 +558,9 @@
"dev": true
},
"eslint": {
- "version": "6.7.1",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.7.1.tgz",
- "integrity": "sha512-UWzBS79pNcsDSxgxbdjkmzn/B6BhsXMfUaOHnNwyE8nD+Q6pyT96ow2MccVayUTV4yMid4qLhMiQaywctRkBLA==",
+ "version": "6.8.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz",
+ "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
@@ -617,32 +602,11 @@
"v8-compile-cache": "^2.0.3"
},
"dependencies": {
- "ansi-regex": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
- "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
- "dev": true
- },
"regexpp": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz",
"integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==",
"dev": true
- },
- "semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
- "dev": true
- },
- "strip-ansi": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
- "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
- "dev": true,
- "requires": {
- "ansi-regex": "^4.1.0"
- }
}
}
},
@@ -753,21 +717,6 @@
"integrity": "sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg==",
"dev": true
},
- "execa": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
- "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
- "dev": true,
- "requires": {
- "cross-spawn": "^6.0.0",
- "get-stream": "^4.0.0",
- "is-stream": "^1.1.0",
- "npm-run-path": "^2.0.0",
- "p-finally": "^1.0.0",
- "signal-exit": "^3.0.0",
- "strip-eof": "^1.0.0"
- }
- },
"external-editor": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz",
@@ -795,9 +744,9 @@
"dev": true
},
"fast-json-stable-stringify": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
- "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
"dev": true
},
"fast-levenshtein": {
@@ -883,20 +832,11 @@
"dev": true
},
"get-caller-file": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
- "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==",
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true
},
- "get-stream": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
- "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
- "dev": true,
- "requires": {
- "pump": "^3.0.0"
- }
- },
"glob": {
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
@@ -930,17 +870,17 @@
}
},
"google-closure-compiler": {
- "version": "20190929.0.0",
- "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20190929.0.0.tgz",
- "integrity": "sha512-psPXU3rfTbx4WsTOxtxCnNQqZdphdH1fS7KbqISJ3Bk1G6WMFapnCUHdnXsFz96i/XrVaTxjwUfrNdoz/F+PsA==",
+ "version": "20200101.0.0",
+ "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20200101.0.0.tgz",
+ "integrity": "sha512-UVDxedg7jbi1F+R4KSWezIZcjB4+4EJSvd2Tf/+J8vw5+6BjBFaIv5E3vy9nTpSXorKIUheJPzE+lt9GRc3Fdg==",
"dev": true,
"requires": {
"chalk": "2.x",
- "google-closure-compiler-java": "^20190929.0.0",
- "google-closure-compiler-js": "^20190929.0.0",
- "google-closure-compiler-linux": "^20190929.0.0",
- "google-closure-compiler-osx": "^20190929.0.0",
- "google-closure-compiler-windows": "^20190929.0.0",
+ "google-closure-compiler-java": "^20200101.0.0",
+ "google-closure-compiler-js": "^20200101.0.0",
+ "google-closure-compiler-linux": "^20200101.0.0",
+ "google-closure-compiler-osx": "^20200101.0.0",
+ "google-closure-compiler-windows": "^20200101.0.0",
"minimist": "1.x",
"vinyl": "2.x",
"vinyl-sourcemaps-apply": "^0.2.0"
@@ -955,35 +895,35 @@
}
},
"google-closure-compiler-java": {
- "version": "20190929.0.0",
- "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20190929.0.0.tgz",
- "integrity": "sha512-fDThDeix5BDIQrP1ESznDq6VDLxY539JF2Hhm+/+XfgXz/kfxWB6RIcsHF+pI4QdNYEEaUGsE3gvF0bYpesUUQ==",
+ "version": "20200101.0.0",
+ "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20200101.0.0.tgz",
+ "integrity": "sha512-hW4FjcEO3wAu7p/Cz8zwQIggvVio0SmnVzImukK8A6suAyHLiLDX5vhFPC31a/jyZ8uxfUSEImWrt/SFdKt0eA==",
"dev": true
},
"google-closure-compiler-js": {
- "version": "20190929.0.0",
- "resolved": "https://registry.npmjs.org/google-closure-compiler-js/-/google-closure-compiler-js-20190929.0.0.tgz",
- "integrity": "sha512-IB9GJCJPGcSNZWtferd15lA9InUaab9oWPZhJssZN3z/nsHPzV9SqKJLj2oajmcaf2uINhlOIsCVWZwC+AbwVA==",
+ "version": "20200101.0.0",
+ "resolved": "https://registry.npmjs.org/google-closure-compiler-js/-/google-closure-compiler-js-20200101.0.0.tgz",
+ "integrity": "sha512-0PdYhSU2FWkLU7eUg+0+BlnJHcGLMhWB69SzQ/0z7qBES/tuor7ruHi7HUopKaxQwhblC4DtDb8IDinieY+R1w==",
"dev": true
},
"google-closure-compiler-linux": {
- "version": "20190929.0.0",
- "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20190929.0.0.tgz",
- "integrity": "sha512-gu/H1z7MqC43rXnGGoUyGdb12kTFpkDNw0huKj1ScXNvHgq5fQteicQKd7EpiKOIlMBJbJOKoVFNpU1nrAfNvQ==",
+ "version": "20200101.0.0",
+ "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20200101.0.0.tgz",
+ "integrity": "sha512-8S1WMbRPrBXV6SUi0DyzHa9EPmyNJ8FcBUG3tIrS6hoQIP71kZl+TrSOwwUAZYKf7KhXl41P3HPMFnI4LXbtrw==",
"dev": true,
"optional": true
},
"google-closure-compiler-osx": {
- "version": "20190929.0.0",
- "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20190929.0.0.tgz",
- "integrity": "sha512-SZbp2BOhwjrJdrShZ4HrtBHOEJyKvOtka47uXyo83AdZMX22EV04z+mQCMFHtBautgG/mCsL8eX75nlMPXzkjg==",
+ "version": "20200101.0.0",
+ "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20200101.0.0.tgz",
+ "integrity": "sha512-rZh2+4/JwhKLVSwOWKBp+WJnLZCfOq6MQW06ayulhvq3WjJ0Ny9XZTpLUKiEbnMQf7+ARcFb8zIeiUp0Q2aFqg==",
"dev": true,
"optional": true
},
"google-closure-compiler-windows": {
- "version": "20190929.0.0",
- "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20190929.0.0.tgz",
- "integrity": "sha512-b1azZx19cQnYqwof+4KxWcjjOJ88QeDDIvmjCmuAZjXG5UC0os/1cutg0AeK3gZnXAsaQwAh3szy+QGKT6IgWw==",
+ "version": "20200101.0.0",
+ "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20200101.0.0.tgz",
+ "integrity": "sha512-WcH6BPPSiQq1NnOO7PxKfS0FZ+mQRz4pIoRkrItafTKXWtBCL5NZWd8BjPayBJKxsmoiVFsOpkjzLe8ryBXciQ==",
"dev": true,
"optional": true
},
@@ -1096,9 +1036,9 @@
"dev": true
},
"inquirer": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.0.tgz",
- "integrity": "sha512-rSdC7zelHdRQFkWnhsMu2+2SO41mpv2oF2zy4tMhmiLWkcKbOAs87fWAJhVXttKVwhdZvymvnuM95EyEXg2/tQ==",
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.3.tgz",
+ "integrity": "sha512-+OiOVeVydu4hnCGLCSX+wedovR/Yzskv9BFqUNNKq9uU2qg7LCcCo3R86S2E7WLo0y/x2pnEZfZe1CoYnORUAw==",
"dev": true,
"requires": {
"ansi-escapes": "^4.2.1",
@@ -1110,7 +1050,7 @@
"lodash": "^4.17.15",
"mute-stream": "0.0.8",
"run-async": "^2.2.0",
- "rxjs": "^6.4.0",
+ "rxjs": "^6.5.3",
"string-width": "^4.1.0",
"strip-ansi": "^5.1.0",
"through": "^2.3.6"
@@ -1122,6 +1062,12 @@
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
"dev": true
},
+ "emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
@@ -1149,32 +1095,9 @@
}
}
}
- },
- "strip-ansi": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
- "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
- "dev": true,
- "requires": {
- "ansi-regex": "^4.1.0"
- },
- "dependencies": {
- "ansi-regex": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
- "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
- "dev": true
- }
- }
}
}
},
- "invert-kv": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz",
- "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==",
- "dev": true
- },
"is-arrayish": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
@@ -1208,12 +1131,6 @@
"integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=",
"dev": true
},
- "is-stream": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
- "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
- "dev": true
- },
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
@@ -1272,15 +1189,6 @@
"integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
"dev": true
},
- "lcid": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz",
- "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==",
- "dev": true,
- "requires": {
- "invert-kv": "^2.0.0"
- }
- },
"levn": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
@@ -1322,26 +1230,6 @@
"sourcemap-codec": "^1.4.4"
}
},
- "map-age-cleaner": {
- "version": "0.1.3",
- "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz",
- "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==",
- "dev": true,
- "requires": {
- "p-defer": "^1.0.0"
- }
- },
- "mem": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz",
- "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==",
- "dev": true,
- "requires": {
- "map-age-cleaner": "^0.1.1",
- "mimic-fn": "^2.0.0",
- "p-is-promise": "^2.0.0"
- }
- },
"mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
@@ -1371,7 +1259,7 @@
},
"mkdirp": {
"version": "0.5.1",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
+ "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"requires": {
@@ -1418,23 +1306,16 @@
"resolve": "^1.10.0",
"semver": "2 || 3 || 4 || 5",
"validate-npm-package-license": "^3.0.1"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ }
}
},
- "npm-run-path": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
- "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
- "dev": true,
- "requires": {
- "path-key": "^2.0.0"
- }
- },
- "number-is-nan": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
- "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
- "dev": true
- },
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@@ -1489,45 +1370,16 @@
"integrity": "sha512-saRNz0DSC5C/I++gFIaJTXoFJMRwiP5zHar5vV3xQ2TkgEw6hDCcU5F272JjUylpiVgBrZNQHnfjkLabTfb92Q==",
"dev": true
},
- "os-locale": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz",
- "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==",
- "dev": true,
- "requires": {
- "execa": "^1.0.0",
- "lcid": "^2.0.0",
- "mem": "^4.0.0"
- }
- },
"os-tmpdir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
"dev": true
},
- "p-defer": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz",
- "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=",
- "dev": true
- },
- "p-finally": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
- "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
- "dev": true
- },
- "p-is-promise": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz",
- "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==",
- "dev": true
- },
"p-limit": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz",
- "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==",
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz",
+ "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==",
"dev": true,
"requires": {
"p-try": "^2.0.0"
@@ -1637,16 +1489,6 @@
"integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
"dev": true
},
- "pump": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
- "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
- "dev": true,
- "requires": {
- "end-of-stream": "^1.1.0",
- "once": "^1.3.1"
- }
- },
"punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
@@ -1774,9 +1616,9 @@
"dev": true
},
"require-main-filename": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz",
- "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
+ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
"dev": true
},
"requires-port": {
@@ -1786,9 +1628,9 @@
"dev": true
},
"resolve": {
- "version": "1.12.0",
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
- "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==",
+ "version": "1.14.2",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.2.tgz",
+ "integrity": "sha512-EjlOBLBO1kxsUxsKjLt7TAECyKW6fOh1VRkykQkKGzcBbjjPIxBqGh0jf7GJ3k/f5mxMqW3htMD3WdTUVtW8HQ==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
@@ -1820,9 +1662,9 @@
}
},
"rollup": {
- "version": "1.27.5",
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.27.5.tgz",
- "integrity": "sha512-8rfVdzuTg2kt8ObD9LNJpEwUN7B6lsl3sHc5fddtgICpLjpYeSf4m2+RftBzcCaBTMi1iYX3Ez8zFT4Gj2nJjg==",
+ "version": "1.28.0",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.28.0.tgz",
+ "integrity": "sha512-v2J/DmQi9+Nf6frGqzwZRvbiuTTrqH0yzoUF4Eybf8sONT4UpLZzJYnYzW96Zm9X1+4SJmijfnFBWCzHDAXYnQ==",
"dev": true,
"requires": {
"@types/estree": "*",
@@ -1859,9 +1701,9 @@
}
},
"rxjs": {
- "version": "6.5.2",
- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.2.tgz",
- "integrity": "sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg==",
+ "version": "6.5.4",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz",
+ "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==",
"dev": true,
"requires": {
"tslib": "^1.9.0"
@@ -1886,9 +1728,9 @@
"dev": true
},
"semver": {
- "version": "5.7.1",
- "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
- "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"dev": true
},
"set-blocking": {
@@ -1986,13 +1828,14 @@
"dev": true
},
"string-width": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
- "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
"dev": true,
"requires": {
+ "emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0",
- "strip-ansi": "^4.0.0"
+ "strip-ansi": "^5.1.0"
}
},
"string_decoder": {
@@ -2005,41 +1848,27 @@
}
},
"strip-ansi": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
- "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"dev": true,
"requires": {
- "ansi-regex": "^3.0.0"
+ "ansi-regex": "^4.1.0"
}
},
- "strip-eof": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
- "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
- "dev": true
- },
"strip-json-comments": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz",
"integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==",
"dev": true
},
"supports-color": {
- "version": "4.5.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
- "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
+ "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
"dev": true,
"requires": {
- "has-flag": "^2.0.0"
- },
- "dependencies": {
- "has-flag": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
- "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
- "dev": true
- }
+ "has-flag": "^3.0.0"
}
},
"table": {
@@ -2052,40 +1881,6 @@
"lodash": "^4.17.14",
"slice-ansi": "^2.1.0",
"string-width": "^3.0.0"
- },
- "dependencies": {
- "ansi-regex": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
- "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
- "dev": true
- },
- "emoji-regex": {
- "version": "7.0.3",
- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
- "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
- "dev": true
- },
- "string-width": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
- "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
- "dev": true,
- "requires": {
- "emoji-regex": "^7.0.1",
- "is-fullwidth-code-point": "^2.0.0",
- "strip-ansi": "^5.1.0"
- }
- },
- "strip-ansi": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
- "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
- "dev": true,
- "requires": {
- "ansi-regex": "^4.1.0"
- }
- }
}
},
"text-table": {
@@ -2110,9 +1905,9 @@
}
},
"tree-kill": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.1.tgz",
- "integrity": "sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q==",
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",
+ "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==",
"dev": true
},
"tslib": {
@@ -2146,9 +1941,9 @@
"dev": true
},
"typescript": {
- "version": "3.7.2",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.2.tgz",
- "integrity": "sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ==",
+ "version": "3.7.4",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz",
+ "integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==",
"dev": true
},
"unicode-canonical-property-names-ecmascript": {
@@ -2276,50 +2071,14 @@
"dev": true
},
"wrap-ansi": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
- "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
+ "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
"dev": true,
"requires": {
- "string-width": "^1.0.1",
- "strip-ansi": "^3.0.1"
- },
- "dependencies": {
- "ansi-regex": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
- "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
- "dev": true
- },
- "is-fullwidth-code-point": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
- "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
- "dev": true,
- "requires": {
- "number-is-nan": "^1.0.0"
- }
- },
- "string-width": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
- "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
- "dev": true,
- "requires": {
- "code-point-at": "^1.0.0",
- "is-fullwidth-code-point": "^1.0.0",
- "strip-ansi": "^3.0.0"
- }
- },
- "strip-ansi": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
- "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
- "dev": true,
- "requires": {
- "ansi-regex": "^2.0.0"
- }
- }
+ "ansi-styles": "^3.2.0",
+ "string-width": "^3.0.0",
+ "strip-ansi": "^5.0.0"
}
},
"wrappy": {
@@ -2344,29 +2103,27 @@
"dev": true
},
"yargs": {
- "version": "12.0.5",
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz",
- "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==",
+ "version": "13.3.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz",
+ "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==",
"dev": true,
"requires": {
- "cliui": "^4.0.0",
- "decamelize": "^1.2.0",
+ "cliui": "^5.0.0",
"find-up": "^3.0.0",
- "get-caller-file": "^1.0.1",
- "os-locale": "^3.0.0",
+ "get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
- "require-main-filename": "^1.0.1",
+ "require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
- "string-width": "^2.0.0",
+ "string-width": "^3.0.0",
"which-module": "^2.0.0",
- "y18n": "^3.2.1 || ^4.0.0",
- "yargs-parser": "^11.1.1"
+ "y18n": "^4.0.0",
+ "yargs-parser": "^13.1.1"
}
},
"yargs-parser": {
- "version": "11.1.1",
- "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz",
- "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==",
+ "version": "13.1.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz",
+ "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==",
"dev": true,
"requires": {
"camelcase": "^5.0.0", | true |
Other | mrdoob | three.js | 21f8748968c5deac4d20bc1f933d1eea97239047.json | Upgrade dev dependencies. | package.json | @@ -73,19 +73,19 @@
"homepage": "https://threejs.org/",
"devDependencies": {
"@types/webgl2": "^0.0.5",
- "@typescript-eslint/eslint-plugin": "^2.9.0",
- "@typescript-eslint/parser": "^2.9.0",
- "concurrently": "^5.0.0",
- "eslint": "^6.7.1",
+ "@typescript-eslint/eslint-plugin": "^2.15.0",
+ "@typescript-eslint/parser": "^2.15.0",
+ "concurrently": "^5.0.2",
+ "eslint": "^6.8.0",
"eslint-config-mdcs": "^4.2.3",
"eslint-plugin-html": "^6.0.0",
"failonlyreporter": "^1.0.0",
- "google-closure-compiler": "20190929.0.0",
+ "google-closure-compiler": "20200101.0.0",
"http-server": "^0.12.0",
"qunit": "^2.9.3",
- "rollup": "^1.27.5",
+ "rollup": "^1.28.0",
"rollup-plugin-buble": "^0.19.8",
- "typescript": "^3.7.2"
+ "typescript": "^3.7.4"
},
"jspm": {
"files": [ | true |
Other | mrdoob | three.js | bbb981b2fa8940fe234d990dd3bc982993980bec.json | Simplify the fix by using a 0-length array instead
To avoid creating new Array objects, just change the length to 0; we
can't index into the array anyhow. | src/renderers/webgl/WebGLMorphtargets.js | @@ -18,15 +18,10 @@ function WebGLMorphtargets( gl ) {
var objectInfluences = object.morphTargetInfluences;
- if ( objectInfluences === undefined ) {
+ // When object doesn't have morph target influences defined, we treat it as a 0-length array
+ // This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences
- program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', 1.0 );
- program.getUniforms().setValue( gl, 'morphTargetInfluences', morphInfluencesZero );
- return;
-
- }
-
- var length = objectInfluences.length;
+ var length = objectInfluences === undefined ? 0 : objectInfluences.length;
var influences = influencesList[ geometry.id ];
| false |
Other | mrdoob | three.js | 997ff21d0f3db6b993d25bc36d556fe98421195c.json | Add convenience methods | docs/api/en/core/BufferAttribute.html | @@ -113,6 +113,18 @@ <h3>[property:Integer version]</h3>
<h2>Methods</h2>
+ <h3>[method:this applyMatrix3]( [param:Matrix3 m] )</h3>
+ <p>Applies matrix [page:Matrix3 m] to every Vector3 element of this BufferAttribute.</p>
+
+ <h3>[method:this applyMatrix4]( [param:Matrix4 m] )</h3>
+ <p>Applies matrix [page:Matrix4 m] to every Vector3 element of this BufferAttribute.</p>
+
+ <h3>[method:this applyNormalMatrix]( [param:Matrix3 m] )</h3>
+ <p>Applies normal matrix [page:Matrix3 m] to every Vector3 element of this BufferAttribute.</p>
+
+ <h3>[method:this transformDirection]( [param:Matrix4 m] )</h3>
+ <p>Applies matrix [page:Matrix4 m] to every Vector3 element of this BufferAttribute, interpreting the elements as a direction vectors.</p>
+
<h3>[method:BufferAttribute clone]() </h3>
<p>Return a copy of this bufferAttribute.</p>
| true |
Other | mrdoob | three.js | 997ff21d0f3db6b993d25bc36d556fe98421195c.json | Add convenience methods | src/core/BufferAttribute.d.ts | @@ -43,6 +43,10 @@ export class BufferAttribute {
copyVector4sArray(
vectors: { x: number; y: number; z: number; w: number }[]
): this;
+ applyMatrix3( m: Matrix3 ): this;
+ applyMatrix4( m: Matrix4 ): this;
+ applyNormalMatrix( m: Matrix3 ): this;
+ transformDirection( m: Matrix4 ): this;
set(
value: ArrayLike<number> | ArrayBufferView,
offset?: number | true |
Other | mrdoob | three.js | 997ff21d0f3db6b993d25bc36d556fe98421195c.json | Add convenience methods | src/core/BufferAttribute.js | @@ -8,6 +8,8 @@ import { StaticDrawUsage } from '../constants.js';
* @author mrdoob / http://mrdoob.com/
*/
+var _vector = new Vector3();
+
function BufferAttribute( array, itemSize, normalized ) {
if ( Array.isArray( array ) ) {
@@ -191,6 +193,78 @@ Object.assign( BufferAttribute.prototype, {
},
+ applyMatrix3: function ( m ) {
+
+ for ( var i = 0, l = this.count; i < l; i ++ ) {
+
+ _vector.x = this.getX( i );
+ _vector.y = this.getY( i );
+ _vector.z = this.getZ( i );
+
+ _vector.applyMatrix3( m );
+
+ this.setXYZ( i, _vector.x, _vector.y, _vector.z );
+
+ }
+
+ return this;
+
+ },
+
+ applyMatrix4: function ( m ) {
+
+ for ( var i = 0, l = this.count; i < l; i ++ ) {
+
+ _vector.x = this.getX( i );
+ _vector.y = this.getY( i );
+ _vector.z = this.getZ( i );
+
+ _vector.applyMatrix4( m );
+
+ this.setXYZ( i, _vector.x, _vector.y, _vector.z );
+
+ }
+
+ return this;
+
+ },
+
+ applyNormalMatrix: function ( m ) {
+
+ for ( var i = 0, l = this.count; i < l; i ++ ) {
+
+ _vector.x = this.getX( i );
+ _vector.y = this.getY( i );
+ _vector.z = this.getZ( i );
+
+ _vector.applyNormalMatrix( m );
+
+ this.setXYZ( i, _vector.x, _vector.y, _vector.z );
+
+ }
+
+ return this;
+
+ },
+
+ transformDirection: function ( m ) {
+
+ for ( var i = 0, l = this.count; i < l; i ++ ) {
+
+ _vector.x = this.getX( i );
+ _vector.y = this.getY( i );
+ _vector.z = this.getZ( i );
+
+ _vector.transformDirection( m );
+
+ this.setXYZ( i, _vector.x, _vector.y, _vector.z );
+
+ }
+
+ return this;
+
+ },
+
set: function ( value, offset ) {
if ( offset === undefined ) offset = 0; | true |
Other | mrdoob | three.js | 5dbabb2e0cce56be1199aabc75d0e9d1709c35fd.json | Fix path to core/* imports | src/renderers/WebGLRenderer.d.ts | @@ -17,8 +17,8 @@ import { Fog } from './../scenes/Fog';
import { ToneMapping, ShadowMapType, CullFace } from '../constants';
import { WebVRManager } from '../renderers/webvr/WebVRManager';
import { RenderTarget } from './webgl/WebGLRenderLists';
-import { Geometry } from './core/Geometry';
-import { BufferGeometry } from './core/BufferGeometry';
+import { Geometry } from './../core/Geometry';
+import { BufferGeometry } from './../core/BufferGeometry';
export interface Renderer {
domElement: HTMLCanvasElement; | false |
Other | mrdoob | three.js | 8837ce97a76573ab754784a004bb52bebffb4561.json | Fix imports for WebGLRenderer.d.ts
Missing imports for Geometry and BufferGeometry causes issues in typescript projects. | src/renderers/WebGLRenderer.d.ts | @@ -17,6 +17,8 @@ import { Fog } from './../scenes/Fog';
import { ToneMapping, ShadowMapType, CullFace } from '../constants';
import { WebVRManager } from '../renderers/webvr/WebVRManager';
import { RenderTarget } from './webgl/WebGLRenderLists';
+import { Geometry } from './core/Geometry';
+import { BufferGeometry } from './core/BufferGeometry';
export interface Renderer {
domElement: HTMLCanvasElement; | false |
Other | mrdoob | three.js | 8cc9cbccb18600d7b956daec2206bfdb5847739d.json | Fix non-optional args | src/helpers/Box3Helper.d.ts | @@ -4,7 +4,7 @@ import { LineSegments } from './../objects/LineSegments';
export class Box3Helper extends LineSegments {
- constructor( box?: Box3, color?: Color );
+ constructor( box: Box3, color?: Color );
box: Box3;
| true |
Other | mrdoob | three.js | 8cc9cbccb18600d7b956daec2206bfdb5847739d.json | Fix non-optional args | src/helpers/BoxHelper.d.ts | @@ -4,7 +4,7 @@ import { LineSegments } from './../objects/LineSegments';
export class BoxHelper extends LineSegments {
- constructor( object?: Object3D, color?: Color );
+ constructor( object: Object3D, color?: Color );
update( object?: Object3D ): void;
| true |
Other | mrdoob | three.js | 666443436ca23d4932e5dfba75174499adce0e1c.json | replace var with const | src/constants.js | @@ -1,200 +1,200 @@
-export var REVISION = '117dev';
-export var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
-export var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
-export var CullFaceNone = 0;
-export var CullFaceBack = 1;
-export var CullFaceFront = 2;
-export var CullFaceFrontBack = 3;
-export var FrontFaceDirectionCW = 0;
-export var FrontFaceDirectionCCW = 1;
-export var BasicShadowMap = 0;
-export var PCFShadowMap = 1;
-export var PCFSoftShadowMap = 2;
-export var VSMShadowMap = 3;
-export var FrontSide = 0;
-export var BackSide = 1;
-export var DoubleSide = 2;
-export var FlatShading = 1;
-export var SmoothShading = 2;
-export var NoBlending = 0;
-export var NormalBlending = 1;
-export var AdditiveBlending = 2;
-export var SubtractiveBlending = 3;
-export var MultiplyBlending = 4;
-export var CustomBlending = 5;
-export var AddEquation = 100;
-export var SubtractEquation = 101;
-export var ReverseSubtractEquation = 102;
-export var MinEquation = 103;
-export var MaxEquation = 104;
-export var ZeroFactor = 200;
-export var OneFactor = 201;
-export var SrcColorFactor = 202;
-export var OneMinusSrcColorFactor = 203;
-export var SrcAlphaFactor = 204;
-export var OneMinusSrcAlphaFactor = 205;
-export var DstAlphaFactor = 206;
-export var OneMinusDstAlphaFactor = 207;
-export var DstColorFactor = 208;
-export var OneMinusDstColorFactor = 209;
-export var SrcAlphaSaturateFactor = 210;
-export var NeverDepth = 0;
-export var AlwaysDepth = 1;
-export var LessDepth = 2;
-export var LessEqualDepth = 3;
-export var EqualDepth = 4;
-export var GreaterEqualDepth = 5;
-export var GreaterDepth = 6;
-export var NotEqualDepth = 7;
-export var MultiplyOperation = 0;
-export var MixOperation = 1;
-export var AddOperation = 2;
-export var NoToneMapping = 0;
-export var LinearToneMapping = 1;
-export var ReinhardToneMapping = 2;
-export var Uncharted2ToneMapping = 3;
-export var CineonToneMapping = 4;
-export var ACESFilmicToneMapping = 5;
+export const REVISION = '117dev';
+export const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
+export const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
+export const CullFaceNone = 0;
+export const CullFaceBack = 1;
+export const CullFaceFront = 2;
+export const CullFaceFrontBack = 3;
+export const FrontFaceDirectionCW = 0;
+export const FrontFaceDirectionCCW = 1;
+export const BasicShadowMap = 0;
+export const PCFShadowMap = 1;
+export const PCFSoftShadowMap = 2;
+export const VSMShadowMap = 3;
+export const FrontSide = 0;
+export const BackSide = 1;
+export const DoubleSide = 2;
+export const FlatShading = 1;
+export const SmoothShading = 2;
+export const NoBlending = 0;
+export const NormalBlending = 1;
+export const AdditiveBlending = 2;
+export const SubtractiveBlending = 3;
+export const MultiplyBlending = 4;
+export const CustomBlending = 5;
+export const AddEquation = 100;
+export const SubtractEquation = 101;
+export const ReverseSubtractEquation = 102;
+export const MinEquation = 103;
+export const MaxEquation = 104;
+export const ZeroFactor = 200;
+export const OneFactor = 201;
+export const SrcColorFactor = 202;
+export const OneMinusSrcColorFactor = 203;
+export const SrcAlphaFactor = 204;
+export const OneMinusSrcAlphaFactor = 205;
+export const DstAlphaFactor = 206;
+export const OneMinusDstAlphaFactor = 207;
+export const DstColorFactor = 208;
+export const OneMinusDstColorFactor = 209;
+export const SrcAlphaSaturateFactor = 210;
+export const NeverDepth = 0;
+export const AlwaysDepth = 1;
+export const LessDepth = 2;
+export const LessEqualDepth = 3;
+export const EqualDepth = 4;
+export const GreaterEqualDepth = 5;
+export const GreaterDepth = 6;
+export const NotEqualDepth = 7;
+export const MultiplyOperation = 0;
+export const MixOperation = 1;
+export const AddOperation = 2;
+export const NoToneMapping = 0;
+export const LinearToneMapping = 1;
+export const ReinhardToneMapping = 2;
+export const Uncharted2ToneMapping = 3;
+export const CineonToneMapping = 4;
+export const ACESFilmicToneMapping = 5;
-export var UVMapping = 300;
-export var CubeReflectionMapping = 301;
-export var CubeRefractionMapping = 302;
-export var EquirectangularReflectionMapping = 303;
-export var EquirectangularRefractionMapping = 304;
-export var SphericalReflectionMapping = 305;
-export var CubeUVReflectionMapping = 306;
-export var CubeUVRefractionMapping = 307;
-export var RepeatWrapping = 1000;
-export var ClampToEdgeWrapping = 1001;
-export var MirroredRepeatWrapping = 1002;
-export var NearestFilter = 1003;
-export var NearestMipmapNearestFilter = 1004;
-export var NearestMipMapNearestFilter = 1004;
-export var NearestMipmapLinearFilter = 1005;
-export var NearestMipMapLinearFilter = 1005;
-export var LinearFilter = 1006;
-export var LinearMipmapNearestFilter = 1007;
-export var LinearMipMapNearestFilter = 1007;
-export var LinearMipmapLinearFilter = 1008;
-export var LinearMipMapLinearFilter = 1008;
-export var UnsignedByteType = 1009;
-export var ByteType = 1010;
-export var ShortType = 1011;
-export var UnsignedShortType = 1012;
-export var IntType = 1013;
-export var UnsignedIntType = 1014;
-export var FloatType = 1015;
-export var HalfFloatType = 1016;
-export var UnsignedShort4444Type = 1017;
-export var UnsignedShort5551Type = 1018;
-export var UnsignedShort565Type = 1019;
-export var UnsignedInt248Type = 1020;
-export var AlphaFormat = 1021;
-export var RGBFormat = 1022;
-export var RGBAFormat = 1023;
-export var LuminanceFormat = 1024;
-export var LuminanceAlphaFormat = 1025;
-export var RGBEFormat = RGBAFormat;
-export var DepthFormat = 1026;
-export var DepthStencilFormat = 1027;
-export var RedFormat = 1028;
-export var RedIntegerFormat = 1029;
-export var RGFormat = 1030;
-export var RGIntegerFormat = 1031;
-export var RGBIntegerFormat = 1032;
-export var RGBAIntegerFormat = 1033;
+export const UVMapping = 300;
+export const CubeReflectionMapping = 301;
+export const CubeRefractionMapping = 302;
+export const EquirectangularReflectionMapping = 303;
+export const EquirectangularRefractionMapping = 304;
+export const SphericalReflectionMapping = 305;
+export const CubeUVReflectionMapping = 306;
+export const CubeUVRefractionMapping = 307;
+export const RepeatWrapping = 1000;
+export const ClampToEdgeWrapping = 1001;
+export const MirroredRepeatWrapping = 1002;
+export const NearestFilter = 1003;
+export const NearestMipmapNearestFilter = 1004;
+export const NearestMipMapNearestFilter = 1004;
+export const NearestMipmapLinearFilter = 1005;
+export const NearestMipMapLinearFilter = 1005;
+export const LinearFilter = 1006;
+export const LinearMipmapNearestFilter = 1007;
+export const LinearMipMapNearestFilter = 1007;
+export const LinearMipmapLinearFilter = 1008;
+export const LinearMipMapLinearFilter = 1008;
+export const UnsignedByteType = 1009;
+export const ByteType = 1010;
+export const ShortType = 1011;
+export const UnsignedShortType = 1012;
+export const IntType = 1013;
+export const UnsignedIntType = 1014;
+export const FloatType = 1015;
+export const HalfFloatType = 1016;
+export const UnsignedShort4444Type = 1017;
+export const UnsignedShort5551Type = 1018;
+export const UnsignedShort565Type = 1019;
+export const UnsignedInt248Type = 1020;
+export const AlphaFormat = 1021;
+export const RGBFormat = 1022;
+export const RGBAFormat = 1023;
+export const LuminanceFormat = 1024;
+export const LuminanceAlphaFormat = 1025;
+export const RGBEFormat = RGBAFormat;
+export const DepthFormat = 1026;
+export const DepthStencilFormat = 1027;
+export const RedFormat = 1028;
+export const RedIntegerFormat = 1029;
+export const RGFormat = 1030;
+export const RGIntegerFormat = 1031;
+export const RGBIntegerFormat = 1032;
+export const RGBAIntegerFormat = 1033;
-export var RGB_S3TC_DXT1_Format = 33776;
-export var RGBA_S3TC_DXT1_Format = 33777;
-export var RGBA_S3TC_DXT3_Format = 33778;
-export var RGBA_S3TC_DXT5_Format = 33779;
-export var RGB_PVRTC_4BPPV1_Format = 35840;
-export var RGB_PVRTC_2BPPV1_Format = 35841;
-export var RGBA_PVRTC_4BPPV1_Format = 35842;
-export var RGBA_PVRTC_2BPPV1_Format = 35843;
-export var RGB_ETC1_Format = 36196;
-export var RGB_ETC2_Format = 37492;
-export var RGBA_ETC2_EAC_Format = 37496;
-export var RGBA_ASTC_4x4_Format = 37808;
-export var RGBA_ASTC_5x4_Format = 37809;
-export var RGBA_ASTC_5x5_Format = 37810;
-export var RGBA_ASTC_6x5_Format = 37811;
-export var RGBA_ASTC_6x6_Format = 37812;
-export var RGBA_ASTC_8x5_Format = 37813;
-export var RGBA_ASTC_8x6_Format = 37814;
-export var RGBA_ASTC_8x8_Format = 37815;
-export var RGBA_ASTC_10x5_Format = 37816;
-export var RGBA_ASTC_10x6_Format = 37817;
-export var RGBA_ASTC_10x8_Format = 37818;
-export var RGBA_ASTC_10x10_Format = 37819;
-export var RGBA_ASTC_12x10_Format = 37820;
-export var RGBA_ASTC_12x12_Format = 37821;
-export var RGBA_BPTC_Format = 36492;
-export var SRGB8_ALPHA8_ASTC_4x4_Format = 37840;
-export var SRGB8_ALPHA8_ASTC_5x4_Format = 37841;
-export var SRGB8_ALPHA8_ASTC_5x5_Format = 37842;
-export var SRGB8_ALPHA8_ASTC_6x5_Format = 37843;
-export var SRGB8_ALPHA8_ASTC_6x6_Format = 37844;
-export var SRGB8_ALPHA8_ASTC_8x5_Format = 37845;
-export var SRGB8_ALPHA8_ASTC_8x6_Format = 37846;
-export var SRGB8_ALPHA8_ASTC_8x8_Format = 37847;
-export var SRGB8_ALPHA8_ASTC_10x5_Format = 37848;
-export var SRGB8_ALPHA8_ASTC_10x6_Format = 37849;
-export var SRGB8_ALPHA8_ASTC_10x8_Format = 37850;
-export var SRGB8_ALPHA8_ASTC_10x10_Format = 37851;
-export var SRGB8_ALPHA8_ASTC_12x10_Format = 37852;
-export var SRGB8_ALPHA8_ASTC_12x12_Format = 37853;
-export var LoopOnce = 2200;
-export var LoopRepeat = 2201;
-export var LoopPingPong = 2202;
-export var InterpolateDiscrete = 2300;
-export var InterpolateLinear = 2301;
-export var InterpolateSmooth = 2302;
-export var ZeroCurvatureEnding = 2400;
-export var ZeroSlopeEnding = 2401;
-export var WrapAroundEnding = 2402;
-export var NormalAnimationBlendMode = 2500;
-export var AdditiveAnimationBlendMode = 2501;
-export var TrianglesDrawMode = 0;
-export var TriangleStripDrawMode = 1;
-export var TriangleFanDrawMode = 2;
-export var LinearEncoding = 3000;
-export var sRGBEncoding = 3001;
-export var GammaEncoding = 3007;
-export var RGBEEncoding = 3002;
-export var LogLuvEncoding = 3003;
-export var RGBM7Encoding = 3004;
-export var RGBM16Encoding = 3005;
-export var RGBDEncoding = 3006;
-export var BasicDepthPacking = 3200;
-export var RGBADepthPacking = 3201;
-export var TangentSpaceNormalMap = 0;
-export var ObjectSpaceNormalMap = 1;
+export const RGB_S3TC_DXT1_Format = 33776;
+export const RGBA_S3TC_DXT1_Format = 33777;
+export const RGBA_S3TC_DXT3_Format = 33778;
+export const RGBA_S3TC_DXT5_Format = 33779;
+export const RGB_PVRTC_4BPPV1_Format = 35840;
+export const RGB_PVRTC_2BPPV1_Format = 35841;
+export const RGBA_PVRTC_4BPPV1_Format = 35842;
+export const RGBA_PVRTC_2BPPV1_Format = 35843;
+export const RGB_ETC1_Format = 36196;
+export const RGB_ETC2_Format = 37492;
+export const RGBA_ETC2_EAC_Format = 37496;
+export const RGBA_ASTC_4x4_Format = 37808;
+export const RGBA_ASTC_5x4_Format = 37809;
+export const RGBA_ASTC_5x5_Format = 37810;
+export const RGBA_ASTC_6x5_Format = 37811;
+export const RGBA_ASTC_6x6_Format = 37812;
+export const RGBA_ASTC_8x5_Format = 37813;
+export const RGBA_ASTC_8x6_Format = 37814;
+export const RGBA_ASTC_8x8_Format = 37815;
+export const RGBA_ASTC_10x5_Format = 37816;
+export const RGBA_ASTC_10x6_Format = 37817;
+export const RGBA_ASTC_10x8_Format = 37818;
+export const RGBA_ASTC_10x10_Format = 37819;
+export const RGBA_ASTC_12x10_Format = 37820;
+export const RGBA_ASTC_12x12_Format = 37821;
+export const RGBA_BPTC_Format = 36492;
+export const SRGB8_ALPHA8_ASTC_4x4_Format = 37840;
+export const SRGB8_ALPHA8_ASTC_5x4_Format = 37841;
+export const SRGB8_ALPHA8_ASTC_5x5_Format = 37842;
+export const SRGB8_ALPHA8_ASTC_6x5_Format = 37843;
+export const SRGB8_ALPHA8_ASTC_6x6_Format = 37844;
+export const SRGB8_ALPHA8_ASTC_8x5_Format = 37845;
+export const SRGB8_ALPHA8_ASTC_8x6_Format = 37846;
+export const SRGB8_ALPHA8_ASTC_8x8_Format = 37847;
+export const SRGB8_ALPHA8_ASTC_10x5_Format = 37848;
+export const SRGB8_ALPHA8_ASTC_10x6_Format = 37849;
+export const SRGB8_ALPHA8_ASTC_10x8_Format = 37850;
+export const SRGB8_ALPHA8_ASTC_10x10_Format = 37851;
+export const SRGB8_ALPHA8_ASTC_12x10_Format = 37852;
+export const SRGB8_ALPHA8_ASTC_12x12_Format = 37853;
+export const LoopOnce = 2200;
+export const LoopRepeat = 2201;
+export const LoopPingPong = 2202;
+export const InterpolateDiscrete = 2300;
+export const InterpolateLinear = 2301;
+export const InterpolateSmooth = 2302;
+export const ZeroCurvatureEnding = 2400;
+export const ZeroSlopeEnding = 2401;
+export const WrapAroundEnding = 2402;
+export const NormalAnimationBlendMode = 2500;
+export const AdditiveAnimationBlendMode = 2501;
+export const TrianglesDrawMode = 0;
+export const TriangleStripDrawMode = 1;
+export const TriangleFanDrawMode = 2;
+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;
+export const BasicDepthPacking = 3200;
+export const RGBADepthPacking = 3201;
+export const TangentSpaceNormalMap = 0;
+export const ObjectSpaceNormalMap = 1;
-export var ZeroStencilOp = 0;
-export var KeepStencilOp = 7680;
-export var ReplaceStencilOp = 7681;
-export var IncrementStencilOp = 7682;
-export var DecrementStencilOp = 7683;
-export var IncrementWrapStencilOp = 34055;
-export var DecrementWrapStencilOp = 34056;
-export var InvertStencilOp = 5386;
+export const ZeroStencilOp = 0;
+export const KeepStencilOp = 7680;
+export const ReplaceStencilOp = 7681;
+export const IncrementStencilOp = 7682;
+export const DecrementStencilOp = 7683;
+export const IncrementWrapStencilOp = 34055;
+export const DecrementWrapStencilOp = 34056;
+export const InvertStencilOp = 5386;
-export var NeverStencilFunc = 512;
-export var LessStencilFunc = 513;
-export var EqualStencilFunc = 514;
-export var LessEqualStencilFunc = 515;
-export var GreaterStencilFunc = 516;
-export var NotEqualStencilFunc = 517;
-export var GreaterEqualStencilFunc = 518;
-export var AlwaysStencilFunc = 519;
+export const NeverStencilFunc = 512;
+export const LessStencilFunc = 513;
+export const EqualStencilFunc = 514;
+export const LessEqualStencilFunc = 515;
+export const GreaterStencilFunc = 516;
+export const NotEqualStencilFunc = 517;
+export const GreaterEqualStencilFunc = 518;
+export const AlwaysStencilFunc = 519;
-export var StaticDrawUsage = 35044;
-export var DynamicDrawUsage = 35048;
-export var StreamDrawUsage = 35040;
-export var StaticReadUsage = 35045;
-export var DynamicReadUsage = 35049;
-export var StreamReadUsage = 35041;
-export var StaticCopyUsage = 35046;
-export var DynamicCopyUsage = 35050;
-export var StreamCopyUsage = 35042;
+export const StaticDrawUsage = 35044;
+export const DynamicDrawUsage = 35048;
+export const StreamDrawUsage = 35040;
+export const StaticReadUsage = 35045;
+export const DynamicReadUsage = 35049;
+export const StreamReadUsage = 35041;
+export const StaticCopyUsage = 35046;
+export const DynamicCopyUsage = 35050;
+export const StreamCopyUsage = 35042; | false |
Other | mrdoob | three.js | 2badf8fc4a207b85f1bf515bbbef2cf612a8a939.json | Fix lerpVectors for when v1 === this | src/math/Vector2.js | @@ -422,7 +422,10 @@ Object.assign( Vector2.prototype, {
lerpVectors: function ( v1, v2, alpha ) {
- return this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 );
+ this.x = v1.x + ( v2.x - v1.x ) * alpha;
+ this.y = v1.y + ( v2.y - v1.y ) * alpha;
+
+ return this;
},
| true |
Other | mrdoob | three.js | 2badf8fc4a207b85f1bf515bbbef2cf612a8a939.json | Fix lerpVectors for when v1 === this | src/math/Vector3.js | @@ -502,7 +502,11 @@ Object.assign( Vector3.prototype, {
lerpVectors: function ( v1, v2, alpha ) {
- return this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 );
+ this.x = v1.x + ( v2.x - v1.x ) * alpha;
+ this.y = v1.y + ( v2.y - v1.y ) * alpha;
+ this.z = v1.z + ( v2.z - v1.z ) * alpha;
+
+ return this;
},
| true |
Other | mrdoob | three.js | 2badf8fc4a207b85f1bf515bbbef2cf612a8a939.json | Fix lerpVectors for when v1 === this | src/math/Vector4.js | @@ -594,7 +594,12 @@ Object.assign( Vector4.prototype, {
lerpVectors: function ( v1, v2, alpha ) {
- return this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 );
+ this.x = v1.x + ( v2.x - v1.x ) * alpha;
+ this.y = v1.y + ( v2.y - v1.y ) * alpha;
+ this.z = v1.z + ( v2.z - v1.z ) * alpha;
+ this.w = v1.w + ( v2.w - v1.w ) * alpha;
+
+ return this;
},
| true |
Other | mrdoob | three.js | 8807afd93600242d5ba55d106e0c5ef9341bc71b.json | Support dark mode for cards | files/main.css | @@ -2,6 +2,7 @@
color-scheme: light dark;
--background-color: #fff;
+ --secondary-background-color: #f7f7f7;
--color-blue: #049EF4;
--text-color: #444;
@@ -21,6 +22,7 @@
:root {
--background-color: #222;
+ --secondary-background-color: #2e2e2e;
--text-color: #bbb;
--secondary-text-color: #666;
@@ -467,7 +469,7 @@ iframe {
.card {
border-radius: 3px;
overflow: hidden;
- background-color: #f7f7f7;
+ background-color: var(--secondary-background-color);
padding-bottom: 6px;
margin-bottom: 16px;
} | false |
Other | mrdoob | three.js | 11e7f63af9fc2d0f6c5329528df77f7650d5e27a.json | Add callback to identify customized programs
In case onBeforeCompile has conditional statements in it, the parameter values affecting the shader code can be returned from customProgramCode so the shader program is correctly fetched from cache or recompiled as needed. | docs/api/en/materials/Material.html | @@ -343,6 +343,36 @@ <h3>[method:null onBeforeCompile]( [param:Shader shader], [param:WebGLRenderer r
Unlike properties, the callback is not supported by [page:Material.clone .clone](), [page:Material.copy .copy]() and [page:Material.toJSON .toJSON]().
</p>
+ <h3>[method:String customProgramCacheKey]()</h3>
+ <p>
+ In case onBeforeCompile is used, this callback can be used to identify values of settings used in onBeforeCompile, so three.js can reuse a cached shader or recompile the shader for this material as needed.
+ </p>
+
+ <p>
+ For example, if onBeforeCompile contains a conditional statement like:<br />
+
+ <code>if ( black ) {
+
+ shader.fragmentShader = shader.fragmentShader.replace('gl_FragColor = vec4(1)', 'gl_FragColor = vec4(0)')
+
+ }
+ </code>
+
+ then customProgramCacheKey should be set like this:<br />
+
+ <code>material.customProgramCacheKey = function() {
+
+ return black ? '1' : '0';
+
+ }
+ </code>
+
+ </p>
+
+ <p>
+ Unlike properties, the callback is not supported by [page:Material.clone .clone](), [page:Material.copy .copy]() and [page:Material.toJSON .toJSON]().
+ </p>
+
<h3>[method:null setValues]( [param:object values] )</h3>
<p>
values -- a container with parameters.<br /> | true |
Other | mrdoob | three.js | 11e7f63af9fc2d0f6c5329528df77f7650d5e27a.json | Add callback to identify customized programs
In case onBeforeCompile has conditional statements in it, the parameter values affecting the shader code can be returned from customProgramCode so the shader program is correctly fetched from cache or recompiled as needed. | src/materials/Material.d.ts | @@ -334,6 +334,11 @@ export class Material extends EventDispatcher {
*/
onBeforeCompile ( shader : Shader, renderer : WebGLRenderer ) : void;
+ /**
+ * In case onBeforeCompile is used, this callback can be used to identify values of settings used in onBeforeCompile, so three.js can reuse a cached shader or recompile the shader as needed.
+ */
+ customProgramCacheKey(): string;
+
/**
* Sets the properties based on the values.
* @param values A container with parameters. | true |
Other | mrdoob | three.js | 11e7f63af9fc2d0f6c5329528df77f7650d5e27a.json | Add callback to identify customized programs
In case onBeforeCompile has conditional statements in it, the parameter values affecting the shader code can be returned from customProgramCode so the shader program is correctly fetched from cache or recompiled as needed. | src/materials/Material.js | @@ -86,6 +86,12 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
onBeforeCompile: function () {},
+ customProgramCacheKey: function () {
+
+ return this.onBeforeCompile.toString();
+
+ },
+
setValues: function ( values ) {
if ( values === undefined ) return; | true |
Other | mrdoob | three.js | 11e7f63af9fc2d0f6c5329528df77f7650d5e27a.json | Add callback to identify customized programs
In case onBeforeCompile has conditional statements in it, the parameter values affecting the shader code can be returned from customProgramCode so the shader program is correctly fetched from cache or recompiled as needed. | src/renderers/webgl/WebGLPrograms.js | @@ -288,7 +288,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
rendererExtensionDrawBuffers: isWebGL2 || extensions.get( 'WEBGL_draw_buffers' ) !== null,
rendererExtensionShaderTextureLod: isWebGL2 || extensions.get( 'EXT_shader_texture_lod' ) !== null,
- onBeforeCompile: material.onBeforeCompile
+ customProgramCacheKey: material.customProgramCacheKey()
};
@@ -335,7 +335,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
}
- array.push( parameters.onBeforeCompile.toString() );
+ array.push( parameters.customProgramCacheKey );
return array.join();
| true |
Other | mrdoob | three.js | c9988a535b65b37830e6b34da6abb4214f11706a.json | Add missing scene parameter in renderObject call | examples/js/renderers/CSS2DRenderer.js | @@ -109,7 +109,7 @@ THREE.CSS2DRenderer = function () {
for ( var i = 0, l = object.children.length; i < l; i ++ ) {
- renderObject( object.children[ i ], camera );
+ renderObject( object.children[ i ], scene, camera );
}
| false |
Other | mrdoob | three.js | 19ae9719a126bd5291600b9db64a62020700c824.json | Move generic Renderer to callback functions | examples/jsm/renderers/CSS2DRenderer.d.ts | @@ -4,13 +4,13 @@ import {
Camera
} from '../../../src/Three';
-export class CSS2DObject extends Object3D<CSS2DRenderer> {
+export class CSS2DObject extends Object3D {
constructor( element: HTMLElement );
element: HTMLElement;
- onBeforeRender: (renderer: CSS2DRenderer, scene: Scene, camera: Camera) => void;
- onAfterRender: (renderer: CSS2DRenderer, scene: Scene, camera: Camera) => void;
+ onBeforeRender: <Renderer = CSS2DRenderer>(renderer: Renderer, scene: Scene, camera: Camera) => void;
+ onAfterRender: <Renderer = CSS2DRenderer>(renderer: Renderer, scene: Scene, camera: Camera) => void;
}
| true |
Other | mrdoob | three.js | 19ae9719a126bd5291600b9db64a62020700c824.json | Move generic Renderer to callback functions | examples/jsm/renderers/CSS3DRenderer.d.ts | @@ -4,13 +4,13 @@ import {
Camera
} from '../../../src/Three';
-export class CSS3DObject extends Object3D<CSS3DRenderer> {
+export class CSS3DObject extends Object3D {
constructor( element: HTMLElement );
element: HTMLElement;
- onBeforeRender: (renderer: CSS3DRenderer, scene: Scene, camera: Camera) => void;
- onAfterRender: (renderer: CSS3DRenderer, scene: Scene, camera: Camera) => void;
+ onBeforeRender: <Renderer = CSS3DRenderer>(renderer: Renderer, scene: Scene, camera: Camera) => void;
+ onAfterRender: <Renderer = CSS3DRenderer>(renderer: Renderer, scene: Scene, camera: Camera) => void;
}
| true |
Other | mrdoob | three.js | 19ae9719a126bd5291600b9db64a62020700c824.json | Move generic Renderer to callback functions | src/core/Object3D.d.ts | @@ -20,7 +20,7 @@ export let Object3DIdCount: number;
/**
* Base class for scene graph objects
*/
-export class Object3D<Renderer = WebGLRenderer> extends EventDispatcher {
+export class Object3D extends EventDispatcher {
constructor();
@@ -153,7 +153,7 @@ export class Object3D<Renderer = WebGLRenderer> extends EventDispatcher {
/**
* Calls before rendering object
*/
- onBeforeRender: (
+ onBeforeRender: <Renderer = WebGLRenderer>(
renderer: Renderer,
scene: Scene,
camera: Camera,
@@ -165,7 +165,7 @@ export class Object3D<Renderer = WebGLRenderer> extends EventDispatcher {
/**
* Calls after rendering object
*/
- onAfterRender: (
+ onAfterRender: <Renderer = WebGLRenderer>(
renderer: Renderer,
scene: Scene,
camera: Camera, | true |
Other | mrdoob | three.js | 219240b1f8acbe714f7586a1747ec0860b5b3d23.json | fix doc: WebGLRendererParameters.alpha
by default it's false
https://github.com/mrdoob/three.js/blob/eb071dd079a328bfd156559ea1eeb619b6bda8e3/src/renderers/WebGLRenderer.js#L58 | src/renderers/WebGLRenderer.d.ts | @@ -47,7 +47,7 @@ export interface WebGLRendererParameters {
precision?: string;
/**
- * default is true.
+ * default is false.
*/
alpha?: boolean;
| false |
Other | mrdoob | three.js | 8db89be3aa0256bf459cf7b9a6ff465dba1785e3.json | Add .type property to shader | examples/js/effects/OutlineEffect.js | @@ -170,6 +170,7 @@ THREE.OutlineEffect = function ( renderer, parameters ) {
function createMaterial() {
return new THREE.ShaderMaterial( {
+ type: 'OutlineEffect',
uniforms: THREE.UniformsUtils.merge( [
THREE.UniformsLib[ 'fog' ],
THREE.UniformsLib[ 'displacementmap' ], | true |
Other | mrdoob | three.js | 8db89be3aa0256bf459cf7b9a6ff465dba1785e3.json | Add .type property to shader | examples/jsm/effects/OutlineEffect.js | @@ -178,6 +178,7 @@ var OutlineEffect = function ( renderer, parameters ) {
function createMaterial() {
return new ShaderMaterial( {
+ type: 'OutlineEffect',
uniforms: UniformsUtils.merge( [
UniformsLib[ 'fog' ],
UniformsLib[ 'displacementmap' ], | true |
Other | mrdoob | three.js | a68c862e0b9d59a975382cde669e35facc825cbb.json | fix the format problem of instancedmesh.d.ts | src/objects/InstancedMesh.d.ts | @@ -4,7 +4,7 @@ import { Material } from './../materials/Material';
import { BufferAttribute } from './../core/BufferAttribute';
import { Mesh } from './Mesh';
import { Matrix4 } from './../math/Matrix4';
-import {Intersection, Raycaster} from "../core/Raycaster";
+import { Intersection, Raycaster } from "../core/Raycaster";
export class InstancedMesh extends Mesh {
| false |
Other | mrdoob | three.js | 309154ffe6c661737934fea41d08b166e3ce1819.json | Add preload method to DRACOLoader | docs/examples/en/loaders/DRACOLoader.html | @@ -36,6 +36,9 @@ <h2>Example</h2>
// Specify path to a folder containing WASM/JS decoding libraries.
loader.setDecoderPath( '/examples/js/libs/draco' );
+ // Optional: Pre-fetch Draco WASM/JS module.
+ loader.preload();
+
// Load a Draco geometry
loader.load(
// resource URL
@@ -128,6 +131,11 @@ <h3>[method:this setWorkerLimit]( [param:Number workerLimit] )</h3>
in the application.
</p>
+ <h3>[method:Promise preload]()</h3>
+ <p>
+ Requests the decoder libraries, if not already loaded.
+ </p>
+
<h3>[method:this dispose]()</h3>
<p>
Disposes of the decoder resources and deallocates memory. The decoder | true |
Other | mrdoob | three.js | 309154ffe6c661737934fea41d08b166e3ce1819.json | Add preload method to DRACOLoader | docs/examples/zh/loaders/DRACOLoader.html | @@ -36,6 +36,9 @@ <h2>Example</h2>
// Specify path to a folder containing WASM/JS decoding libraries.
loader.setDecoderPath( '/examples/js/libs/draco' );
+ // Optional: Pre-fetch Draco WASM/JS module.
+ loader.preload();
+
// Load a Draco geometry
loader.load(
// resource URL
@@ -128,6 +131,11 @@ <h3>[method:this setWorkerLimit]( [param:Number workerLimit] )</h3>
in the application.
</p>
+ <h3>[method:Promise preload]()</h3>
+ <p>
+ Requests the decoder libraries, if not already loaded.
+ </p>
+
<h3>[method:this dispose]()</h3>
<p>
Disposes of the decoder resources and deallocates memory. The decoder | true |
Other | mrdoob | three.js | 309154ffe6c661737934fea41d08b166e3ce1819.json | Add preload method to DRACOLoader | examples/js/loaders/DRACOLoader.js | @@ -220,7 +220,7 @@ THREE.DRACOLoader.prototype = Object.assign( Object.create( THREE.Loader.prototy
},
- _initDecoder: function () {
+ preload: function () {
if ( this.decoderPending ) return this.decoderPending;
@@ -269,7 +269,7 @@ THREE.DRACOLoader.prototype = Object.assign( Object.create( THREE.Loader.prototy
_getWorker: function ( taskID, taskCost ) {
- return this._initDecoder().then( () => {
+ return this.preload().then( () => {
if ( this.workerPool.length < this.workerLimit ) {
| true |
Other | mrdoob | three.js | 309154ffe6c661737934fea41d08b166e3ce1819.json | Add preload method to DRACOLoader | examples/jsm/loaders/DRACOLoader.d.ts | @@ -12,6 +12,7 @@ export class DRACOLoader extends Loader {
setDecoderPath( path: string ): DRACOLoader;
setDecoderConfig( config: object ): DRACOLoader;
setWorkerLimit( workerLimit: number ): DRACOLoader;
+ preload(): Promise<void>;
dispose(): DRACOLoader;
} | true |
Other | mrdoob | three.js | 309154ffe6c661737934fea41d08b166e3ce1819.json | Add preload method to DRACOLoader | examples/jsm/loaders/DRACOLoader.js | @@ -227,7 +227,7 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
},
- _initDecoder: function () {
+ preload: function () {
if ( this.decoderPending ) return this.decoderPending;
@@ -276,7 +276,7 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
_getWorker: function ( taskID, taskCost ) {
- return this._initDecoder().then( () => {
+ return this.preload().then( () => {
if ( this.workerPool.length < this.workerLimit ) {
| true |
Other | mrdoob | three.js | f649588c9c4926bb613c27142397ff6d81925f66.json | fix duplicate array creation | src/objects/InstancedMesh.js | @@ -53,7 +53,7 @@ InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {
_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );
- //The agent mesh represents this single instance
+ //The mesh represents this single instance
_mesh.matrixWorld = _instanceWorldMatrix;
@@ -69,7 +69,7 @@ InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {
intersects.push( _instanceIntersects[ 0 ] );
- _instanceIntersects = [];
+ _instanceIntersects.length = 0;
}
| false |
Other | mrdoob | three.js | d0038c565750d8a62e3c0c794840b166b9ef9824.json | Make WebGLGeometries.d.ts strict | src/renderers/webgl/WebGLGeometries.d.ts | @@ -1,9 +1,17 @@
+import { WebGLAttributes } from './WebGLAttributes';
+import { WebGLInfo } from './WebGLInfo';
+import { BufferAttribute } from '../../core/BufferAttribute';
+import { BufferGeometry } from '../../core/BufferGeometry';
+import { Geometry } from '../../core/Geometry';
+import { Object3D } from '../../core/Object3D';
+
export class WebGLGeometries {
- constructor( gl: WebGLRenderingContext, attributes: any, info: any );
+ constructor( gl: WebGLRenderingContext, attributes: WebGLAttributes, info: WebGLInfo );
- get( object: any, geometry: any ): any;
- update( geometry: any ): any;
- getWireframeAttribute( geometry: any ): any;
+ get( object: Object3D, geometry: Geometry | BufferGeometry ): BufferGeometry;
+ update( geometry: Geometry | BufferGeometry );
+ updateWireframeAttribute( geometry: Geometry | BufferGeometry );
+ getWireframeAttribute( geometry: Geometry | BufferGeometry ): BufferAttribute;
} | false |
Other | mrdoob | three.js | c6e88649ce6ffd7c2ac20351890c62a9977aba33.json | update .d.ts for BufferAttributes | src/core/BufferAttribute.d.ts | @@ -16,54 +16,60 @@ export class BufferAttribute {
updateRange: { offset: number; count: number };
version: number;
normalized: boolean;
- needsUpdate: boolean;
count: number;
- onUpload: Function;
- setUsage( usage: Usage ): BufferAttribute;
- clone(): this;
+ set needsUpdate( value: boolean );
+
+ isBufferAttribute: true;
+
+ onUploadCallback: () => void;
+ onUpload( callback: () => void ): this;
+ setUsage( usage: Usage ): this;
+ clone(): BufferAttribute;
copy( source: BufferAttribute ): this;
copyAt(
index1: number,
attribute: BufferAttribute,
index2: number
- ): BufferAttribute;
- copyArray( array: ArrayLike<number> ): BufferAttribute;
+ ): this;
+ copyArray( array: ArrayLike<number> ): this;
copyColorsArray(
colors: { r: number; g: number; b: number }[]
- ): BufferAttribute;
- copyVector2sArray( vectors: { x: number; y: number }[] ): BufferAttribute;
+ ): this;
+ copyVector2sArray( vectors: { x: number; y: number }[] ): this;
copyVector3sArray(
vectors: { x: number; y: number; z: number }[]
- ): BufferAttribute;
+ ): this;
copyVector4sArray(
vectors: { x: number; y: number; z: number; w: number }[]
- ): BufferAttribute;
+ ): this;
set(
value: ArrayLike<number> | ArrayBufferView,
offset?: number
- ): BufferAttribute;
+ ): this;
getX( index: number ): number;
- setX( index: number, x: number ): BufferAttribute;
+ setX( index: number, x: number ): this;
getY( index: number ): number;
- setY( index: number, y: number ): BufferAttribute;
+ setY( index: number, y: number ): this;
getZ( index: number ): number;
- setZ( index: number, z: number ): BufferAttribute;
+ setZ( index: number, z: number ): this;
getW( index: number ): number;
- setW( index: number, z: number ): BufferAttribute;
- setXY( index: number, x: number, y: number ): BufferAttribute;
- setXYZ( index: number, x: number, y: number, z: number ): BufferAttribute;
+ setW( index: number, z: number ): this;
+ setXY( index: number, x: number, y: number ): this;
+ setXYZ( index: number, x: number, y: number, z: number ): this;
setXYZW(
index: number,
x: number,
y: number,
z: number,
w: number
- ): BufferAttribute;
- /**
- * @deprecated Use {@link BufferAttribute#count .count} instead.
- */
- length: number;
+ ): this;
+ toJSON(): {
+ itemSize: number,
+ type: string,
+ array: number[],
+ normalized: boolean
+ };
}
| true |
Other | mrdoob | three.js | c6e88649ce6ffd7c2ac20351890c62a9977aba33.json | update .d.ts for BufferAttributes | src/core/InterleavedBufferAttribute.d.ts | @@ -11,13 +11,15 @@ export class InterleavedBufferAttribute {
normalized?: boolean
);
- uuid: string;
data: InterleavedBuffer;
itemSize: number;
offset: number;
- count: number;
normalized: boolean;
- array: any[];
+
+ get count(): number;
+ get array(): ArrayLike<number>;
+
+ isInterleavedBufferAttribute: true;
getX( index: number ): number;
setX( index: number, x: number ): InterleavedBufferAttribute;
@@ -41,9 +43,5 @@ export class InterleavedBufferAttribute {
z: number,
w: number
): InterleavedBufferAttribute;
- /**
- * @deprecated Use {@link InterleavedBufferAttribute#count .count} instead.
- */
- length: number;
} | true |
Other | mrdoob | three.js | 46620b4f03b395558328deea349e31971b10ea75.json | Update Polyfill for Helio 0.98. | examples/js/vr/HelioWebXRPolyfill.js | @@ -2,188 +2,45 @@
* @author mvilledieu / http://github.com/mvilledieu
*/
-if ( /(Helio)/g.test( navigator.userAgent ) && "xr" in navigator && 'isSessionSupported' in navigator.xr === false) {
+if ( /(Helio)/g.test( navigator.userAgent ) && "xr" in navigator) {
+ console.log( "Helio WebXR Polyfill (Lumin 0.98.0)" );
- console.log( "Helio WebXR Polyfill (Lumin 0.97.0)" );
+ if ('isSessionSupported' in navigator.xr) {
- const isHelio96 = navigator.userAgent.includes( "Chrome/73" );
+ const tempIsSessionSupported = navigator.xr.isSessionSupported.bind( navigator.xr );
- // WebXRManager - XR.supportSession() Polyfill - WebVR.js line 147
-
- if (
- "supportsSession" in navigator.xr === false &&
- "supportsSessionMode" in navigator.xr
- ) {
-
- navigator.xr.supportsSession = function ( /*sessionType*/ ) {
+ navigator.xr.isSessionSupported = function ( /*sessionType*/ ) {
// Force using immersive-ar
- return navigator.xr.supportsSessionMode( 'immersive-ar' );
+ return tempIsSessionSupported( 'immersive-ar' );
};
}
- if ( "requestSession" in navigator.xr ) {
+ if ('isSessionSupported' in navigator.xr && "requestSession" in navigator.xr) {
const tempRequestSession = navigator.xr.requestSession.bind( navigator.xr );
navigator.xr.requestSession = function ( /*sessionType*/ ) {
return new Promise( function ( resolve, reject ) {
- const sessionType = ( isHelio96 ? {
- mode: 'immersive-ar' // Force using immersive-ar
- } : 'immersive-ar' );
-
- tempRequestSession( sessionType )
- .then( function ( session ) {
-
- // WebXRManager - xrFrame.getPose() Polyfill - line 279
-
- const tempRequestAnimationFrame = session.requestAnimationFrame.bind(
- session
- );
-
- session.requestAnimationFrame = function ( callback ) {
-
- return tempRequestAnimationFrame( function ( time, frame ) {
-
- // WebXRManager - xrFrame.getViewerPose() Polyfill - line 279
- // Transforms view.viewMatrix to view.transform.inverse.matrix
-
- const tempGetViewerPose = frame.getViewerPose.bind( frame );
-
- frame.getViewerPose = function ( referenceSpace ) {
-
- const pose = tempGetViewerPose( referenceSpace );
-
- pose.views.forEach( function ( view ) {
-
- view.transform = {
- inverse: {
- matrix: view.viewMatrix
- }
- };
-
- } );
-
- return pose;
-
- };
-
- // WebXRManager - xrFrame.getPose() Polyfill - line 259
-
- const tempGetPose = ( isHelio96 ? null : frame.getPose.bind( frame ) );
-
- frame.getPose = function ( targetRaySpace, referenceSpace ) {
-
- if ( isHelio96 ) {
-
- const inputPose = frame.getInputPose(
- targetRaySpace,
- referenceSpace
- );
-
- inputPose.transform = {
- matrix: inputPose.targetRay.transformMatrix
- };
-
- return inputPose;
-
- } else {
-
- return tempGetPose( targetRaySpace.gripSpace, referenceSpace );
-
- }
-
- };
-
- callback( time, frame );
+ var sessionInit = { optionalFeatures: [ 'local-floor', 'bounded-floor' ] };
- } );
+ tempRequestSession( 'immersive-ar', sessionInit).then(function ( session ) {
- };
+ resolve( session );
- // WebXRManager - xrFrame.getPose( inputSource.targetRaySpace, referenceSpace) Polyfill - line 279
+ }).catch( function ( error ) {
- const tempGetInputSources = session.getInputSources.bind( session );
+ return reject( error );
- session.getInputSources = function () {
+ });
- const res = tempGetInputSources();
+ });
- res.forEach( function ( xrInputSource ) {
-
- Object.defineProperty( xrInputSource, "targetRaySpace", {
- get: function () {
-
- return xrInputSource;
-
- }
- } );
-
- } );
-
- return res;
-
- };
-
- // WebXRManager - xrSession.getInputSources() Polyfill Line 132 - 136
-
- session.inputSources = Object.defineProperty(
- session,
- "inputSources",
- {
- get: session.getInputSources
- }
- );
-
- // WebXRManager - xrSession.updateRenderState() Polyfill Line 129
-
- if ( isHelio96 ) {
-
- session.updateRenderState = function ( { baseLayer } ) {
-
- session.baseLayer = baseLayer;
-
- // WebXRManager - xrSession.renderState.baseLayer Polyfill Line 219
-
- session.renderState = {
- baseLayer: baseLayer
- };
-
- };
-
- }
-
- // WebXRManager - xrSession.requestReferenceSpace() Polyfill Line 130
-
- const tempRequestReferenceSpace = session.requestReferenceSpace.bind(
- session
- );
-
- session.requestReferenceSpace = function () {
-
- return tempRequestReferenceSpace( {
- type: "stationary",
- subtype: "floor-level"
- } );
-
- };
-
- resolve( session );
-
- } )
- .catch( function ( error ) {
-
- return reject( error );
-
- } );
-
- } );
-
- };
+ }
}
| false |
Other | mrdoob | three.js | 8ef4e5cdafcd8ba5b7835834d168ed289dd4f123.json | Improve wording in the documentation | docs/api/en/core/BufferGeometry.html | @@ -146,8 +146,7 @@ <h3>[property:Object morphAttributes]</h3>
<h3>[property:Boolean morphTargetsRelative]</h3>
<p>
- Used to control the morph target behavior; when set to true, the morph target data is treated as relative changes to the base geometry,
- instead of completely replacing the base geometry data.
+ Used to control the morph target behavior; when set to true, the morph target data is treated as relative offsets, rather than as absolute positions/normals.
Default is *false*.
</p> | false |
Other | mrdoob | three.js | 2c7fb77db14479689bcd21a10036f70e793ab513.json | Add comments to WebGLMorphtargets.js as well | src/renderers/webgl/WebGLMorphtargets.js | @@ -98,6 +98,9 @@ function WebGLMorphtargets( gl ) {
}
+ // GLSL shader uses formula baseinfluence * base + sum(target * influence)
+ // This allows us to switch between absolute morphs and relative morphs without changing shader code
+ // When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)
var morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence ); | false |
Other | mrdoob | three.js | 40f015ffaf94421e1ac6378de9eed56bd5027161.json | Add GLSL comments to explain the math a bit | src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js | @@ -1,6 +1,9 @@
export default /* glsl */`
#ifdef USE_MORPHNORMALS
+ // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:
+ // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)
+ // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting
objectNormal *= morphTargetBaseInfluence;
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; | true |
Other | mrdoob | three.js | 40f015ffaf94421e1ac6378de9eed56bd5027161.json | Add GLSL comments to explain the math a bit | src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js | @@ -1,6 +1,9 @@
export default /* glsl */`
#ifdef USE_MORPHTARGETS
+ // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:
+ // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)
+ // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting
transformed *= morphTargetBaseInfluence;
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
transformed += morphTarget1 * morphTargetInfluences[ 1 ]; | true |
Other | mrdoob | three.js | ab548dfd4a09f46ac0fa5100864f212cf0483783.json | Add morphTargetsRelative to documentation | docs/api/en/core/BufferGeometry.html | @@ -144,6 +144,14 @@ <h3>[property:Object morphAttributes]</h3>
Hashmap of [page:BufferAttribute]s holding details of the geometry's [page:Geometry.morphTargets morphTargets].
</p>
+ <h3>[property:Boolean morphTargetsRelative]</h3>
+ <p>
+ Used to control the morph target behavior; when set to true, the morph target data is treated as relative changes to the base geometry,
+ instead of completely replacing the base geometry data.
+
+ Default is *true*.
+ </p>
+
<h3>[property:String name]</h3>
<p>
Optional name for this bufferGeometry instance. Default is an empty string. | false |
Other | mrdoob | three.js | 69aba65161ad30890cb882dfdcccdd5d65e529be.json | Remove clamp-to-zero from WebGL morph target code
On further reflection it shouldn't be necessary - it's probably better
to maintain "exact" match between the shader code and CPU-side code that
may use (pos - morph) * w directly. | src/renderers/webgl/WebGLMorphtargets.js | @@ -98,7 +98,7 @@ function WebGLMorphtargets( gl ) {
}
- var morphBaseInfluence = geometry.morphTargetsRelative ? 1 : Math.max(0, 1 - morphInfluencesSum);
+ var morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
program.getUniforms().setValue( gl, 'morphTargetInfluences', morphInfluences ); | false |
Other | mrdoob | three.js | e93499f020f483c6fa1659e46e7b51b4052d18b0.json | Use morphTargetsRelative in GLTF loader
This uses the newly added functionality for loading morph target data in
GLTF loader; there's no need to clone attribute data anymore. | examples/js/loaders/GLTFLoader.js | @@ -1309,95 +1309,9 @@ THREE.GLTFLoader = ( function () {
var morphPositions = accessors[ 0 ];
var morphNormals = accessors[ 1 ];
- // Clone morph target accessors before modifying them.
-
- for ( var i = 0, il = morphPositions.length; i < il; i ++ ) {
-
- if ( geometry.attributes.position === morphPositions[ i ] ) continue;
-
- morphPositions[ i ] = cloneBufferAttribute( morphPositions[ i ] );
-
- }
-
- for ( var i = 0, il = morphNormals.length; i < il; i ++ ) {
-
- if ( geometry.attributes.normal === morphNormals[ i ] ) continue;
-
- morphNormals[ i ] = cloneBufferAttribute( morphNormals[ i ] );
-
- }
-
- for ( var i = 0, il = targets.length; i < il; i ++ ) {
-
- var target = targets[ i ];
- var attributeName = 'morphTarget' + i;
-
- if ( hasMorphPosition ) {
-
- // Three.js morph position is absolute value. The formula is
- // basePosition
- // + weight0 * ( morphPosition0 - basePosition )
- // + weight1 * ( morphPosition1 - basePosition )
- // ...
- // while the glTF one is relative
- // basePosition
- // + weight0 * glTFmorphPosition0
- // + weight1 * glTFmorphPosition1
- // ...
- // then we need to convert from relative to absolute here.
-
- if ( target.POSITION !== undefined ) {
-
- var positionAttribute = morphPositions[ i ];
- positionAttribute.name = attributeName;
-
- var position = geometry.attributes.position;
-
- for ( var j = 0, jl = positionAttribute.count; j < jl; j ++ ) {
-
- positionAttribute.setXYZ(
- j,
- positionAttribute.getX( j ) + position.getX( j ),
- positionAttribute.getY( j ) + position.getY( j ),
- positionAttribute.getZ( j ) + position.getZ( j )
- );
-
- }
-
- }
-
- }
-
- if ( hasMorphNormal ) {
-
- // see target.POSITION's comment
-
- if ( target.NORMAL !== undefined ) {
-
- var normalAttribute = morphNormals[ i ];
- normalAttribute.name = attributeName;
-
- var normal = geometry.attributes.normal;
-
- for ( var j = 0, jl = normalAttribute.count; j < jl; j ++ ) {
-
- normalAttribute.setXYZ(
- j,
- normalAttribute.getX( j ) + normal.getX( j ),
- normalAttribute.getY( j ) + normal.getY( j ),
- normalAttribute.getZ( j ) + normal.getZ( j )
- );
-
- }
-
- }
-
- }
-
- }
-
if ( hasMorphPosition ) geometry.morphAttributes.position = morphPositions;
if ( hasMorphNormal ) geometry.morphAttributes.normal = morphNormals;
+ geometry.morphTargetsRelative = true;
return geometry;
@@ -1485,31 +1399,6 @@ THREE.GLTFLoader = ( function () {
}
- function cloneBufferAttribute( attribute ) {
-
- if ( attribute.isInterleavedBufferAttribute ) {
-
- var count = attribute.count;
- var itemSize = attribute.itemSize;
- var array = attribute.array.slice( 0, count * itemSize );
-
- for ( var i = 0, j = 0; i < count; ++ i ) {
-
- array[ j ++ ] = attribute.getX( i );
- if ( itemSize >= 2 ) array[ j ++ ] = attribute.getY( i );
- if ( itemSize >= 3 ) array[ j ++ ] = attribute.getZ( i );
- if ( itemSize >= 4 ) array[ j ++ ] = attribute.getW( i );
-
- }
-
- return new THREE.BufferAttribute( array, itemSize, attribute.normalized );
-
- }
-
- return attribute.clone();
-
- }
-
/* GLTF PARSER */
function GLTFParser( json, extensions, options ) { | true |
Other | mrdoob | three.js | e93499f020f483c6fa1659e46e7b51b4052d18b0.json | Use morphTargetsRelative in GLTF loader
This uses the newly added functionality for loading morph target data in
GLTF loader; there's no need to clone attribute data anymore. | examples/jsm/loaders/GLTFLoader.js | @@ -1373,95 +1373,9 @@ var GLTFLoader = ( function () {
var morphPositions = accessors[ 0 ];
var morphNormals = accessors[ 1 ];
- // Clone morph target accessors before modifying them.
-
- for ( var i = 0, il = morphPositions.length; i < il; i ++ ) {
-
- if ( geometry.attributes.position === morphPositions[ i ] ) continue;
-
- morphPositions[ i ] = cloneBufferAttribute( morphPositions[ i ] );
-
- }
-
- for ( var i = 0, il = morphNormals.length; i < il; i ++ ) {
-
- if ( geometry.attributes.normal === morphNormals[ i ] ) continue;
-
- morphNormals[ i ] = cloneBufferAttribute( morphNormals[ i ] );
-
- }
-
- for ( var i = 0, il = targets.length; i < il; i ++ ) {
-
- var target = targets[ i ];
- var attributeName = 'morphTarget' + i;
-
- if ( hasMorphPosition ) {
-
- // Three.js morph position is absolute value. The formula is
- // basePosition
- // + weight0 * ( morphPosition0 - basePosition )
- // + weight1 * ( morphPosition1 - basePosition )
- // ...
- // while the glTF one is relative
- // basePosition
- // + weight0 * glTFmorphPosition0
- // + weight1 * glTFmorphPosition1
- // ...
- // then we need to convert from relative to absolute here.
-
- if ( target.POSITION !== undefined ) {
-
- var positionAttribute = morphPositions[ i ];
- positionAttribute.name = attributeName;
-
- var position = geometry.attributes.position;
-
- for ( var j = 0, jl = positionAttribute.count; j < jl; j ++ ) {
-
- positionAttribute.setXYZ(
- j,
- positionAttribute.getX( j ) + position.getX( j ),
- positionAttribute.getY( j ) + position.getY( j ),
- positionAttribute.getZ( j ) + position.getZ( j )
- );
-
- }
-
- }
-
- }
-
- if ( hasMorphNormal ) {
-
- // see target.POSITION's comment
-
- if ( target.NORMAL !== undefined ) {
-
- var normalAttribute = morphNormals[ i ];
- normalAttribute.name = attributeName;
-
- var normal = geometry.attributes.normal;
-
- for ( var j = 0, jl = normalAttribute.count; j < jl; j ++ ) {
-
- normalAttribute.setXYZ(
- j,
- normalAttribute.getX( j ) + normal.getX( j ),
- normalAttribute.getY( j ) + normal.getY( j ),
- normalAttribute.getZ( j ) + normal.getZ( j )
- );
-
- }
-
- }
-
- }
-
- }
-
if ( hasMorphPosition ) geometry.morphAttributes.position = morphPositions;
if ( hasMorphNormal ) geometry.morphAttributes.normal = morphNormals;
+ geometry.morphTargetsRelative = true;
return geometry;
@@ -1549,31 +1463,6 @@ var GLTFLoader = ( function () {
}
- function cloneBufferAttribute( attribute ) {
-
- if ( attribute.isInterleavedBufferAttribute ) {
-
- var count = attribute.count;
- var itemSize = attribute.itemSize;
- var array = attribute.array.slice( 0, count * itemSize );
-
- for ( var i = 0, j = 0; i < count; ++ i ) {
-
- array[ j ++ ] = attribute.getX( i );
- if ( itemSize >= 2 ) array[ j ++ ] = attribute.getY( i );
- if ( itemSize >= 3 ) array[ j ++ ] = attribute.getZ( i );
- if ( itemSize >= 4 ) array[ j ++ ] = attribute.getW( i );
-
- }
-
- return new BufferAttribute( array, itemSize, attribute.normalized );
-
- }
-
- return attribute.clone();
-
- }
-
/* GLTF PARSER */
function GLTFParser( json, extensions, options ) { | true |
Other | mrdoob | three.js | 5b967be2564536429103c8d39647f0e888cb5a4e.json | Implement basic support for morphTargetsRelative
This adds the attribute and the necessary plumbing for various JS
functions; there's no support for specifying this for the shader to
consume yet. | src/core/BufferGeometry.d.ts | @@ -40,6 +40,7 @@ export class BufferGeometry extends EventDispatcher {
morphAttributes: {
[name: string]: ( BufferAttribute | InterleavedBufferAttribute )[];
};
+ morphTargetsRelative: boolean;
groups: { start: number; count: number; materialIndex?: number }[];
boundingBox: Box3;
boundingSphere: Sphere; | true |
Other | mrdoob | three.js | 5b967be2564536429103c8d39647f0e888cb5a4e.json | Implement basic support for morphTargetsRelative
This adds the attribute and the necessary plumbing for various JS
functions; there's no support for specifying this for the shader to
consume yet. | src/core/BufferGeometry.js | @@ -37,6 +37,7 @@ function BufferGeometry() {
this.attributes = {};
this.morphAttributes = {};
+ this.morphTargetsRelative = false;
this.groups = [];
@@ -596,8 +597,17 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
var morphAttribute = morphAttributesPosition[ i ];
_box.setFromBufferAttribute( morphAttribute );
- this.boundingBox.expandByPoint( _box.min );
- this.boundingBox.expandByPoint( _box.max );
+ if ( this.morphTargetsRelative ) {
+
+ this.boundingBox.expandByVector( _box.min );
+ this.boundingBox.expandByVector( _box.max );
+
+ } else {
+
+ this.boundingBox.expandByPoint( _box.min );
+ this.boundingBox.expandByPoint( _box.max );
+
+ }
}
@@ -645,8 +655,17 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
var morphAttribute = morphAttributesPosition[ i ];
_boxMorphTargets.setFromBufferAttribute( morphAttribute );
- _box.expandByPoint( _boxMorphTargets.min );
- _box.expandByPoint( _boxMorphTargets.max );
+ if ( this.morphTargetsRelative ) {
+
+ _box.boundingBox.expandByVector( _boxMorphTargets.min );
+ _box.boundingBox.expandByVector( _boxMorphTargets.max );
+
+ } else {
+
+ _box.expandByPoint( _boxMorphTargets.min );
+ _box.expandByPoint( _boxMorphTargets.max );
+
+ }
}
@@ -674,11 +693,19 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
for ( var i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
var morphAttribute = morphAttributesPosition[ i ];
+ var morphTargetsRelative = this.morphTargetsRelative;
for ( var j = 0, jl = morphAttribute.count; j < jl; j ++ ) {
_vector.fromBufferAttribute( morphAttribute, j );
+ if ( morphTargetsRelative ) {
+
+ _offset.fromBufferAttribute( position, j );
+ _vector.add( _offset );
+
+ }
+
maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );
}
@@ -1055,7 +1082,12 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
}
- if ( hasMorphAttributes ) data.data.morphAttributes = morphAttributes;
+ if ( hasMorphAttributes ) {
+
+ data.data.morphAttributes = morphAttributes;
+ data.data.morphTargetsRelative = this.morphTargetsRelative;
+
+ }
var groups = this.groups;
@@ -1167,6 +1199,8 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
}
+ this.morphTargetsRelative = source.morphTargetsRelative;
+
// groups
var groups = source.groups; | true |
Other | mrdoob | three.js | 5b967be2564536429103c8d39647f0e888cb5a4e.json | Implement basic support for morphTargetsRelative
This adds the attribute and the necessary plumbing for various JS
functions; there's no support for specifying this for the shader to
consume yet. | src/objects/Mesh.js | @@ -173,6 +173,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
var index = geometry.index;
var position = geometry.attributes.position;
var morphPosition = geometry.morphAttributes.position;
+ var morphTargetsRelative = geometry.morphTargetsRelative;
var uv = geometry.attributes.uv;
var uv2 = geometry.attributes.uv2;
var groups = geometry.groups;
@@ -201,7 +202,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
b = index.getX( j + 1 );
c = index.getX( j + 2 );
- intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, uv, uv2, a, b, c );
+ intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );
if ( intersection ) {
@@ -226,7 +227,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
b = index.getX( i + 1 );
c = index.getX( i + 2 );
- intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, uv, uv2, a, b, c );
+ intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );
if ( intersection ) {
@@ -259,7 +260,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
b = j + 1;
c = j + 2;
- intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, uv, uv2, a, b, c );
+ intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );
if ( intersection ) {
@@ -284,7 +285,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
b = i + 1;
c = i + 2;
- intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, uv, uv2, a, b, c );
+ intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );
if ( intersection ) {
@@ -388,7 +389,7 @@ function checkIntersection( object, material, raycaster, ray, pA, pB, pC, point
}
-function checkBufferGeometryIntersection( object, material, raycaster, ray, position, morphPosition, uv, uv2, a, b, c ) {
+function checkBufferGeometryIntersection( object, material, raycaster, ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ) {
_vA.fromBufferAttribute( position, a );
_vB.fromBufferAttribute( position, b );
@@ -413,9 +414,19 @@ function checkBufferGeometryIntersection( object, material, raycaster, ray, posi
_tempB.fromBufferAttribute( morphAttribute, b );
_tempC.fromBufferAttribute( morphAttribute, c );
- _morphA.addScaledVector( _tempA.sub( _vA ), influence );
- _morphB.addScaledVector( _tempB.sub( _vB ), influence );
- _morphC.addScaledVector( _tempC.sub( _vC ), influence );
+ if ( morphTargetsRelative ) {
+
+ _morphA.addScaledVector( _tempA, influence );
+ _morphB.addScaledVector( _tempB, influence );
+ _morphC.addScaledVector( _tempC, influence );
+
+ } else {
+
+ _morphA.addScaledVector( _tempA.sub( _vA ), influence );
+ _morphB.addScaledVector( _tempB.sub( _vB ), influence );
+ _morphC.addScaledVector( _tempC.sub( _vC ), influence );
+
+ }
}
| true |
Other | mrdoob | three.js | 947a1c781f529a711756a0204a69b87b77fefcaf.json | Accept number in BufferAttribute definitions | src/core/BufferAttribute.d.ts | @@ -151,7 +151,7 @@ export class Float64Attribute extends BufferAttribute {
export class Int8BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -161,7 +161,7 @@ export class Int8BufferAttribute extends BufferAttribute {
export class Uint8BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -171,7 +171,7 @@ export class Uint8BufferAttribute extends BufferAttribute {
export class Uint8ClampedBufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -181,7 +181,7 @@ export class Uint8ClampedBufferAttribute extends BufferAttribute {
export class Int16BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -191,7 +191,7 @@ export class Int16BufferAttribute extends BufferAttribute {
export class Uint16BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -201,7 +201,7 @@ export class Uint16BufferAttribute extends BufferAttribute {
export class Int32BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -211,7 +211,7 @@ export class Int32BufferAttribute extends BufferAttribute {
export class Uint32BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -221,7 +221,7 @@ export class Uint32BufferAttribute extends BufferAttribute {
export class Float32BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -231,7 +231,7 @@ export class Float32BufferAttribute extends BufferAttribute {
export class Float64BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
); | false |
Other | mrdoob | three.js | 207637bac527962f493f2136bae10592f3b15fce.json | Fix some TypeScript definitions | src/core/BufferAttribute.d.ts | @@ -151,7 +151,7 @@ export class Float64Attribute extends BufferAttribute {
export class Int8BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -161,7 +161,7 @@ export class Int8BufferAttribute extends BufferAttribute {
export class Uint8BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -171,7 +171,7 @@ export class Uint8BufferAttribute extends BufferAttribute {
export class Uint8ClampedBufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -181,7 +181,7 @@ export class Uint8ClampedBufferAttribute extends BufferAttribute {
export class Int16BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -191,7 +191,7 @@ export class Int16BufferAttribute extends BufferAttribute {
export class Uint16BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -201,7 +201,7 @@ export class Uint16BufferAttribute extends BufferAttribute {
export class Int32BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -211,7 +211,7 @@ export class Int32BufferAttribute extends BufferAttribute {
export class Uint32BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -221,7 +221,7 @@ export class Uint32BufferAttribute extends BufferAttribute {
export class Float32BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
);
@@ -231,7 +231,7 @@ export class Float32BufferAttribute extends BufferAttribute {
export class Float64BufferAttribute extends BufferAttribute {
constructor(
- array: Iterable<number> | ArrayLike<number> | ArrayBuffer,
+ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
itemSize: number,
normalized?: boolean
); | true |
Other | mrdoob | three.js | 207637bac527962f493f2136bae10592f3b15fce.json | Fix some TypeScript definitions | src/core/BufferGeometry.d.ts | @@ -37,7 +37,9 @@ export class BufferGeometry extends EventDispatcher {
attributes: {
[name: string]: BufferAttribute | InterleavedBufferAttribute;
};
- morphAttributes: any;
+ morphAttributes: {
+ [name: string]: ( BufferAttribute | InterleavedBufferAttribute )[];
+ };
groups: { start: number; count: number; materialIndex?: number }[];
boundingBox: Box3;
boundingSphere: Sphere; | true |
Other | mrdoob | three.js | 207637bac527962f493f2136bae10592f3b15fce.json | Fix some TypeScript definitions | src/math/Interpolant.d.ts | @@ -2,13 +2,13 @@ export abstract class Interpolant {
constructor(
parameterPositions: any,
- samplesValues: any,
+ sampleValues: any,
sampleSize: number,
resultBuffer?: any
);
parameterPositions: any;
- samplesValues: any;
+ sampleValues: any;
valueSize: number;
resultBuffer: any;
| true |
Other | mrdoob | three.js | a8f4ab24b462711c923f802c211141ed3160a7ce.json | fix gamedev.net link | docs/api/en/math/Matrix4.html | @@ -219,7 +219,7 @@ <h3>[method:this makeRotationAxis]( [param:Vector3 axis], [param:Float theta] )<
Sets this matrix as rotation transform around [page:Vector3 axis] by [page:Float theta] radians.<br />
This is a somewhat controversial but mathematically sound alternative to rotating via [page:Quaternions].
- See the discussion [link:http://www.gamedev.net/reference/articles/article1199.asp here].
+ See the discussion [link:https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199 here].
</p>
<h3>[method:this makeBasis]( [param:Vector3 xAxis], [param:Vector3 yAxis], [param:Vector3 zAxis] )</h3> | false |
Other | mrdoob | three.js | 5da0acd70dd7060a68099b77b54b5c63fd8f4d71.json | Update JSM renderers | examples/jsm/renderers/CSS2DRenderer.js | @@ -5,7 +5,6 @@
import {
Matrix4,
Object3D,
- REVISION,
Vector3
} from "../../../build/three.module.js";
@@ -35,8 +34,6 @@ CSS2DObject.prototype.constructor = CSS2DObject;
var CSS2DRenderer = function () {
- console.log( 'THREE.CSS2DRenderer', REVISION );
-
var _width, _height;
var _widthHalf, _heightHalf;
| true |
Other | mrdoob | three.js | 5da0acd70dd7060a68099b77b54b5c63fd8f4d71.json | Update JSM renderers | examples/jsm/renderers/CSS3DRenderer.js | @@ -7,7 +7,6 @@
import {
Matrix4,
Object3D,
- REVISION,
Vector3
} from "../../../build/three.module.js";
@@ -46,8 +45,6 @@ CSS3DSprite.prototype.constructor = CSS3DSprite;
var CSS3DRenderer = function () {
- console.log( 'THREE.CSS3DRenderer', REVISION );
-
var _width, _height;
var _widthHalf, _heightHalf;
| true |
Other | mrdoob | three.js | 5da0acd70dd7060a68099b77b54b5c63fd8f4d71.json | Update JSM renderers | examples/jsm/renderers/RaytracingRenderer.js | @@ -8,14 +8,11 @@
import {
Color,
- EventDispatcher,
- REVISION
+ EventDispatcher
} from "../../../build/three.module.js";
var RaytracingRenderer = function ( parameters ) {
- console.log( 'THREE.RaytracingRenderer', REVISION );
-
parameters = parameters || {};
var scope = this; | true |
Other | mrdoob | three.js | 5da0acd70dd7060a68099b77b54b5c63fd8f4d71.json | Update JSM renderers | examples/jsm/renderers/SVGRenderer.js | @@ -10,7 +10,6 @@ import {
Matrix3,
Matrix4,
Object3D,
- REVISION,
Vector3,
VertexColors
} from "../../../build/three.module.js";
@@ -32,8 +31,6 @@ SVGObject.prototype.constructor = SVGObject;
var SVGRenderer = function () {
- console.log( 'THREE.SVGRenderer', REVISION );
-
var _this = this,
_renderData, _elements, _lights,
_projector = new Projector(), | true |
Other | mrdoob | three.js | 5da0acd70dd7060a68099b77b54b5c63fd8f4d71.json | Update JSM renderers | examples/jsm/renderers/SoftwareRenderer.js | @@ -13,7 +13,6 @@ import {
MeshBasicMaterial,
MeshLambertMaterial,
MeshPhongMaterial,
- REVISION,
SpriteMaterial,
Vector2,
Vector3,
@@ -27,8 +26,6 @@ import { RenderableSprite } from "../renderers/Projector.js";
var SoftwareRenderer = function ( parameters ) {
- console.log( 'THREE.SoftwareRenderer', REVISION );
-
parameters = parameters || {};
var canvas = parameters.canvas !== undefined | true |
Other | mrdoob | three.js | 6d2c2147dd6df44ad795b4a0742efdcaae672b2a.json | Remove revision in renderers of examples | examples/js/renderers/CSS2DRenderer.js | @@ -28,8 +28,6 @@ THREE.CSS2DObject.prototype.constructor = THREE.CSS2DObject;
THREE.CSS2DRenderer = function () {
- console.log( 'THREE.CSS2DRenderer', THREE.REVISION );
-
var _width, _height;
var _widthHalf, _heightHalf;
| true |
Other | mrdoob | three.js | 6d2c2147dd6df44ad795b4a0742efdcaae672b2a.json | Remove revision in renderers of examples | examples/js/renderers/CSS3DRenderer.js | @@ -39,8 +39,6 @@ THREE.CSS3DSprite.prototype.constructor = THREE.CSS3DSprite;
THREE.CSS3DRenderer = function () {
- console.log( 'THREE.CSS3DRenderer', THREE.REVISION );
-
var _width, _height;
var _widthHalf, _heightHalf;
| true |
Other | mrdoob | three.js | 6d2c2147dd6df44ad795b4a0742efdcaae672b2a.json | Remove revision in renderers of examples | examples/js/renderers/RaytracingRenderer.js | @@ -8,8 +8,6 @@
THREE.RaytracingRenderer = function ( parameters ) {
- console.log( 'THREE.RaytracingRenderer', THREE.REVISION );
-
parameters = parameters || {};
var scope = this; | true |
Other | mrdoob | three.js | 6d2c2147dd6df44ad795b4a0742efdcaae672b2a.json | Remove revision in renderers of examples | examples/js/renderers/RaytracingWorker.js | @@ -80,8 +80,6 @@ self.onmessage = function ( e ) {
THREE.RaytracingRendererWorker = function () {
- console.log( 'THREE.RaytracingRendererWorker', THREE.REVISION );
-
var maxRecursionDepth = 3;
var canvasWidth, canvasHeight; | true |
Other | mrdoob | three.js | 6d2c2147dd6df44ad795b4a0742efdcaae672b2a.json | Remove revision in renderers of examples | examples/js/renderers/SVGRenderer.js | @@ -15,8 +15,6 @@ THREE.SVGObject.prototype.constructor = THREE.SVGObject;
THREE.SVGRenderer = function () {
- console.log( 'THREE.SVGRenderer', THREE.REVISION );
-
var _this = this,
_renderData, _elements, _lights,
_projector = new THREE.Projector(), | true |
Other | mrdoob | three.js | 6d2c2147dd6df44ad795b4a0742efdcaae672b2a.json | Remove revision in renderers of examples | examples/js/renderers/SoftwareRenderer.js | @@ -7,8 +7,6 @@
THREE.SoftwareRenderer = function ( parameters ) {
- console.log( 'THREE.SoftwareRenderer', THREE.REVISION );
-
parameters = parameters || {};
var canvas = parameters.canvas !== undefined | true |
Other | mrdoob | three.js | 5e26c0e1be1b3c6c095532f67f72807b651afc8a.json | Remove blank line | examples/jsm/loaders/LDrawLoader.d.ts | @@ -18,5 +18,4 @@ export class LDrawLoader {
addMaterial(material: Material ): void;
getMaterial(colourCode: string): Material | null;
-
} | false |
Other | mrdoob | three.js | 54e4a0dfb3d60a7a5d1c338581cc7cd933795952.json | Add missed files | examples/js/loaders/LDrawLoader.js | @@ -1,6 +1,7 @@
/**
* @author mrdoob / http://mrdoob.com/
* @author yomboprime / https://github.com/yomboprime/
+ * @author gkjohnson / https://github.com/gkjohnson/
*
*
*/ | true |
Other | mrdoob | three.js | 54e4a0dfb3d60a7a5d1c338581cc7cd933795952.json | Add missed files | examples/jsm/loaders/LDrawLoader.d.ts | @@ -0,0 +1,22 @@
+import {
+ LoadingManager,
+ Group,
+ Material
+} from '../../../src/Three';
+
+export class LDrawLoader {
+ constructor(manager?: LoadingManager);
+ manager: LoadingManager;
+ path: string;
+
+ load(url: string, onLoad: (data: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void;
+ setPath(path: string) : this;
+ setFileMap(fileMap: Record<string, string>): void;
+ setMaterials(materials: Material[]): void;
+
+ parse(text: string, path?: string, onLoad: (data: Group) => void): void;
+
+ addMaterial(material: Material ): void;
+ getMaterial(colourCode: string): Material | null;
+
+} | true |
Other | mrdoob | three.js | 54e4a0dfb3d60a7a5d1c338581cc7cd933795952.json | Add missed files | examples/jsm/loaders/LDrawLoader.js | @@ -0,0 +1,1929 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ * @author yomboprime / https://github.com/yomboprime/
+ * @author gkjohnson / https://github.com/gkjohnson/
+ *
+ *
+ */
+
+import {
+ BufferAttribute,
+ BufferGeometry,
+ Cache,
+ Color,
+ DefaultLoadingManager,
+ FileLoader,
+ Float32BufferAttribute,
+ Group,
+ LineBasicMaterial,
+ LineSegments,
+ Material,
+ Matrix4,
+ Mesh,
+ MeshPhongMaterial,
+ MeshStandardMaterial,
+ Object3D,
+ ShaderMaterial,
+ Vector3
+} from "../../../build/three.module.js";
+
+var LDrawLoader = ( function () {
+
+ var conditionalLineVertShader = /* glsl */`
+ attribute vec3 control0;
+ attribute vec3 control1;
+ attribute vec3 direction;
+ varying float discardFlag;
+
+ #include <common>
+ #include <color_pars_vertex>
+ #include <fog_pars_vertex>
+ #include <logdepthbuf_pars_vertex>
+ #include <clipping_planes_pars_vertex>
+ void main() {
+ #include <color_vertex>
+
+ vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
+ gl_Position = projectionMatrix * mvPosition;
+
+ // Transform the line segment ends and control points into camera clip space
+ vec4 c0 = projectionMatrix * modelViewMatrix * vec4( control0, 1.0 );
+ vec4 c1 = projectionMatrix * modelViewMatrix * vec4( control1, 1.0 );
+ vec4 p0 = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
+ vec4 p1 = projectionMatrix * modelViewMatrix * vec4( position + direction, 1.0 );
+
+ c0.xy /= c0.w;
+ c1.xy /= c1.w;
+ p0.xy /= p0.w;
+ p1.xy /= p1.w;
+
+ // Get the direction of the segment and an orthogonal vector
+ vec2 dir = p1.xy - p0.xy;
+ vec2 norm = vec2( -dir.y, dir.x );
+
+ // Get control point directions from the line
+ vec2 c0dir = c0.xy - p1.xy;
+ vec2 c1dir = c1.xy - p1.xy;
+
+ // If the vectors to the controls points are pointed in different directions away
+ // from the line segment then the line should not be drawn.
+ float d0 = dot( normalize( norm ), normalize( c0dir ) );
+ float d1 = dot( normalize( norm ), normalize( c1dir ) );
+ discardFlag = float( sign( d0 ) != sign( d1 ) );
+
+ #include <logdepthbuf_vertex>
+ #include <clipping_planes_vertex>
+ #include <fog_vertex>
+ }
+ `;
+
+ var conditionalLineFragShader = /* glsl */`
+ uniform vec3 diffuse;
+ uniform float opacity;
+ varying float discardFlag;
+
+ #include <common>
+ #include <color_pars_fragment>
+ #include <fog_pars_fragment>
+ #include <logdepthbuf_pars_fragment>
+ #include <clipping_planes_pars_fragment>
+ void main() {
+
+ if ( discardFlag > 0.5 ) discard;
+
+ #include <clipping_planes_fragment>
+ vec3 outgoingLight = vec3( 0.0 );
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include <logdepthbuf_fragment>
+ #include <color_fragment>
+ outgoingLight = diffuseColor.rgb; // simple shader
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );
+ #include <premultiplied_alpha_fragment>
+ #include <tonemapping_fragment>
+ #include <encodings_fragment>
+ #include <fog_fragment>
+ }
+ `;
+
+
+
+ var tempVec0 = new Vector3();
+ var tempVec1 = new Vector3();
+ function smoothNormals( triangles, lineSegments ) {
+
+ function hashVertex( v ) {
+
+ // NOTE: 1e2 is pretty coarse but was chosen because it allows edges
+ // to be smoothed as expected (see minifig arms). The errors between edges
+ // could be due to matrix multiplication.
+ var x = ~ ~ ( v.x * 1e2 );
+ var y = ~ ~ ( v.y * 1e2 );
+ var z = ~ ~ ( v.z * 1e2 );
+ return `${ x },${ y },${ z }`;
+
+ }
+
+ function hashEdge( v0, v1 ) {
+
+ return `${ hashVertex( v0 ) }_${ hashVertex( v1 ) }`;
+
+ }
+
+ var hardEdges = new Set();
+ var halfEdgeList = {};
+ var fullHalfEdgeList = {};
+ var normals = [];
+
+ // Save the list of hard edges by hash
+ for ( var i = 0, l = lineSegments.length; i < l; i ++ ) {
+
+ var ls = lineSegments[ i ];
+ var v0 = ls.v0;
+ var v1 = ls.v1;
+ hardEdges.add( hashEdge( v0, v1 ) );
+ hardEdges.add( hashEdge( v1, v0 ) );
+
+ }
+
+ // track the half edges associated with each triangle
+ for ( var i = 0, l = triangles.length; i < l; i ++ ) {
+
+ var tri = triangles[ i ];
+ for ( var i2 = 0, l2 = 3; i2 < l2; i2 ++ ) {
+
+ var index = i2;
+ var next = ( i2 + 1 ) % 3;
+ var v0 = tri[ `v${ index }` ];
+ var v1 = tri[ `v${ next }` ];
+ var hash = hashEdge( v0, v1 );
+
+ // don't add the triangle if the edge is supposed to be hard
+ if ( hardEdges.has( hash ) ) continue;
+ halfEdgeList[ hash ] = tri;
+ fullHalfEdgeList[ hash ] = tri;
+
+ }
+
+ }
+
+ // NOTE: Some of the normals wind up being skewed in an unexpected way because
+ // quads provide more "influence" to some vertex normals than a triangle due to
+ // the fact that a quad is made up of two triangles and all triangles are weighted
+ // equally. To fix this quads could be tracked separately so their vertex normals
+ // are weighted appropriately or we could try only adding a normal direction
+ // once per normal.
+
+ // Iterate until we've tried to connect all triangles to share normals
+ while ( true ) {
+
+ // Stop if there are no more triangles left
+ var halfEdges = Object.keys( halfEdgeList );
+ if ( halfEdges.length === 0 ) break;
+
+ // Exhaustively find all connected triangles
+ var i = 0;
+ var queue = [ fullHalfEdgeList[ halfEdges[ 0 ] ] ];
+ while ( i < queue.length ) {
+
+ // initialize all vertex normals in this triangle
+ var tri = queue[ i ];
+ i ++;
+
+ var faceNormal = tri.faceNormal;
+ if ( tri.n0 === null ) {
+
+ tri.n0 = faceNormal.clone();
+ normals.push( tri.n0 );
+
+ }
+
+ if ( tri.n1 === null ) {
+
+ tri.n1 = faceNormal.clone();
+ normals.push( tri.n1 );
+
+ }
+
+ if ( tri.n2 === null ) {
+
+ tri.n2 = faceNormal.clone();
+ normals.push( tri.n2 );
+
+ }
+
+ // Check if any edge is connected to another triangle edge
+ for ( var i2 = 0, l2 = 3; i2 < l2; i2 ++ ) {
+
+ var index = i2;
+ var next = ( i2 + 1 ) % 3;
+ var v0 = tri[ `v${ index }` ];
+ var v1 = tri[ `v${ next }` ];
+
+ // delete this triangle from the list so it won't be found again
+ var hash = hashEdge( v0, v1 );
+ delete halfEdgeList[ hash ];
+
+ var reverseHash = hashEdge( v1, v0 );
+ var otherTri = fullHalfEdgeList[ reverseHash ];
+ if ( otherTri ) {
+
+ // NOTE: If the angle between triangles is > 67.5 degrees then assume it's
+ // hard edge. There are some cases where the line segments do not line up exactly
+ // with or span multiple triangle edges (see Lunar Vehicle wheels).
+ if ( Math.abs( otherTri.faceNormal.dot( tri.faceNormal ) ) < 0.25 ) {
+
+ continue;
+
+ }
+
+ // if this triangle has already been traversed then it won't be in
+ // the halfEdgeList. If it has not then add it to the queue and delete
+ // it so it won't be found again.
+ if ( reverseHash in halfEdgeList ) {
+
+ queue.push( otherTri );
+ delete halfEdgeList[ reverseHash ];
+
+ }
+
+ // Find the matching edge in this triangle and copy the normal vector over
+ for ( var i3 = 0, l3 = 3; i3 < l3; i3 ++ ) {
+
+ var otherIndex = i3;
+ var otherNext = ( i3 + 1 ) % 3;
+ var otherV0 = otherTri[ `v${ otherIndex }` ];
+ var otherV1 = otherTri[ `v${ otherNext }` ];
+
+ var otherHash = hashEdge( otherV0, otherV1 );
+ if ( otherHash === reverseHash ) {
+
+ if ( otherTri[ `n${ otherIndex }` ] === null ) {
+
+ var norm = tri[ `n${ next }` ];
+ otherTri[ `n${ otherIndex }` ] = norm;
+ norm.add( otherTri.faceNormal );
+
+ }
+
+ if ( otherTri[ `n${ otherNext }` ] === null ) {
+
+ var norm = tri[ `n${ index }` ];
+ otherTri[ `n${ otherNext }` ] = norm;
+ norm.add( otherTri.faceNormal );
+
+ }
+
+ break;
+
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+ // The normals of each face have been added up so now we average them by normalizing the vector.
+ for ( var i = 0, l = normals.length; i < l; i ++ ) {
+
+ normals[ i ].normalize();
+
+ }
+
+ }
+
+ function isPrimitiveType( type ) {
+
+ return /primitive/i.test( type ) || type === 'Subpart';
+
+ }
+
+ function LineParser( line, lineNumber ) {
+
+ this.line = line;
+ this.lineLength = line.length;
+ this.currentCharIndex = 0;
+ this.currentChar = ' ';
+ this.lineNumber = lineNumber;
+
+ }
+
+ LineParser.prototype = {
+
+ constructor: LineParser,
+
+ seekNonSpace: function () {
+
+ while ( this.currentCharIndex < this.lineLength ) {
+
+ this.currentChar = this.line.charAt( this.currentCharIndex );
+
+ if ( this.currentChar !== ' ' && this.currentChar !== '\t' ) {
+
+ return;
+
+ }
+
+ this.currentCharIndex ++;
+
+ }
+
+ },
+
+ getToken: function () {
+
+ var pos0 = this.currentCharIndex ++;
+
+ // Seek space
+ while ( this.currentCharIndex < this.lineLength ) {
+
+ this.currentChar = this.line.charAt( this.currentCharIndex );
+
+ if ( this.currentChar === ' ' || this.currentChar === '\t' ) {
+
+ break;
+
+ }
+
+ this.currentCharIndex ++;
+
+ }
+
+ var pos1 = this.currentCharIndex;
+
+ this.seekNonSpace();
+
+ return this.line.substring( pos0, pos1 );
+
+ },
+
+ getRemainingString: function () {
+
+ return this.line.substring( this.currentCharIndex, this.lineLength );
+
+ },
+
+ isAtTheEnd: function () {
+
+ return this.currentCharIndex >= this.lineLength;
+
+ },
+
+ setToEnd: function () {
+
+ this.currentCharIndex = this.lineLength;
+
+ },
+
+ getLineNumberString: function () {
+
+ return this.lineNumber >= 0 ? " at line " + this.lineNumber : "";
+
+ }
+
+
+ };
+
+ function sortByMaterial( a, b ) {
+
+ if ( a.colourCode === b.colourCode ) {
+
+ return 0;
+
+ }
+
+ if ( a.colourCode < b.colourCode ) {
+
+ return - 1;
+
+ }
+
+ return 1;
+
+ }
+
+ function createObject( elements, elementSize, isConditionalSegments ) {
+
+ // Creates a LineSegments (elementSize = 2) or a Mesh (elementSize = 3 )
+ // With per face / segment material, implemented with mesh groups and materials array
+
+ // Sort the triangles or line segments by colour code to make later the mesh groups
+ elements.sort( sortByMaterial );
+
+ var positions = [];
+ var normals = [];
+ var materials = [];
+
+ var bufferGeometry = new BufferGeometry();
+ var prevMaterial = null;
+ var index0 = 0;
+ var numGroupVerts = 0;
+
+ for ( var iElem = 0, nElem = elements.length; iElem < nElem; iElem ++ ) {
+
+ var elem = elements[ iElem ];
+ var v0 = elem.v0;
+ var v1 = elem.v1;
+ // Note that LDraw coordinate system is rotated 180 deg. in the X axis w.r.t. Three.js's one
+ positions.push( v0.x, v0.y, v0.z, v1.x, v1.y, v1.z );
+ if ( elementSize === 3 ) {
+
+ positions.push( elem.v2.x, elem.v2.y, elem.v2.z );
+
+ var n0 = elem.n0 || elem.faceNormal;
+ var n1 = elem.n1 || elem.faceNormal;
+ var n2 = elem.n2 || elem.faceNormal;
+ normals.push( n0.x, n0.y, n0.z );
+ normals.push( n1.x, n1.y, n1.z );
+ normals.push( n2.x, n2.y, n2.z );
+
+ }
+
+ if ( prevMaterial !== elem.material ) {
+
+ if ( prevMaterial !== null ) {
+
+ bufferGeometry.addGroup( index0, numGroupVerts, materials.length - 1 );
+
+ }
+
+ materials.push( elem.material );
+
+ prevMaterial = elem.material;
+ index0 = iElem * elementSize;
+ numGroupVerts = elementSize;
+
+ } else {
+
+ numGroupVerts += elementSize;
+
+ }
+
+ }
+
+ if ( numGroupVerts > 0 ) {
+
+ bufferGeometry.addGroup( index0, Infinity, materials.length - 1 );
+
+ }
+
+ bufferGeometry.addAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
+
+ if ( elementSize === 3 ) {
+
+ bufferGeometry.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+
+ }
+
+ var object3d = null;
+
+ if ( elementSize === 2 ) {
+
+ object3d = new LineSegments( bufferGeometry, materials );
+
+ } else if ( elementSize === 3 ) {
+
+ object3d = new Mesh( bufferGeometry, materials );
+
+ }
+
+ if ( isConditionalSegments ) {
+
+ object3d.isConditionalLine = true;
+
+ var controlArray0 = new Float32Array( elements.length * 3 * 2 );
+ var controlArray1 = new Float32Array( elements.length * 3 * 2 );
+ var directionArray = new Float32Array( elements.length * 3 * 2 );
+ for ( var i = 0, l = elements.length; i < l; i ++ ) {
+
+ var os = elements[ i ];
+ var c0 = os.c0;
+ var c1 = os.c1;
+ var v0 = os.v0;
+ var v1 = os.v1;
+ var index = i * 3 * 2;
+ controlArray0[ index + 0 ] = c0.x;
+ controlArray0[ index + 1 ] = c0.y;
+ controlArray0[ index + 2 ] = c0.z;
+ controlArray0[ index + 3 ] = c0.x;
+ controlArray0[ index + 4 ] = c0.y;
+ controlArray0[ index + 5 ] = c0.z;
+
+ controlArray1[ index + 0 ] = c1.x;
+ controlArray1[ index + 1 ] = c1.y;
+ controlArray1[ index + 2 ] = c1.z;
+ controlArray1[ index + 3 ] = c1.x;
+ controlArray1[ index + 4 ] = c1.y;
+ controlArray1[ index + 5 ] = c1.z;
+
+ directionArray[ index + 0 ] = v1.x - v0.x;
+ directionArray[ index + 1 ] = v1.y - v0.y;
+ directionArray[ index + 2 ] = v1.z - v0.z;
+ directionArray[ index + 3 ] = v1.x - v0.x;
+ directionArray[ index + 4 ] = v1.y - v0.y;
+ directionArray[ index + 5 ] = v1.z - v0.z;
+
+ }
+
+ bufferGeometry.addAttribute( 'control0', new BufferAttribute( controlArray0, 3, false ) );
+ bufferGeometry.addAttribute( 'control1', new BufferAttribute( controlArray1, 3, false ) );
+ bufferGeometry.addAttribute( 'direction', new BufferAttribute( directionArray, 3, false ) );
+
+ }
+
+ return object3d;
+
+ }
+
+ //
+
+ function LDrawLoader( manager ) {
+
+ this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+
+ // This is a stack of 'parse scopes' with one level per subobject loaded file.
+ // Each level contains a material lib and also other runtime variables passed between parent and child subobjects
+ // When searching for a material code, the stack is read from top of the stack to bottom
+ // Each material library is an object map keyed by colour codes.
+ this.parseScopesStack = null;
+
+ this.path = '';
+
+ // Array of Material
+ this.materials = [];
+
+ // Not using Cache here because it returns the previous HTML error response instead of calling onError()
+ // This also allows to handle the embedded text files ("0 FILE" lines)
+ this.subobjectCache = {};
+
+ // This object is a map from file names to paths. It agilizes the paths search. If it is not set then files will be searched by trial and error.
+ this.fileMap = null;
+
+ // Add default main triangle and line edge materials (used in piecess that can be coloured with a main color)
+ this.setMaterials( [
+ this.parseColourMetaDirective( new LineParser( "Main_Colour CODE 16 VALUE #FF8080 EDGE #333333" ) ),
+ this.parseColourMetaDirective( new LineParser( "Edge_Colour CODE 24 VALUE #A0A0A0 EDGE #333333" ) )
+ ] );
+
+ // If this flag is set to true, each subobject will be a Object.
+ // If not (the default), only one object which contains all the merged primitives will be created.
+ this.separateObjects = false;
+
+ // If this flag is set to true the vertex normals will be smoothed.
+ this.smoothNormals = true;
+
+ }
+
+ // Special surface finish tag types.
+ // Note: "MATERIAL" tag (e.g. GLITTER, SPECKLE) is not implemented
+ LDrawLoader.FINISH_TYPE_DEFAULT = 0;
+ LDrawLoader.FINISH_TYPE_CHROME = 1;
+ LDrawLoader.FINISH_TYPE_PEARLESCENT = 2;
+ LDrawLoader.FINISH_TYPE_RUBBER = 3;
+ LDrawLoader.FINISH_TYPE_MATTE_METALLIC = 4;
+ LDrawLoader.FINISH_TYPE_METAL = 5;
+
+ // State machine to search a subobject path.
+ // The LDraw standard establishes these various possible subfolders.
+ LDrawLoader.FILE_LOCATION_AS_IS = 0;
+ LDrawLoader.FILE_LOCATION_TRY_PARTS = 1;
+ LDrawLoader.FILE_LOCATION_TRY_P = 2;
+ LDrawLoader.FILE_LOCATION_TRY_MODELS = 3;
+ LDrawLoader.FILE_LOCATION_TRY_RELATIVE = 4;
+ LDrawLoader.FILE_LOCATION_TRY_ABSOLUTE = 5;
+ LDrawLoader.FILE_LOCATION_NOT_FOUND = 6;
+
+ LDrawLoader.prototype = {
+
+ constructor: LDrawLoader,
+
+ load: function ( url, onLoad, onProgress, onError ) {
+
+ if ( ! this.fileMap ) {
+
+ this.fileMap = {};
+
+ }
+
+ var scope = this;
+
+ var fileLoader = new FileLoader( this.manager );
+ fileLoader.setPath( this.path );
+ fileLoader.load( url, function ( text ) {
+
+ scope.processObject( text, onLoad, null, url );
+
+ }, onProgress, onError );
+
+ },
+
+ parse: function ( text, path, onLoad ) {
+
+ // Async parse. This function calls onParse with the parsed Object3D as parameter
+
+ this.processObject( text, onLoad, null, path );
+
+ },
+
+ setPath: function ( value ) {
+
+ this.path = value;
+
+ return this;
+
+ },
+
+ setMaterials: function ( materials ) {
+
+ // Clears parse scopes stack, adds new scope with material library
+
+ this.parseScopesStack = [];
+
+ this.newParseScopeLevel( materials );
+
+ this.getCurrentParseScope().isFromParse = false;
+
+ this.materials = materials;
+
+ return this;
+
+ },
+
+ setFileMap: function ( fileMap ) {
+
+ this.fileMap = fileMap;
+
+ return this;
+
+ },
+
+ newParseScopeLevel: function ( materials ) {
+
+ // Adds a new scope level, assign materials to it and returns it
+
+ var matLib = {};
+
+ if ( materials ) {
+
+ for ( var i = 0, n = materials.length; i < n; i ++ ) {
+
+ var material = materials[ i ];
+ matLib[ material.userData.code ] = material;
+
+ }
+
+ }
+
+ var topParseScope = this.getCurrentParseScope();
+ var newParseScope = {
+
+ lib: matLib,
+ url: null,
+
+ // Subobjects
+ subobjects: null,
+ numSubobjects: 0,
+ subobjectIndex: 0,
+ inverted: false,
+ category: null,
+ keywords: null,
+
+ // Current subobject
+ currentFileName: null,
+ mainColourCode: topParseScope ? topParseScope.mainColourCode : '16',
+ mainEdgeColourCode: topParseScope ? topParseScope.mainEdgeColourCode : '24',
+ currentMatrix: new Matrix4(),
+ matrix: new Matrix4(),
+
+ // If false, it is a root material scope previous to parse
+ isFromParse: true,
+
+ triangles: null,
+ lineSegments: null,
+ conditionalSegments: null,
+ };
+
+ this.parseScopesStack.push( newParseScope );
+
+ return newParseScope;
+
+ },
+
+ removeScopeLevel: function () {
+
+ this.parseScopesStack.pop();
+
+ return this;
+
+ },
+
+ addMaterial: function ( material ) {
+
+ // Adds a material to the material library which is on top of the parse scopes stack. And also to the materials array
+
+ var matLib = this.getCurrentParseScope().lib;
+
+ if ( ! matLib[ material.userData.code ] ) {
+
+ this.materials.push( material );
+
+ }
+
+ matLib[ material.userData.code ] = material;
+
+ return this;
+
+ },
+
+ getMaterial: function ( colourCode ) {
+
+ // Given a colour code search its material in the parse scopes stack
+
+ if ( colourCode.startsWith( "0x2" ) ) {
+
+ // Special 'direct' material value (RGB colour)
+
+ var colour = colourCode.substring( 3 );
+
+ return this.parseColourMetaDirective( new LineParser( "Direct_Color_" + colour + " CODE -1 VALUE #" + colour + " EDGE #" + colour + "" ) );
+
+ }
+
+ for ( var i = this.parseScopesStack.length - 1; i >= 0; i -- ) {
+
+ var material = this.parseScopesStack[ i ].lib[ colourCode ];
+
+ if ( material ) {
+
+ return material;
+
+ }
+
+ }
+
+ // Material was not found
+ return null;
+
+ },
+
+ getParentParseScope: function () {
+
+ if ( this.parseScopesStack.length > 1 ) {
+
+ return this.parseScopesStack[ this.parseScopesStack.length - 2 ];
+
+ }
+
+ return null;
+
+ },
+
+ getCurrentParseScope: function () {
+
+ if ( this.parseScopesStack.length > 0 ) {
+
+ return this.parseScopesStack[ this.parseScopesStack.length - 1 ];
+
+ }
+
+ return null;
+
+ },
+
+ parseColourMetaDirective: function ( lineParser ) {
+
+ // Parses a colour definition and returns a Material or null if error
+
+ var code = null;
+
+ // Triangle and line colours
+ var colour = 0xFF00FF;
+ var edgeColour = 0xFF00FF;
+
+ // Transparency
+ var alpha = 1;
+ var isTransparent = false;
+ // Self-illumination:
+ var luminance = 0;
+
+ var finishType = LDrawLoader.FINISH_TYPE_DEFAULT;
+ var canHaveEnvMap = true;
+
+ var edgeMaterial = null;
+
+ var name = lineParser.getToken();
+ if ( ! name ) {
+
+ throw 'LDrawLoader: Material name was expected after "!COLOUR tag' + lineParser.getLineNumberString() + ".";
+
+ }
+
+ // Parse tag tokens and their parameters
+ var token = null;
+ while ( true ) {
+
+ token = lineParser.getToken();
+
+ if ( ! token ) {
+
+ break;
+
+ }
+
+ switch ( token.toUpperCase() ) {
+
+ case "CODE":
+
+ code = lineParser.getToken();
+ break;
+
+ case "VALUE":
+
+ colour = lineParser.getToken();
+ if ( colour.startsWith( '0x' ) ) {
+
+ colour = '#' + colour.substring( 2 );
+
+ } else if ( ! colour.startsWith( '#' ) ) {
+
+ throw 'LDrawLoader: Invalid colour while parsing material' + lineParser.getLineNumberString() + ".";
+
+ }
+ break;
+
+ case "EDGE":
+
+ edgeColour = lineParser.getToken();
+ if ( edgeColour.startsWith( '0x' ) ) {
+
+ edgeColour = '#' + edgeColour.substring( 2 );
+
+ } else if ( ! edgeColour.startsWith( '#' ) ) {
+
+ // Try to see if edge colour is a colour code
+ edgeMaterial = this.getMaterial( edgeColour );
+ if ( ! edgeMaterial ) {
+
+ throw 'LDrawLoader: Invalid edge colour while parsing material' + lineParser.getLineNumberString() + ".";
+
+ }
+
+ // Get the edge material for this triangle material
+ edgeMaterial = edgeMaterial.userData.edgeMaterial;
+
+ }
+ break;
+
+ case 'ALPHA':
+
+ alpha = parseInt( lineParser.getToken() );
+
+ if ( isNaN( alpha ) ) {
+
+ throw 'LDrawLoader: Invalid alpha value in material definition' + lineParser.getLineNumberString() + ".";
+
+ }
+
+ alpha = Math.max( 0, Math.min( 1, alpha / 255 ) );
+
+ if ( alpha < 1 ) {
+
+ isTransparent = true;
+
+ }
+
+ break;
+
+ case 'LUMINANCE':
+
+ luminance = parseInt( lineParser.getToken() );
+
+ if ( isNaN( luminance ) ) {
+
+ throw 'LDrawLoader: Invalid luminance value in material definition' + LineParser.getLineNumberString() + ".";
+
+ }
+
+ luminance = Math.max( 0, Math.min( 1, luminance / 255 ) );
+
+ break;
+
+ case 'CHROME':
+ finishType = LDrawLoader.FINISH_TYPE_CHROME;
+ break;
+
+ case 'PEARLESCENT':
+ finishType = LDrawLoader.FINISH_TYPE_PEARLESCENT;
+ break;
+
+ case 'RUBBER':
+ finishType = LDrawLoader.FINISH_TYPE_RUBBER;
+ break;
+
+ case 'MATTE_METALLIC':
+ finishType = LDrawLoader.FINISH_TYPE_MATTE_METALLIC;
+ break;
+
+ case 'METAL':
+ finishType = LDrawLoader.FINISH_TYPE_METAL;
+ break;
+
+ case 'MATERIAL':
+ // Not implemented
+ lineParser.setToEnd();
+ break;
+
+ default:
+ throw 'LDrawLoader: Unknown token "' + token + '" while parsing material' + lineParser.getLineNumberString() + ".";
+ break;
+
+ }
+
+ }
+
+ var material = null;
+
+ switch ( finishType ) {
+
+ case LDrawLoader.FINISH_TYPE_DEFAULT:
+
+ material = new MeshStandardMaterial( { color: colour, roughness: 0.3, envMapIntensity: 0.3, metalness: 0 } );
+ break;
+
+ case LDrawLoader.FINISH_TYPE_PEARLESCENT:
+
+ // Try to imitate pearlescency by setting the specular to the complementary of the color, and low shininess
+ var specular = new Color( colour );
+ var hsl = specular.getHSL( { h: 0, s: 0, l: 0 } );
+ hsl.h = ( hsl.h + 0.5 ) % 1;
+ hsl.l = Math.min( 1, hsl.l + ( 1 - hsl.l ) * 0.7 );
+ specular.setHSL( hsl.h, hsl.s, hsl.l );
+
+ material = new MeshPhongMaterial( { color: colour, specular: specular, shininess: 10, reflectivity: 0.3 } );
+ break;
+
+ case LDrawLoader.FINISH_TYPE_CHROME:
+
+ // Mirror finish surface
+ material = new MeshStandardMaterial( { color: colour, roughness: 0, metalness: 1 } );
+ break;
+
+ case LDrawLoader.FINISH_TYPE_RUBBER:
+
+ // Rubber finish
+ material = new MeshStandardMaterial( { color: colour, roughness: 0.9, metalness: 0 } );
+ canHaveEnvMap = false;
+ break;
+
+ case LDrawLoader.FINISH_TYPE_MATTE_METALLIC:
+
+ // Brushed metal finish
+ material = new MeshStandardMaterial( { color: colour, roughness: 0.8, metalness: 0.4 } );
+ break;
+
+ case LDrawLoader.FINISH_TYPE_METAL:
+
+ // Average metal finish
+ material = new MeshStandardMaterial( { color: colour, roughness: 0.2, metalness: 0.85 } );
+ break;
+
+ default:
+ // Should not happen
+ break;
+
+ }
+
+ material.transparent = isTransparent;
+ material.premultipliedAlpha = true;
+ material.opacity = alpha;
+ material.depthWrite = ! isTransparent;
+
+ material.polygonOffset = true;
+ material.polygonOffsetFactor = 1;
+
+ material.userData.canHaveEnvMap = canHaveEnvMap;
+
+ if ( luminance !== 0 ) {
+
+ material.emissive.set( material.color ).multiplyScalar( luminance );
+
+ }
+
+ if ( ! edgeMaterial ) {
+
+ // This is the material used for edges
+ edgeMaterial = new LineBasicMaterial( {
+ color: edgeColour,
+ transparent: isTransparent,
+ opacity: alpha,
+ depthWrite: ! isTransparent
+ } );
+ edgeMaterial.userData.code = code;
+ edgeMaterial.name = name + " - Edge";
+ edgeMaterial.userData.canHaveEnvMap = false;
+
+ // This is the material used for conditional edges
+ edgeMaterial.userData.conditionalEdgeMaterial = new ShaderMaterial( {
+ vertexShader: conditionalLineVertShader,
+ fragmentShader: conditionalLineFragShader,
+ uniforms: {
+ diffuse: {
+ value: new Color( edgeColour )
+ },
+ opacity: {
+ value: alpha
+ }
+ },
+ transparent: isTransparent,
+ depthWrite: ! isTransparent
+ } );
+ edgeMaterial.userData.conditionalEdgeMaterial.userData.canHaveEnvMap = false;
+
+ }
+
+ material.userData.code = code;
+ material.name = name;
+
+ material.userData.edgeMaterial = edgeMaterial;
+
+ return material;
+
+ },
+
+ //
+
+ objectParse: function ( text ) {
+
+ //console.time( 'LDrawLoader' );
+
+ // Retrieve data from the parent parse scope
+ var parentParseScope = this.getParentParseScope();
+
+ // Main colour codes passed to this subobject (or default codes 16 and 24 if it is the root object)
+ var mainColourCode = parentParseScope.mainColourCode;
+ var mainEdgeColourCode = parentParseScope.mainEdgeColourCode;
+
+ var currentParseScope = this.getCurrentParseScope();
+
+ // Parse result variables
+ var triangles;
+ var lineSegments;
+ var conditionalSegments;
+
+ var subobjects = [];
+
+ var category = null;
+ var keywords = null;
+
+ if ( text.indexOf( '\r\n' ) !== - 1 ) {
+
+ // This is faster than String.split with regex that splits on both
+ text = text.replace( /\r\n/g, '\n' );
+
+ }
+
+ var lines = text.split( '\n' );
+ var numLines = lines.length;
+ var lineIndex = 0;
+
+ var parsingEmbeddedFiles = false;
+ var currentEmbeddedFileName = null;
+ var currentEmbeddedText = null;
+
+ var bfcCertified = false;
+ var bfcCCW = true;
+ var bfcInverted = false;
+ var bfcCull = true;
+ var type = '';
+
+ var scope = this;
+ function parseColourCode( lineParser, forEdge ) {
+
+ // Parses next colour code and returns a Material
+
+ var colourCode = lineParser.getToken();
+
+ if ( ! forEdge && colourCode === '16' ) {
+
+ colourCode = mainColourCode;
+
+ }
+ if ( forEdge && colourCode === '24' ) {
+
+ colourCode = mainEdgeColourCode;
+
+ }
+
+ var material = scope.getMaterial( colourCode );
+
+ if ( ! material ) {
+
+ throw 'LDrawLoader: Unknown colour code "' + colourCode + '" is used' + lineParser.getLineNumberString() + ' but it was not defined previously.';
+
+ }
+
+ return material;
+
+ }
+
+ function parseVector( lp ) {
+
+ var v = new Vector3( parseFloat( lp.getToken() ), parseFloat( lp.getToken() ), parseFloat( lp.getToken() ) );
+
+ if ( ! scope.separateObjects ) {
+
+ v.applyMatrix4( currentParseScope.currentMatrix );
+
+ }
+
+ return v;
+
+ }
+
+ // Parse all line commands
+ for ( lineIndex = 0; lineIndex < numLines; lineIndex ++ ) {
+
+ var line = lines[ lineIndex ];
+
+ if ( line.length === 0 ) continue;
+
+ if ( parsingEmbeddedFiles ) {
+
+ if ( line.startsWith( '0 FILE ' ) ) {
+
+ // Save previous embedded file in the cache
+ this.subobjectCache[ currentEmbeddedFileName.toLowerCase() ] = currentEmbeddedText;
+
+ // New embedded text file
+ currentEmbeddedFileName = line.substring( 7 );
+ currentEmbeddedText = '';
+
+ } else {
+
+ currentEmbeddedText += line + '\n';
+
+ }
+
+ continue;
+
+ }
+
+ var lp = new LineParser( line, lineIndex + 1 );
+
+ lp.seekNonSpace();
+
+ if ( lp.isAtTheEnd() ) {
+
+ // Empty line
+ continue;
+
+ }
+
+ // Parse the line type
+ var lineType = lp.getToken();
+
+ switch ( lineType ) {
+
+ // Line type 0: Comment or META
+ case '0':
+
+ // Parse meta directive
+ var meta = lp.getToken();
+
+ if ( meta ) {
+
+ switch ( meta ) {
+
+ case '!LDRAW_ORG':
+
+ type = lp.getToken();
+
+ if ( ! parsingEmbeddedFiles ) {
+
+ currentParseScope.triangles = [];
+ currentParseScope.lineSegments = [];
+ currentParseScope.conditionalSegments = [];
+ currentParseScope.type = type;
+
+ var isRoot = ! parentParseScope.isFromParse;
+ if ( isRoot || scope.separateObjects && ! isPrimitiveType( type ) ) {
+
+ currentParseScope.groupObject = new Group();
+
+ }
+
+ // If the scale of the object is negated then the triangle winding order
+ // needs to be flipped.
+ var matrix = currentParseScope.matrix;
+ if (
+ matrix.determinant() < 0 && (
+ scope.separateObjects && isPrimitiveType( type ) ||
+ ! scope.separateObjects
+ ) ) {
+
+ currentParseScope.inverted = ! currentParseScope.inverted;
+
+ }
+
+ triangles = currentParseScope.triangles;
+ lineSegments = currentParseScope.lineSegments;
+ conditionalSegments = currentParseScope.conditionalSegments;
+
+ }
+
+ break;
+
+ case '!COLOUR':
+
+ var material = this.parseColourMetaDirective( lp );
+ if ( material ) {
+
+ this.addMaterial( material );
+
+ } else {
+
+ console.warn( 'LDrawLoader: Error parsing material' + lp.getLineNumberString() );
+
+ }
+ break;
+
+ case '!CATEGORY':
+
+ category = lp.getToken();
+ break;
+
+ case '!KEYWORDS':
+
+ var newKeywords = lp.getRemainingString().split( ',' );
+ if ( newKeywords.length > 0 ) {
+
+ if ( ! keywords ) {
+
+ keywords = [];
+
+ }
+
+ newKeywords.forEach( function ( keyword ) {
+
+ keywords.push( keyword.trim() );
+
+ } );
+
+ }
+ break;
+
+ case 'FILE':
+
+ if ( lineIndex > 0 ) {
+
+ // Start embedded text files parsing
+ parsingEmbeddedFiles = true;
+ currentEmbeddedFileName = lp.getRemainingString();
+ currentEmbeddedText = '';
+
+ bfcCertified = false;
+ bfcCCW = true;
+
+ }
+
+ break;
+
+ case 'BFC':
+
+ // Changes to the backface culling state
+ while ( ! lp.isAtTheEnd() ) {
+
+ var token = lp.getToken();
+
+ switch ( token ) {
+
+ case 'CERTIFY':
+ case 'NOCERTIFY':
+
+ bfcCertified = token === 'CERTIFY';
+ bfcCCW = true;
+
+ break;
+
+ case 'CW':
+ case 'CCW':
+
+ bfcCCW = token === 'CCW';
+
+ break;
+
+ case 'INVERTNEXT':
+
+ bfcInverted = true;
+
+ break;
+
+ case 'CLIP':
+ case 'NOCLIP':
+
+ bfcCull = token === 'CLIP';
+
+ break;
+
+ default:
+
+ console.warn( 'THREE.LDrawLoader: BFC directive "' + token + '" is unknown.' );
+
+ break;
+
+ }
+
+ }
+
+ break;
+
+ default:
+ // Other meta directives are not implemented
+ break;
+
+ }
+
+ }
+
+ break;
+
+ // Line type 1: Sub-object file
+ case '1':
+
+ var material = parseColourCode( lp );
+
+ var posX = parseFloat( lp.getToken() );
+ var posY = parseFloat( lp.getToken() );
+ var posZ = parseFloat( lp.getToken() );
+ var m0 = parseFloat( lp.getToken() );
+ var m1 = parseFloat( lp.getToken() );
+ var m2 = parseFloat( lp.getToken() );
+ var m3 = parseFloat( lp.getToken() );
+ var m4 = parseFloat( lp.getToken() );
+ var m5 = parseFloat( lp.getToken() );
+ var m6 = parseFloat( lp.getToken() );
+ var m7 = parseFloat( lp.getToken() );
+ var m8 = parseFloat( lp.getToken() );
+
+ var matrix = new Matrix4().set(
+ m0, m1, m2, posX,
+ m3, m4, m5, posY,
+ m6, m7, m8, posZ,
+ 0, 0, 0, 1
+ );
+
+ var fileName = lp.getRemainingString().trim().replace( /\\/g, "/" );
+
+ if ( scope.fileMap[ fileName ] ) {
+
+ // Found the subobject path in the preloaded file path map
+ fileName = scope.fileMap[ fileName ];
+
+ } else {
+
+ // Standardized subfolders
+ if ( fileName.startsWith( 's/' ) ) {
+
+ fileName = 'parts/' + fileName;
+
+ } else if ( fileName.startsWith( '48/' ) ) {
+
+ fileName = 'p/' + fileName;
+
+ }
+
+ }
+
+ subobjects.push( {
+ material: material,
+ matrix: matrix,
+ fileName: fileName,
+ originalFileName: fileName,
+ locationState: LDrawLoader.FILE_LOCATION_AS_IS,
+ url: null,
+ triedLowerCase: false,
+ inverted: bfcInverted !== currentParseScope.inverted
+ } );
+
+ bfcInverted = false;
+
+ break;
+
+ // Line type 2: Line segment
+ case '2':
+
+ var material = parseColourCode( lp, true );
+
+ var segment = {
+ material: material.userData.edgeMaterial,
+ colourCode: material.userData.code,
+ v0: parseVector( lp ),
+ v1: parseVector( lp )
+ };
+
+ lineSegments.push( segment );
+
+ break;
+
+ // Line type 5: Conditional Line segment
+ case '5':
+
+ var material = parseColourCode( lp, true );
+
+ var segment = {
+ material: material.userData.edgeMaterial.userData.conditionalEdgeMaterial,
+ colourCode: material.userData.code,
+ v0: parseVector( lp ),
+ v1: parseVector( lp ),
+ c0: parseVector( lp ),
+ c1: parseVector( lp )
+ };
+
+ conditionalSegments.push( segment );
+
+ break;
+
+ // Line type 3: Triangle
+ case '3':
+
+ var material = parseColourCode( lp );
+
+ var inverted = currentParseScope.inverted;
+ var ccw = bfcCCW !== inverted;
+ var doubleSided = ! bfcCertified || ! bfcCull;
+ var v0, v1, v2, faceNormal;
+
+ if ( ccw === true ) {
+
+ v0 = parseVector( lp );
+ v1 = parseVector( lp );
+ v2 = parseVector( lp );
+
+ } else {
+
+ v2 = parseVector( lp );
+ v1 = parseVector( lp );
+ v0 = parseVector( lp );
+
+ }
+
+ tempVec0.subVectors( v1, v0 );
+ tempVec1.subVectors( v2, v1 );
+ faceNormal = new Vector3()
+ .crossVectors( tempVec0, tempVec1 )
+ .normalize();
+
+ triangles.push( {
+ material: material,
+ colourCode: material.userData.code,
+ v0: v0,
+ v1: v1,
+ v2: v2,
+ faceNormal: faceNormal,
+ n0: null,
+ n1: null,
+ n2: null
+ } );
+
+ if ( doubleSided === true ) {
+
+ triangles.push( {
+ material: material,
+ colourCode: material.userData.code,
+ v0: v0,
+ v1: v2,
+ v2: v1,
+ faceNormal: faceNormal,
+ n0: null,
+ n1: null,
+ n2: null
+ } );
+
+ }
+
+ break;
+
+ // Line type 4: Quadrilateral
+ case '4':
+
+ var material = parseColourCode( lp );
+
+ var inverted = currentParseScope.inverted;
+ var ccw = bfcCCW !== inverted;
+ var doubleSided = ! bfcCertified || ! bfcCull;
+ var v0, v1, v2, v3, faceNormal;
+
+ if ( ccw === true ) {
+
+ v0 = parseVector( lp );
+ v1 = parseVector( lp );
+ v2 = parseVector( lp );
+ v3 = parseVector( lp );
+
+ } else {
+
+ v3 = parseVector( lp );
+ v2 = parseVector( lp );
+ v1 = parseVector( lp );
+ v0 = parseVector( lp );
+
+ }
+
+ tempVec0.subVectors( v1, v0 );
+ tempVec1.subVectors( v2, v1 );
+ faceNormal = new Vector3()
+ .crossVectors( tempVec0, tempVec1 )
+ .normalize();
+
+ triangles.push( {
+ material: material,
+ colourCode: material.userData.code,
+ v0: v0,
+ v1: v1,
+ v2: v2,
+ faceNormal: faceNormal,
+ n0: null,
+ n1: null,
+ n2: null
+ } );
+
+ triangles.push( {
+ material: material,
+ colourCode: material.userData.code,
+ v0: v0,
+ v1: v2,
+ v2: v3,
+ faceNormal: faceNormal,
+ n0: null,
+ n1: null,
+ n2: null
+ } );
+
+ if ( doubleSided === true ) {
+
+ triangles.push( {
+ material: material,
+ colourCode: material.userData.code,
+ v0: v0,
+ v1: v2,
+ v2: v1,
+ faceNormal: faceNormal,
+ n0: null,
+ n1: null,
+ n2: null
+ } );
+
+ triangles.push( {
+ material: material,
+ colourCode: material.userData.code,
+ v0: v0,
+ v1: v3,
+ v2: v2,
+ faceNormal: faceNormal,
+ n0: null,
+ n1: null,
+ n2: null
+ } );
+
+ }
+
+ break;
+
+ default:
+ throw 'LDrawLoader: Unknown line type "' + lineType + '"' + lp.getLineNumberString() + '.';
+ break;
+
+ }
+
+ }
+
+ if ( parsingEmbeddedFiles ) {
+
+ this.subobjectCache[ currentEmbeddedFileName.toLowerCase() ] = currentEmbeddedText;
+
+ }
+
+ currentParseScope.category = category;
+ currentParseScope.keywords = keywords;
+ currentParseScope.subobjects = subobjects;
+ currentParseScope.numSubobjects = subobjects.length;
+ currentParseScope.subobjectIndex = 0;
+
+ },
+
+ processObject: function ( text, onProcessed, subobject, url ) {
+
+ var scope = this;
+
+ var parseScope = scope.newParseScopeLevel();
+ parseScope.url = url;
+
+ var parentParseScope = scope.getParentParseScope();
+
+ // Set current matrix
+ if ( subobject ) {
+
+ parseScope.currentMatrix.multiplyMatrices( parentParseScope.currentMatrix, subobject.matrix );
+ parseScope.matrix.copy( subobject.matrix );
+ parseScope.inverted = subobject.inverted;
+
+ }
+
+ // Add to cache
+ var currentFileName = parentParseScope.currentFileName;
+ if ( currentFileName !== null ) {
+
+ currentFileName = parentParseScope.currentFileName.toLowerCase();
+
+ }
+
+ if ( scope.subobjectCache[ currentFileName ] === undefined ) {
+
+ scope.subobjectCache[ currentFileName ] = text;
+
+ }
+
+
+ // Parse the object (returns a Group)
+ scope.objectParse( text );
+ var finishedCount = 0;
+ onSubobjectFinish();
+
+ function onSubobjectFinish() {
+
+ finishedCount ++;
+
+ if ( finishedCount === parseScope.subobjects.length + 1 ) {
+
+ finalizeObject();
+
+ } else {
+
+ // Once the previous subobject has finished we can start processing the next one in the list.
+ // The subobject processing shares scope in processing so it's important that they be loaded serially
+ // to avoid race conditions.
+ // Promise.resolve is used as an approach to asynchronously schedule a task _before_ this frame ends to
+ // avoid stack overflow exceptions when loading many subobjects from the cache. RequestAnimationFrame
+ // will work but causes the load to happen after the next frame which causes the load to take significantly longer.
+ var subobject = parseScope.subobjects[ parseScope.subobjectIndex ];
+ Promise.resolve().then( function () {
+
+ loadSubobject( subobject );
+
+ } );
+ parseScope.subobjectIndex ++;
+
+ }
+
+ }
+
+ function finalizeObject() {
+
+ if ( scope.smoothNormals && parseScope.type === 'Part' ) {
+
+ smoothNormals( parseScope.triangles, parseScope.lineSegments );
+
+ }
+
+ var isRoot = ! parentParseScope.isFromParse;
+ if ( scope.separateObjects && ! isPrimitiveType( parseScope.type ) || isRoot ) {
+
+
+ const objGroup = parseScope.groupObject;
+ if ( parseScope.triangles.length > 0 ) {
+
+ objGroup.add( createObject( parseScope.triangles, 3 ) );
+
+ }
+
+ if ( parseScope.lineSegments.length > 0 ) {
+
+ objGroup.add( createObject( parseScope.lineSegments, 2 ) );
+
+ }
+
+ if ( parseScope.conditionalSegments.length > 0 ) {
+
+ objGroup.add( createObject( parseScope.conditionalSegments, 2, true ) );
+
+ }
+
+ if ( parentParseScope.groupObject ) {
+
+ objGroup.name = parseScope.fileName;
+ objGroup.userData.category = parseScope.category;
+ objGroup.userData.keywords = parseScope.keywords;
+ parseScope.matrix.decompose( objGroup.position, objGroup.quaternion, objGroup.scale );
+
+ parentParseScope.groupObject.add( objGroup );
+
+ }
+
+ } else {
+
+ var separateObjects = scope.separateObjects;
+ var parentLineSegments = parentParseScope.lineSegments;
+ var parentConditionalSegments = parentParseScope.conditionalSegments;
+ var parentTriangles = parentParseScope.triangles;
+
+ var lineSegments = parseScope.lineSegments;
+ var conditionalSegments = parseScope.conditionalSegments;
+ var triangles = parseScope.triangles;
+
+ for ( var i = 0, l = lineSegments.length; i < l; i ++ ) {
+
+ var ls = lineSegments[ i ];
+ if ( separateObjects ) {
+
+ ls.v0.applyMatrix4( parseScope.matrix );
+ ls.v1.applyMatrix4( parseScope.matrix );
+
+ }
+ parentLineSegments.push( ls );
+
+ }
+
+ for ( var i = 0, l = conditionalSegments.length; i < l; i ++ ) {
+
+ var os = conditionalSegments[ i ];
+ if ( separateObjects ) {
+
+ os.v0.applyMatrix4( parseScope.matrix );
+ os.v1.applyMatrix4( parseScope.matrix );
+ os.c0.applyMatrix4( parseScope.matrix );
+ os.c1.applyMatrix4( parseScope.matrix );
+
+ }
+ parentConditionalSegments.push( os );
+
+ }
+
+ for ( var i = 0, l = triangles.length; i < l; i ++ ) {
+
+ var tri = triangles[ i ];
+ if ( separateObjects ) {
+
+ tri.v0 = tri.v0.clone().applyMatrix4( parseScope.matrix );
+ tri.v1 = tri.v1.clone().applyMatrix4( parseScope.matrix );
+ tri.v2 = tri.v2.clone().applyMatrix4( parseScope.matrix );
+
+ tempVec0.subVectors( tri.v1, tri.v0 );
+ tempVec1.subVectors( tri.v2, tri.v1 );
+ tri.faceNormal.crossVectors( tempVec0, tempVec1 ).normalize();
+
+ }
+ parentTriangles.push( tri );
+
+ }
+
+ }
+
+ scope.removeScopeLevel();
+
+ if ( onProcessed ) {
+
+ onProcessed( parseScope.groupObject );
+
+ }
+
+ }
+
+ function loadSubobject( subobject ) {
+
+ parseScope.mainColourCode = subobject.material.userData.code;
+ parseScope.mainEdgeColourCode = subobject.material.userData.edgeMaterial.userData.code;
+ parseScope.currentFileName = subobject.originalFileName;
+
+
+ // If subobject was cached previously, use the cached one
+ var cached = scope.subobjectCache[ subobject.originalFileName.toLowerCase() ];
+ if ( cached ) {
+
+ scope.processObject( cached, function ( subobjectGroup ) {
+
+ onSubobjectLoaded( subobjectGroup, subobject );
+ onSubobjectFinish();
+
+ }, subobject, url );
+
+ return;
+
+ }
+
+ // Adjust file name to locate the subobject file path in standard locations (always under directory scope.path)
+ // Update also subobject.locationState for the next try if this load fails.
+ var subobjectURL = subobject.fileName;
+ var newLocationState = LDrawLoader.FILE_LOCATION_NOT_FOUND;
+
+ switch ( subobject.locationState ) {
+
+ case LDrawLoader.FILE_LOCATION_AS_IS:
+ newLocationState = subobject.locationState + 1;
+ break;
+
+ case LDrawLoader.FILE_LOCATION_TRY_PARTS:
+ subobjectURL = 'parts/' + subobjectURL;
+ newLocationState = subobject.locationState + 1;
+ break;
+
+ case LDrawLoader.FILE_LOCATION_TRY_P:
+ subobjectURL = 'p/' + subobjectURL;
+ newLocationState = subobject.locationState + 1;
+ break;
+
+ case LDrawLoader.FILE_LOCATION_TRY_MODELS:
+ subobjectURL = 'models/' + subobjectURL;
+ newLocationState = subobject.locationState + 1;
+ break;
+
+ case LDrawLoader.FILE_LOCATION_TRY_RELATIVE:
+ subobjectURL = url.substring( 0, url.lastIndexOf( "/" ) + 1 ) + subobjectURL;
+ newLocationState = subobject.locationState + 1;
+ break;
+
+ case LDrawLoader.FILE_LOCATION_TRY_ABSOLUTE:
+
+ if ( subobject.triedLowerCase ) {
+
+ // Try absolute path
+ newLocationState = LDrawLoader.FILE_LOCATION_NOT_FOUND;
+
+ } else {
+
+ // Next attempt is lower case
+ subobject.fileName = subobject.fileName.toLowerCase();
+ subobjectURL = subobject.fileName;
+ subobject.triedLowerCase = true;
+ newLocationState = LDrawLoader.FILE_LOCATION_AS_IS;
+
+ }
+ break;
+
+ case LDrawLoader.FILE_LOCATION_NOT_FOUND:
+
+ // All location possibilities have been tried, give up loading this object
+ console.warn( 'LDrawLoader: Subobject "' + subobject.originalFileName + '" could not be found.' );
+
+ return;
+
+ }
+
+ subobject.locationState = newLocationState;
+ subobject.url = subobjectURL;
+
+ // Load the subobject
+ // Use another file loader here so we can keep track of the subobject information
+ // and use it when processing the next model.
+ var fileLoader = new FileLoader( scope.manager );
+ fileLoader.setPath( scope.path );
+ fileLoader.load( subobjectURL, function ( text ) {
+
+ scope.processObject( text, function ( subobjectGroup ) {
+
+ onSubobjectLoaded( subobjectGroup, subobject );
+ onSubobjectFinish();
+
+ }, subobject, url );
+
+ }, undefined, function ( err ) {
+
+ onSubobjectError( err, subobject );
+
+ }, subobject );
+
+ }
+
+ function onSubobjectLoaded( subobjectGroup, subobject ) {
+
+ if ( subobjectGroup === null ) {
+
+ // Try to reload
+ loadSubobject( subobject );
+ return;
+
+ }
+
+ scope.fileMap[ subobject.originalFileName ] = subobject.url;
+
+ }
+
+ function onSubobjectError( err, subobject ) {
+
+ // Retry download from a different default possible location
+ loadSubobject( subobject );
+
+ }
+
+ }
+
+ };
+
+ return LDrawLoader;
+
+} )();
+
+export { LDrawLoader }; | true |
Other | mrdoob | three.js | ee7db730d66fe264e6cdf8994505120b2762acf0.json | Update wrong description of Quaternion.inverse | docs/api/en/math/Quaternion.html | @@ -115,8 +115,7 @@ <h3>[method:Quaternion fromArray]( [param:Array array], [param:Integer offset] )
<h3>[method:Quaternion inverse]()</h3>
<p>
- Inverts this quaternion - calculate the [page:.conjugate conjugate] and then
- [page:.normalize normalizes] the result.
+ Inverts this quaternion - calculates the [page:.conjugate conjugate]. The quaternion is assumed to have unit length.
</p>
<h3>[method:Float length]()</h3> | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.