[jsb-adapter] 多纹理渲染 - 适配原生平台

This commit is contained in:
SmallMain 2022-06-25 00:44:28 +08:00
parent 1b236db58e
commit 9fca60746c
5 changed files with 29 additions and 2 deletions

View File

@ -211,6 +211,7 @@ export const enums = {
ATTR_TEX_COORD6: 'a_texCoord6', ATTR_TEX_COORD6: 'a_texCoord6',
ATTR_TEX_COORD7: 'a_texCoord7', ATTR_TEX_COORD7: 'a_texCoord7',
ATTR_TEX_COORD8: 'a_texCoord8', ATTR_TEX_COORD8: 'a_texCoord8',
ATTR_TEX_ID: 'a_texId',
// vertex attribute type // vertex attribute type
ATTR_TYPE_INT8: 5120, // gl.BYTE ATTR_TYPE_INT8: 5120, // gl.BYTE

View File

@ -68,8 +68,12 @@ let Assembler = {
_updateRenderData () { _updateRenderData () {
if (!this._renderComp || !this._renderComp.isValid) return; if (!this._renderComp || !this._renderComp.isValid) return;
this.updateRenderData(this._renderComp); if (!this.updateRenderData(this._renderComp)) {
this._aftUpdateRenderDataForNative();
}
},
_aftUpdateRenderDataForNative() {
let materials = this._renderComp._materials; let materials = this._renderComp._materials;
for (let i = 0; i < materials.length; i++) { for (let i = 0; i < materials.length; i++) {
let m = materials[i]; let m = materials[i];

View File

@ -0,0 +1,21 @@
let proto = cc.MotionStreak.__assembler__.MultiMotionStreakAssembler.prototype;
let _update = proto.update;
cc.js.mixin(proto, {
update (comp, dt) {
comp.node._updateWorldMatrix();
_update.call(this, comp, dt);
let { iData, usedVertices } = this._renderData._flexBuffer;
let indiceOffset = 0;
for (let i = 0, l = usedVertices; i < l; i += 2) {
iData[indiceOffset++] = i;
iData[indiceOffset++] = i + 2;
iData[indiceOffset++] = i + 1;
iData[indiceOffset++] = i + 1;
iData[indiceOffset++] = i + 2;
iData[indiceOffset++] = i + 3;
}
}
});

View File

@ -1,5 +1,5 @@
let proto = cc.MotionStreak.__assembler__.prototype; let proto = cc.MotionStreak.__assembler__.MotionStreakAssembler.prototype;
let _init = proto.init; let _init = proto.init;
let _update = proto.update; let _update = proto.update;
cc.js.mixin(proto, { cc.js.mixin(proto, {

View File

@ -58,6 +58,7 @@ if (CC_NATIVERENDERER) {
require('./assemblers/mask-assembler.js'); require('./assemblers/mask-assembler.js');
require('./assemblers/graphics-assembler.js'); require('./assemblers/graphics-assembler.js');
require('./assemblers/motion-streak.js'); require('./assemblers/motion-streak.js');
require('./assemblers/motion-streak-multi.js');
require('./assemblers/mesh-renderer.js'); require('./assemblers/mesh-renderer.js');
require('./assemblers/particle-3d-assembler.js'); require('./assemblers/particle-3d-assembler.js');