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

Conversation

@holycanvas
Copy link
Contributor

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);

This comment has been minimized.

Copy link
@2youyou2

2youyou2 Aug 5, 2019

Contributor

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

This comment has been minimized.

Copy link
@holycanvas

holycanvas Aug 5, 2019

Author Contributor

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

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

This comment has been minimized.

Copy link
@2youyou2

2youyou2 Aug 5, 2019

Contributor

这里应该用 once ?

This comment has been minimized.

Copy link
@holycanvas

holycanvas Aug 5, 2019

Author Contributor

@2youyou2 2youyou2 merged commit 7d65e42 into cocos-creator:v2.1.3 Aug 13, 2019
1 check passed
1 check passed
ci/circleci: test Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.