mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2024-12-25 19:28:28 +00:00
[jsb-adapter] 多纹理渲染 - 适配原生平台
This commit is contained in:
parent
1b236db58e
commit
9fca60746c
@ -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
|
||||||
|
@ -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];
|
||||||
|
21
jsb-adapter/engine/assemblers/motion-streak-multi.js
Normal file
21
jsb-adapter/engine/assemblers/motion-streak-multi.js
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
@ -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, {
|
||||||
|
@ -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');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user