mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2025-10-09 08:45:23 +00:00
[engine] Spine 组件多纹理渲染、动态图集、与其它组件合批、region 换装
This commit is contained in:
@@ -655,6 +655,7 @@ let SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
} else {
|
||||
this.ensureLoadTexture()
|
||||
}
|
||||
this.emit("_resetDynamicAtlasFrame");
|
||||
},
|
||||
|
||||
_calculateUV () {
|
||||
|
@@ -191,6 +191,52 @@ let MeshBuffer = cc.Class({
|
||||
this.requestStatic(vertexCount, indiceCount);
|
||||
return this._offsetInfo;
|
||||
},
|
||||
|
||||
requestForSpine(vertexCount, indiceCount) {
|
||||
if (this._batcher._buffer !== this) {
|
||||
this._batcher._flush();
|
||||
this._batcher._buffer = this;
|
||||
}
|
||||
|
||||
this.requestStaticForSpine(vertexCount, indiceCount);
|
||||
return this._offsetInfo;
|
||||
},
|
||||
|
||||
requestStaticForSpine(vertexCount, indiceCount) {
|
||||
|
||||
this.checkAndSwitchBuffer(vertexCount);
|
||||
|
||||
let byteOffset = this.byteOffset + vertexCount * this._vertexBytes;
|
||||
let indiceOffset = this.indiceOffset + indiceCount;
|
||||
|
||||
let byteLength = this._vData.byteLength;
|
||||
let indiceLength = this._iData.length;
|
||||
if (byteOffset > byteLength || indiceOffset > indiceLength) {
|
||||
while (byteLength < byteOffset || indiceLength < indiceOffset) {
|
||||
this._initVDataCount *= 2;
|
||||
this._initIDataCount *= 2;
|
||||
|
||||
byteLength = this._initVDataCount * 4;
|
||||
indiceLength = this._initIDataCount;
|
||||
}
|
||||
|
||||
this._reallocBuffer();
|
||||
}
|
||||
|
||||
let offsetInfo = this._offsetInfo;
|
||||
offsetInfo.vertexOffset = this.vertexOffset;
|
||||
offsetInfo.indiceOffset = this.indiceOffset;
|
||||
offsetInfo.byteOffset = this.byteOffset;
|
||||
},
|
||||
|
||||
adjustForSpine(vertexCount, indiceCount) {
|
||||
this.vertexOffset += vertexCount;
|
||||
this.indiceOffset += indiceCount;
|
||||
|
||||
this.byteOffset = this.byteOffset + vertexCount * this._vertexBytes;
|
||||
|
||||
this._dirty = true;
|
||||
},
|
||||
|
||||
_reallocBuffer () {
|
||||
this._reallocVData(true);
|
||||
|
Reference in New Issue
Block a user