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

Nodes: Define stack.assign() as default. #26881

Merged
merged 2 commits into from Oct 2, 2023
Merged

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Oct 1, 2023

Related issue: #26820, #26821 (comment)

Description

Using StackNode.assign() instead of VarNode.assign() makes the control flow less confusing and more optimized, StackNode can work as the lines of code are when creating the Shader, thus being able to add statements and conditions in correct sequences, for example.

A revision was made to the Lighting Model in favor of the standard.

@sunag sunag added this to the r158 milestone Oct 1, 2023
@sunag sunag marked this pull request as ready for review October 1, 2023 16:16
@sunag sunag merged commit 9480ccd into mrdoob:dev Oct 2, 2023
18 checks passed
@sunag sunag deleted the dev-stack-assign branch October 2, 2023 06:13
@@ -48,7 +48,7 @@ const shaderNodeHandler = {

const nodeElement = NodeElements.get( prop.slice( 0, prop.length - 'Assign'.length ) );

return ( ...params ) => nodeObj.assign( nodeElement( nodeObj, ...params ) );
return node.isStackNode ? ( ...params ) => nodeObj.assign( params[ 0 ], nodeElement( ...params ) ) : ( ...params ) => nodeObj.assign( nodeElement( nodeObj, ...params ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we please also do this in the if ( NodeElements.has( prop ) ) clause? Then we can remove StackNode.loop and StackNode.assign.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Fixed in #26821)

@@ -68,6 +69,23 @@ class StackNode extends Node {

assign( targetNode, sourceValue ) {

sourceValue = nodeObject( sourceValue );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need all of this, we can just remove this function and rely on ShaderNode.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Fixed in #26821)

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.

None yet

2 participants