cocos-enhance-kit/jsb-adapter/engine/scene/render-data.js
2022-06-25 00:23:03 +08:00

28 lines
851 B
JavaScript

let proto = cc.RenderData.prototype;
cc.RenderData.prototype.init = function (assembler) {
this._renderDataList = new renderer.RenderDataList();
assembler.setRenderDataList(this._renderDataList);
this._nativeAssembler = assembler;
};
let originClear = proto.clear;
proto.clear = function () {
originClear.call(this);
this._renderDataList.clear();
};
let originUpdateMesh = proto.updateMesh;
proto.updateMesh = function (meshIndex, vertices, indices) {
originUpdateMesh.call(this, meshIndex, vertices, indices);
if (vertices && indices) {
this._renderDataList.updateMesh(meshIndex, vertices, indices);
}
}
proto.updateMeshRange = function (verticesCount, indicesCount) {
this._nativeAssembler.updateVerticesRange(0, 0, verticesCount);
this._nativeAssembler.updateIndicesRange(0, 0, indicesCount);
}