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

fixed calc material hash #5615

Conversation

2youyou2
Copy link
Contributor

@2youyou2 2youyou2 commented Oct 25, 2019

Re: cocos/2d-tasks#2000

Changes:

  • fixed calc material hash

hashData += prop._id + ';';
}
else {
hashData += prop.toString() + ';';
Copy link
Contributor

@holycanvas holycanvas Oct 25, 2019

Choose a reason for hiding this comment

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

是之前hash的计算过程导致的实例化之后还识别为同个材质么?

Copy link
Contributor Author

@2youyou2 2youyou2 Oct 25, 2019

Choose a reason for hiding this comment

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

是的

@holycanvas holycanvas requested a review from caryliu1999 Oct 25, 2019
hashData += prop._id + ';';
}
else {
hashData += prop.toString() + ';';
Copy link
Contributor

@caryliu1999 caryliu1999 Oct 25, 2019

Choose a reason for hiding this comment

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

如果是对象的话,所有对象进行 toString 的结果都是字符串 “object”,这个要注意一下,我看之前的 PARAM_MAT4 好像就是对象,还有其他情况是使用对象的吗?

Copy link
Contributor Author

@2youyou2 2youyou2 Oct 25, 2019

Choose a reason for hiding this comment

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

没有对象了,在解析的时候会全部转换为 ArrayBuffer

Copy link
Contributor

@caryliu1999 caryliu1999 Oct 25, 2019

Choose a reason for hiding this comment

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

好的

}
else {
if (value && typeof value === 'object') {
cc.warn(`Set effect property ${this._name} warning : should transform object to ArrayBuffer`);
Copy link
Contributor Author

@2youyou2 2youyou2 Oct 25, 2019

Choose a reason for hiding this comment

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

防止漏处理的对象,加个 warning

@holycanvas holycanvas merged commit 4b56ca9 into cocos:v2.2.1-release Oct 25, 2019
1 check passed
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

3 participants