[engine] service pack 命名空间、多纹理渲染基础

This commit is contained in:
SmallMain
2022-06-25 00:29:47 +08:00
parent f31cb598e3
commit 7d0519ed68
8 changed files with 432 additions and 2 deletions

View File

@@ -80,10 +80,52 @@ var builtins = {
}
this._loadBuiltins('effect', () => {
this._loadBuiltins('material', cb);
this._loadBuiltins('material', () => {
this._loadBuiltinsSP(cb);
});
});
},
_loadBuiltinsSP(cb) {
cc.sp.MAX_MULTITEXTURE_NUM = 8;
// cc.renderer.device.caps.maxTextureUnits
this._loadMultiEffect('multi-2d-sprite', (effect) => {
cc.sp.multi2dSpriteEffectAsset = effect;
effect.addRef();
cc.sp.inited = true;
cc.sp.multiBatcher.init();
cb();
});
},
_loadMultiEffect(name, cb) {
if (CC_EDITOR) {
cc.assetManager.loadAny(Editor.assetdb.remote.urlToUuid('db://service-pack-resources/sp/effects/' + name + '.effect'), function (err, effect) {
if (err) {
return Editor.error(err);
} else {
cb(effect);
}
});
} else {
cc.assetManager.loadBundle('sp', (err, bundle) => {
if (err) {
cc.error(err);
} else {
bundle.load('effects/' + name, cc.EffectAsset, (err, effect) => {
if (err) {
cc.error(err);
} else {
cb(effect);
}
});
}
});
}
},
/**
* !#en
* Get the built-in asset using specific type and name.