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: uniforms #27706

Merged
merged 2 commits into from
Feb 8, 2024
Merged

TSL: uniforms #27706

merged 2 commits into from
Feb 8, 2024

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Feb 8, 2024

Related issue: #27691 (comment)

Description

uniforms will help transfer arrays from Three.js to TSL, such as Vector* and Color and Floats initially.

const floats = uniforms( [ 0, 0.5, 1 ] );

const vectors = uniforms( [
	new THREE.Vector4( 1, 0, 1, 1 ),
	new THREE.Vector4( 0, 1, 0, 1 ),
	new THREE.Vector4( 0, 0, 1, 1 )
] );

const colors = uniforms( [
	new THREE.Color( 0xff0000 ),
	new THREE.Color( 0x00ff00 ),
	new THREE.Color( 0x0000ff )
] );

//

const material = new NodeMaterial();

// accessing a element
material.colorNode = vectors.element( 0 );

@sunag sunag added this to the r162 milestone Feb 8, 2024
@sunag sunag marked this pull request as ready for review February 8, 2024 03:02
@RenaudRohlinger
Copy link
Collaborator

The API feels so good and easy to use. Amazing!

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.

2 participants