diff --git a/jsb-adapter/builtin/renderer/enums.js b/jsb-adapter/builtin/renderer/enums.js index 293d3a53..2a0776b1 100644 --- a/jsb-adapter/builtin/renderer/enums.js +++ b/jsb-adapter/builtin/renderer/enums.js @@ -211,6 +211,7 @@ export const enums = { ATTR_TEX_COORD6: 'a_texCoord6', ATTR_TEX_COORD7: 'a_texCoord7', ATTR_TEX_COORD8: 'a_texCoord8', + ATTR_TEX_ID: 'a_texId', // vertex attribute type ATTR_TYPE_INT8: 5120, // gl.BYTE diff --git a/jsb-adapter/engine/assemblers/assembler.js b/jsb-adapter/engine/assemblers/assembler.js index 593e8b1b..c3bf5367 100644 --- a/jsb-adapter/engine/assemblers/assembler.js +++ b/jsb-adapter/engine/assemblers/assembler.js @@ -68,8 +68,12 @@ let Assembler = { _updateRenderData () { if (!this._renderComp || !this._renderComp.isValid) return; - this.updateRenderData(this._renderComp); + if (!this.updateRenderData(this._renderComp)) { + this._aftUpdateRenderDataForNative(); + } + }, + _aftUpdateRenderDataForNative() { let materials = this._renderComp._materials; for (let i = 0; i < materials.length; i++) { let m = materials[i]; diff --git a/jsb-adapter/engine/assemblers/motion-streak-multi.js b/jsb-adapter/engine/assemblers/motion-streak-multi.js new file mode 100644 index 00000000..1df4efc6 --- /dev/null +++ b/jsb-adapter/engine/assemblers/motion-streak-multi.js @@ -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; + } + } +}); diff --git a/jsb-adapter/engine/assemblers/motion-streak.js b/jsb-adapter/engine/assemblers/motion-streak.js index 84bf99e3..8ad9648a 100644 --- a/jsb-adapter/engine/assemblers/motion-streak.js +++ b/jsb-adapter/engine/assemblers/motion-streak.js @@ -1,5 +1,5 @@ -let proto = cc.MotionStreak.__assembler__.prototype; +let proto = cc.MotionStreak.__assembler__.MotionStreakAssembler.prototype; let _init = proto.init; let _update = proto.update; cc.js.mixin(proto, { diff --git a/jsb-adapter/engine/index.js b/jsb-adapter/engine/index.js index ccf31745..b507ac91 100644 --- a/jsb-adapter/engine/index.js +++ b/jsb-adapter/engine/index.js @@ -58,6 +58,7 @@ if (CC_NATIVERENDERER) { require('./assemblers/mask-assembler.js'); require('./assemblers/graphics-assembler.js'); require('./assemblers/motion-streak.js'); + require('./assemblers/motion-streak-multi.js'); require('./assemblers/mesh-renderer.js'); require('./assemblers/particle-3d-assembler.js');