diff --git a/src/animation/AnimationAction.js b/src/animation/AnimationAction.js index 62ded0f4fe8dcd..a1a8c3c1bb39bf 100644 --- a/src/animation/AnimationAction.js +++ b/src/animation/AnimationAction.js @@ -79,7 +79,7 @@ class AnimationAction { * loop state). * * @type {number} - * @default Infinity + * @default 0 */ this.time = 0; diff --git a/src/core/Clock.js b/src/core/Clock.js index ee1a528b07b1d1..0a54131792708c 100644 --- a/src/core/Clock.js +++ b/src/core/Clock.js @@ -54,7 +54,7 @@ class Clock { * Whether the clock is running or not. * * @type {boolean} - * @default true + * @default false */ this.running = false; diff --git a/src/extras/core/ShapePath.js b/src/extras/core/ShapePath.js index ddc0ec5a37522f..dc016818114d33 100644 --- a/src/extras/core/ShapePath.js +++ b/src/extras/core/ShapePath.js @@ -30,7 +30,7 @@ class ShapePath { * The paths that have been generated for this shape. * * @type {Array} - * @default null + * @default [] */ this.subPaths = []; diff --git a/src/materials/MeshDepthMaterial.js b/src/materials/MeshDepthMaterial.js index abfa8f2d7e082f..cd89eb5d8c4426 100644 --- a/src/materials/MeshDepthMaterial.js +++ b/src/materials/MeshDepthMaterial.js @@ -95,7 +95,7 @@ class MeshDepthMaterial extends Material { * map set, this value is not applied. * * @type {number} - * @default 0 + * @default 1 */ this.displacementScale = 1; diff --git a/src/materials/MeshDistanceMaterial.js b/src/materials/MeshDistanceMaterial.js index 142ed98a2e7269..0169d542777492 100644 --- a/src/materials/MeshDistanceMaterial.js +++ b/src/materials/MeshDistanceMaterial.js @@ -90,7 +90,7 @@ class MeshDistanceMaterial extends Material { * map set, this value is not applied. * * @type {number} - * @default 0 + * @default 1 */ this.displacementScale = 1; diff --git a/src/materials/MeshLambertMaterial.js b/src/materials/MeshLambertMaterial.js index a27f5065c25503..e3dd0f0871a55a 100644 --- a/src/materials/MeshLambertMaterial.js +++ b/src/materials/MeshLambertMaterial.js @@ -221,7 +221,7 @@ class MeshLambertMaterial extends Material { * map set, this value is not applied. * * @type {number} - * @default 0 + * @default 1 */ this.displacementScale = 1; diff --git a/src/materials/MeshMatcapMaterial.js b/src/materials/MeshMatcapMaterial.js index 9ca5ec3abe6ae8..f6f8e28e88770e 100644 --- a/src/materials/MeshMatcapMaterial.js +++ b/src/materials/MeshMatcapMaterial.js @@ -157,7 +157,7 @@ class MeshMatcapMaterial extends Material { * map set, this value is not applied. * * @type {number} - * @default 0 + * @default 1 */ this.displacementScale = 1; diff --git a/src/materials/MeshNormalMaterial.js b/src/materials/MeshNormalMaterial.js index bb3d650a91b5dd..37c9e36434f11e 100644 --- a/src/materials/MeshNormalMaterial.js +++ b/src/materials/MeshNormalMaterial.js @@ -109,7 +109,7 @@ class MeshNormalMaterial extends Material { * map set, this value is not applied. * * @type {number} - * @default 0 + * @default 1 */ this.displacementScale = 1; diff --git a/src/materials/MeshPhongMaterial.js b/src/materials/MeshPhongMaterial.js index 182488cdb125f8..431dc21f84c538 100644 --- a/src/materials/MeshPhongMaterial.js +++ b/src/materials/MeshPhongMaterial.js @@ -236,7 +236,7 @@ class MeshPhongMaterial extends Material { * map set, this value is not applied. * * @type {number} - * @default 0 + * @default 1 */ this.displacementScale = 1; diff --git a/src/materials/MeshPhysicalMaterial.js b/src/materials/MeshPhysicalMaterial.js index 661d91c50bdfa8..8b144719317885 100644 --- a/src/materials/MeshPhysicalMaterial.js +++ b/src/materials/MeshPhysicalMaterial.js @@ -72,7 +72,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial { * property provides additional rotation to the vectors in the texture. * * @type {number} - * @default 1 + * @default 0 */ this.anisotropyRotation = 0; diff --git a/src/materials/MeshStandardMaterial.js b/src/materials/MeshStandardMaterial.js index ab9b81c3d97912..903ec6981b669a 100644 --- a/src/materials/MeshStandardMaterial.js +++ b/src/materials/MeshStandardMaterial.js @@ -261,7 +261,7 @@ class MeshStandardMaterial extends Material { * map set, this value is not applied. * * @type {number} - * @default 0 + * @default 1 */ this.displacementScale = 1; diff --git a/src/materials/MeshToonMaterial.js b/src/materials/MeshToonMaterial.js index 7d3362852e299b..e8d298603e2c7b 100644 --- a/src/materials/MeshToonMaterial.js +++ b/src/materials/MeshToonMaterial.js @@ -224,7 +224,7 @@ class MeshToonMaterial extends Material { * map set, this value is not applied. * * @type {number} - * @default 0 + * @default 1 */ this.displacementScale = 1; diff --git a/src/math/Triangle.js b/src/math/Triangle.js index ec4c002557fdf6..9de28261b8f08d 100644 --- a/src/math/Triangle.js +++ b/src/math/Triangle.js @@ -473,7 +473,8 @@ class Triangle { } const vc = d1 * d4 - d3 * d2; - if ( vc <= 0 && d1 >= 0 && d3 <= 0 ) { + + if ( vc <= 0 && d1 >= 0 && d3 <= 0 && d1 - d3 > 0 ) { // modification of the algorithm: d1 - d3 is the squared length of AB, so skip this region if a and b coincide v = d1 / ( d1 - d3 ); // edge region of AB; barycentric coords (1-v, v, 0) diff --git a/src/nodes/display/PassNode.js b/src/nodes/display/PassNode.js index 93eac32fbfbb70..fb98df1497ef24 100644 --- a/src/nodes/display/PassNode.js +++ b/src/nodes/display/PassNode.js @@ -283,7 +283,7 @@ class PassNode extends Node { * Whether the pass is transparent. * * @type {boolean} - * @default false + * @default true */ this.transparent = true; diff --git a/src/nodes/lighting/ShadowNode.js b/src/nodes/lighting/ShadowNode.js index f05b2be407c736..9cb051f00d81e7 100644 --- a/src/nodes/lighting/ShadowNode.js +++ b/src/nodes/lighting/ShadowNode.js @@ -239,7 +239,7 @@ class ShadowNode extends ShadowBaseNode { * * @type {number} * @readonly - * @default true + * @default 0 */ this.depthLayer = 0; diff --git a/src/objects/BatchedMesh.js b/src/objects/BatchedMesh.js index 1bfc912883adc7..8428f1caf4c4c7 100644 --- a/src/objects/BatchedMesh.js +++ b/src/objects/BatchedMesh.js @@ -498,7 +498,7 @@ class BatchedMesh extends Mesh { /** * Computes the bounding box, updating {@link BatchedMesh#boundingBox}. * Bounding boxes aren't computed by default. They need to be explicitly computed, - * otherwise they are `null`. + * otherwise they are `null`. Must be recomputed when instances change. */ computeBoundingBox() { @@ -527,8 +527,8 @@ class BatchedMesh extends Mesh { /** * Computes the bounding sphere, updating {@link BatchedMesh#boundingSphere}. - * Bounding spheres aren't computed by default. They need to be explicitly computed, - * otherwise they are `null`. + * The engine computes the bounding sphere once when it is needed. Must be + * recomputed when instances change. */ computeBoundingSphere() { diff --git a/test/unit/src/math/Triangle.tests.js b/test/unit/src/math/Triangle.tests.js index 3b81d7258d287a..90e2a3876cb21d 100644 --- a/test/unit/src/math/Triangle.tests.js +++ b/test/unit/src/math/Triangle.tests.js @@ -281,6 +281,11 @@ export default QUnit.module( 'Maths', () => { a.closestPointToPoint( new Vector3( 0, - 2, 0 ), point ); assert.ok( point.equals( new Vector3( 0, 0, 0 ) ), 'Passed!' ); + // degenerate triangle where a and b coincide + a.set( zero3, zero3, new Vector3( 2, 0, 0 ) ); + a.closestPointToPoint( new Vector3( 1, 1, 0 ), point ); + assert.ok( point.equals( new Vector3( 1, 0, 0 ) ), 'Passed!' ); + } ); QUnit.test( 'isFrontFacing', ( assert ) => {