-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
WebGLMaterials helper #19304
WebGLMaterials helper #19304
Conversation
I've tested the PR on my local computer and it seems to work fine. @mrdoob I have one (minor) concern about this PR: |
This is my first PR, just to understand how you guys work. I will be happy to help making WebGLRenderer less monolithic, messy and more flexible. If you allow me to. |
Thanks. Yes, I think this is definitely one step in the right direction. I think more refactoring will become clearer after this. |
if ( material.isShaderMaterial ) { | ||
|
||
material.uniformsNeedUpdate = false; // #15581 | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, you changed the order of this code. Before the PR it executed after WebGLUniforms.upload()
and now it's executing before.
I'll merge the PR but I'll put this code back just in case. Step by step...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICS, that should not have any side effects. It's just important that this bit comes before this section:
if ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {
WebGLUniforms.upload( _gl, materialProperties.uniformsList, m_uniforms, textures );
material.uniformsNeedUpdate = false;
}
Otherwise WebGLUniforms.upload()
is called twice for ShaderMaterials
when uniformsNeedUpdate
is set to true
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. This makes me wonder, how much you guys trust unit and e2e tests?
And how safe is more radical refactoring?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes me wonder, how much you guys trust unit and e2e tests?
Right now, the test coverage is not sufficient so broad refactoring can only be done with a lot of manual testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. This makes me wonder, how much you guys trust unit and e2e tests?
Unit tests and e2e are nice to have but they wouldn't catch uploading uniforms twice.
The codebase is still fairly small just so we can still keep it in our heads (more or less). I would hate if we get to a point where no one understands it and we just rely on tests.
And how safe is more radical refactoring?
Generally not a fan of radical refactorings. Incremental refactoring are more manageable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, moved the code back: b063139
Thanks! |
Introduced WebGLMaterials helper
made all WebgLRenderer helpers customizable via WebGLRendererParameters