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: Introduce .onReference() #28104

Merged
merged 1 commit into from
Apr 10, 2024
Merged

TSL: Introduce .onReference() #28104

merged 1 commit into from
Apr 10, 2024

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Apr 10, 2024

Related issue: #27964

Description

Same logic as .onUpdate() but allows you to customize the reference. In the example below, the uniform will be updated once in the rendering in each different material, if the reference is not defined, it would be updated only once, regardless of how many different materials are used in rendering.

const materialRotation = uniform( 0 )
	.onReference( ( frame ) => frame.material )
	.onRenderUpdate( () => {

		return material.rotation;

	} );

@sunag sunag added this to the r164 milestone Apr 10, 2024
@sunag sunag changed the title TSL: Added .onReference() TSL: Introduce .onReference() Apr 10, 2024
@sunag sunag marked this pull request as ready for review April 10, 2024 05:11
@sunag sunag merged commit 7182185 into mrdoob:dev Apr 10, 2024
11 checks passed
@sunag sunag deleted the dev-onreference branch April 10, 2024 05:11
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