diff --git a/docs/TSL.md b/docs/TSL.md index 26a4f43cf18d40..e1dd74fd10e165 100644 --- a/docs/TSL.md +++ b/docs/TSL.md @@ -1483,11 +1483,11 @@ Example: ```js import { billboarding } from 'three/tsl'; -// Full billboarding (like particles) - faces camera in all directions +// Default: Horizontal only (like trees) - rotates around Y axis only material.vertexNode = billboarding(); -// Horizontal only (like trees) - rotates around Y axis only -material.vertexNode = billboarding( { horizontal: true, vertical: false } ); +// Full billboarding (like particles) - faces camera in all directions +material.vertexNode = billboarding( { horizontal: true, vertical: true } ); ``` ## NodeMaterial diff --git a/examples/games_fps.html b/examples/games_fps.html index 6d00986d2c1cf8..9cfa166c94b2dc 100644 --- a/examples/games_fps.html +++ b/examples/games_fps.html @@ -203,7 +203,9 @@ if ( result ) { - playerOnFloor = result.normal.y > 0; + // determine if the surface we bumped into is something we can stand on + + playerOnFloor = result.normal.y >= 0.15; // allow slopes up to ~81° but ignore sheer vertical walls if ( ! playerOnFloor ) { diff --git a/examples/webgpu_custom_fog.html b/examples/webgpu_custom_fog.html index 9ef8604b10d00a..944a612f971006 100644 --- a/examples/webgpu_custom_fog.html +++ b/examples/webgpu_custom_fog.html @@ -53,8 +53,11 @@ // custom fog - const skyColor = color( 0xf0f5f5 ); - const groundColor = color( 0xd0dee7 ); + const skyColorValue = 0xf0f5f5; + const groundColorValue = 0xd0dee7; + + const skyColor = color( skyColorValue ); + const groundColor = color( groundColorValue ); const fogNoiseDistance = positionView.z.negate().smoothstep( 0, camera.far - 300 ); @@ -112,7 +115,7 @@ // lights - scene.add( new THREE.HemisphereLight( skyColor.value, groundColor.value, 0.5 ) ); + scene.add( new THREE.HemisphereLight( skyColorValue, groundColorValue, 0.5 ) ); // geometry diff --git a/src/objects/InstancedMesh.js b/src/objects/InstancedMesh.js index b2dbb5745fa4a5..fcad3777288d98 100644 --- a/src/objects/InstancedMesh.js +++ b/src/objects/InstancedMesh.js @@ -213,10 +213,11 @@ class InstancedMesh extends Mesh { * * @param {number} index - The instance index. * @param {Color} color - The target object that is used to store the method's result. + * @return {Color} A reference to the target color. */ getColorAt( index, color ) { - color.fromArray( this.instanceColor.array, index * 3 ); + return color.fromArray( this.instanceColor.array, index * 3 ); } @@ -225,10 +226,11 @@ class InstancedMesh extends Mesh { * * @param {number} index - The instance index. * @param {Matrix4} matrix - The target object that is used to store the method's result. + * @return {Matrix4} A reference to the target matrix. */ getMatrixAt( index, matrix ) { - matrix.fromArray( this.instanceMatrix.array, index * 16 ); + return matrix.fromArray( this.instanceMatrix.array, index * 16 ); } @@ -314,6 +316,7 @@ class InstancedMesh extends Mesh { * * @param {number} index - The instance index. * @param {Color} color - The instance color. + * @return {InstancedMesh} A reference to this instanced mesh. */ setColorAt( index, color ) { @@ -324,6 +327,7 @@ class InstancedMesh extends Mesh { } color.toArray( this.instanceColor.array, index * 3 ); + return this; } @@ -333,10 +337,12 @@ class InstancedMesh extends Mesh { * * @param {number} index - The instance index. * @param {Matrix4} matrix - The local transformation. + * @return {InstancedMesh} A reference to this instanced mesh. */ setMatrixAt( index, matrix ) { matrix.toArray( this.instanceMatrix.array, index * 16 ); + return this; } @@ -347,6 +353,7 @@ class InstancedMesh extends Mesh { * @param {number} index - The instance index. * @param {Mesh} object - A mesh which `morphTargetInfluences` property containing the morph target weights * of a single instance. + * @return {InstancedMesh} A reference to this instanced mesh. */ setMorphAt( index, object ) { @@ -377,6 +384,7 @@ class InstancedMesh extends Mesh { array[ dataIndex ] = morphBaseInfluence; array.set( objectInfluences, dataIndex + 1 ); + return this; }