Skip to content

NodeMaterial: getHash and customProgramCacheKey#19833

Merged
mrdoob merged 10 commits intomrdoob:devfrom
sunag:dev-gethash
Jul 13, 2020
Merged

NodeMaterial: getHash and customProgramCacheKey#19833
mrdoob merged 10 commits intomrdoob:devfrom
sunag:dev-gethash

Conversation

@sunag
Copy link
Collaborator

@sunag sunag commented Jul 12, 2020

Node.getHash() or NodeMaterial.getHash() generate a JSON.

This approach building the string is more fast that array.join and JSON.stringify.

@sunag sunag requested a review from Mugen87 July 12, 2020 04:16
@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 12, 2020

This is great! 👍

@mrdoob When this is merged, it should be okay to merge #19673 (which ensures onBeforeCompile() is called at the correct time and improves the performance of getParameters()).

@sunag
Copy link
Collaborator Author

sunag commented Jul 13, 2020

Node.hashProperties is necessary in case of variation of the shader from the node config.

@mrdoob mrdoob added this to the r119 milestone Jul 13, 2020
@mrdoob
Copy link
Owner

mrdoob commented Jul 13, 2020

@sunag ready to be merged?

@sunag
Copy link
Collaborator Author

sunag commented Jul 13, 2020

@sunag ready to be merged?

Yes!

var hash = '{';
var prop, obj;

for(prop in this) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mugen said

I can clean things up after merging. Don't be worry about this

Please be consistent. If users are not expected to follow the three.js code style, then please remove the instructions to do so found in https://github.com/mrdoob/three.js/wiki/How-to-contribute-to-three.js.

Format whitespace consistently with the rest of code base. See the [an] article Mr.doob's-Code-Style™, and the online code beautifier. It is highly recommended to use ESLint plugin and appropriate settings in your code editor.

/ping @mrdoob

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@WestLangley I see no problem in fix this... so far I thought that you is referring to the json output.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, just wanted to get this merged quickly 🤓.

@mrdoob mrdoob merged commit d09193d into mrdoob:dev Jul 13, 2020
@mrdoob
Copy link
Owner

mrdoob commented Jul 13, 2020

Thanks!

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.

4 participants