Skip to content

LineMaterial: Set needsupdate when changing worldUnits property#32952

Merged
Mugen87 merged 2 commits intomrdoob:devfrom
dsafa:line-material-worldunits-needs-update
Feb 5, 2026
Merged

LineMaterial: Set needsupdate when changing worldUnits property#32952
Mugen87 merged 2 commits intomrdoob:devfrom
dsafa:line-material-worldunits-needs-update

Conversation

@dsafa
Copy link
Contributor

@dsafa dsafa commented Feb 4, 2026

Related issue: n/a

Description

I think that it can be confusing that changing worldUnits doesn't affect anything in the rendering. The other properties dashed and alphaToCoverage set needsUpdate when they change


this.needsUpdate = true;

}
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you want to add this, please remove below lines from the examples:

matLine.needsUpdate = true;

matLine.needsUpdate = true;

matThresholdLine.needsUpdate = true;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@WestLangley
Copy link
Collaborator

@Mugen87 I had some implementation concerns in #26720 that were not addressed. This PR is proposing to repeat those code patterns. I'm just checking to see if you OK with the file as it is currently written.

@dsafa
Copy link
Contributor Author

dsafa commented Feb 5, 2026

I will add, it took me a bit to parse the ( value === true ) !== this.value check. But I decided to just follow the existing properties. I can switch it to just a plain value !== this.value check or even the previous Boolean(value) !== this.value is much easier to read

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 5, 2026

@WestLangley I just think it makes sense to align the worldUnits setter to dashed and alphaToCoverage.

@WestLangley
Copy link
Collaborator

@Mugen87 I agree with that. I had questions about the coding patterns introduced in the earlier PR. I was hoping you would comment on my concerns.

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 5, 2026

It's a bit of a subjective matter but imo #26720 made the readability in the file worse. However, if we want to use getters/setters in LineMaterial, we need certain checks that were previously not required (because the properties were defined after the ctor call). I would rather say that's a problem of ShaderMaterial's design in general.

@Mugen87 Mugen87 merged commit 0ad0c00 into mrdoob:dev Feb 5, 2026
14 of 15 checks passed
@Mugen87 Mugen87 added this to the r183 milestone Feb 5, 2026
@WestLangley
Copy link
Collaborator

@dsafa @Mugen87 Thank your for your responses. It appears we are in agreement regarding the readability of this pattern:

if ( ( value === true ) !== this.worldUnits )

I'd add to that, the unfortunate necessity of this pattern:

if ( ! this.uniforms ) return;

@dsafa dsafa deleted the line-material-worldunits-needs-update branch February 6, 2026 04:52
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.

3 participants