Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/TSL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion examples/games_fps.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {

Expand Down
9 changes: 6 additions & 3 deletions examples/webgpu_custom_fog.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down Expand Up @@ -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

Expand Down
12 changes: 10 additions & 2 deletions src/objects/InstancedMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

}

Expand All @@ -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 );

}

Expand Down Expand Up @@ -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 ) {

Expand All @@ -324,6 +327,7 @@ class InstancedMesh extends Mesh {
}

color.toArray( this.instanceColor.array, index * 3 );
return this;

}

Expand All @@ -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;

}

Expand All @@ -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 ) {

Expand Down Expand Up @@ -377,6 +384,7 @@ class InstancedMesh extends Mesh {
array[ dataIndex ] = morphBaseInfluence;

array.set( objectInfluences, dataIndex + 1 );
return this;

}

Expand Down
Loading