Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSL: Fix tslFn() output type called before build #28409

Merged
merged 1 commit into from
May 17, 2024
Merged

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented May 17, 2024

Description

This fix allows you to use function calls before the build process, allowing you to provide the correct output type from the function. In the example below tangentGeometry is the return of attribute( 'tangent', 'vec4' ) and not a function because this is called at the end of the function, like tslFn( ... )() the function will return ShaderCallNodeInternal , the call is executed only in the building process.

export const tangentGeometry = /*#__PURE__*/ tslFn( ( stack, builder ) => {

	if ( builder.geometry.hasAttribute( 'tangent' ) === false ) {

		builder.geometry.computeTangents();

	}

	return attribute( 'tangent', 'vec4' );

} )();

@sunag sunag changed the title TSL: Fix tslFn() output type TSL: Fix tslFn() output type called before build May 17, 2024
@sunag sunag added this to the r165 milestone May 17, 2024
@sunag sunag marked this pull request as ready for review May 17, 2024 17:01
@sunag sunag merged commit 013e93d into mrdoob:dev May 17, 2024
11 checks passed
@sunag sunag deleted the dev-node-4 branch May 17, 2024 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant