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

add deferred loading of mesh #5071

Merged
merged 2 commits into from Aug 13, 2019
Merged

add deferred loading of mesh #5071

merged 2 commits into from Aug 13, 2019

Conversation

@holycanvas
Copy link
Contributor

@holycanvas holycanvas commented Aug 2, 2019

Re: cocos-creator/2d-tasks#
https://forum.cocos.com/t/2-1-2-3d/81351/3
Changes:

  • 增加mesh的延迟加载
self._setMesh(self._mesh);
self._activateMaterial();
});
postLoadMesh(this._mesh);
Copy link
Contributor

@2youyou2 2youyou2 Aug 5, 2019

Choose a reason for hiding this comment

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

延迟加载是需要自己手动 load 资源的?那材质也是没有处理这个流程的。
如果不想要延迟加载应该怎么处理?

Copy link
Contributor Author

@holycanvas holycanvas Aug 5, 2019

Choose a reason for hiding this comment

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

是需要手动加载资源的,参考cc.Sprite对spriteFrame的延迟加载。材质和mesh不太一样,延迟加载只对有原生文件依赖的才有用,mesh和texture都依赖其他的原生文件。材质并没有依赖其他原生文件,不受延迟加载影响。

if (this._mesh && !this._mesh.loaded) {
this.disableRender();
var self = this;
this._mesh.on('load', function () {
Copy link
Contributor

@2youyou2 2youyou2 Aug 5, 2019

Choose a reason for hiding this comment

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

这里应该用 once ?

Copy link
Contributor Author

@holycanvas holycanvas Aug 5, 2019

Choose a reason for hiding this comment

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

@2youyou2 2youyou2 merged commit 7d65e42 into cocos-creator:v2.1.3 Aug 13, 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
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants