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
1 change: 1 addition & 0 deletions src/Three.TSL.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const backgroundBlurriness = TSL.backgroundBlurriness;
export const backgroundIntensity = TSL.backgroundIntensity;
export const backgroundRotation = TSL.backgroundRotation;
export const batch = TSL.batch;
export const batchIndirectIndex = TSL.batchIndirectIndex;
export const bentNormalView = TSL.bentNormalView;
export const billboarding = TSL.billboarding;
export const bitAnd = TSL.bitAnd;
Expand Down
9 changes: 9 additions & 0 deletions src/nodes/accessors/Batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ function getPreviousNode( batchMesh, id ) {
*/
export const batchColor = /*@__PURE__*/ varyingProperty( 'vec4', 'vBatchColor' );

/**
* TSL object representing a varying property for the batch indirect index (instance ID).
*
* @type {VaryingNode<uint>}
*/
export const batchIndirectIndex = /*@__PURE__*/ varyingProperty( 'uint', 'vBatchIndirectId' );

/**
* TSL function representing the vertex shader batching setup.
* Applies the batch transformation matrix to positionLocal, normalLocal, and tangentLocal.
Expand All @@ -122,6 +129,8 @@ export const batch = /*@__PURE__*/ Fn( ( [ batchMesh ], builder ) => {

const indirectId = getIndirectIndex( batchMesh._indirectTexture, int( batchingIdNode ) );

batchIndirectIndex.assign( indirectId );

const batchingMatrix = createBatchingMatrixNode( batchMesh._matricesTexture, indirectId );

const colorsTexture = batchMesh._colorsTexture;
Expand Down