1、修正spine动画引起的渲染问题

2、sortinggroup组件只在当前节点和其子节点有效,其他节点仍然使用节点树遍历
This commit is contained in:
lujun 2023-03-21 22:23:01 +08:00
parent 918104a057
commit 973434cd71
18 changed files with 4727 additions and 84 deletions

View File

@ -2,6 +2,11 @@
let _batcher; let _batcher;
let _cullingMask = 0; let _cullingMask = 0;
/**
*
*/
let renderLevel = 0;
/** /**
* *
*/ */
@ -39,6 +44,7 @@ function flushRendererCache(){
//@ts-ignore //@ts-ignore
cc.RenderFlow.visitRootNode = function (rootNode){ cc.RenderFlow.visitRootNode = function (rootNode){
renderLevel = 0;
renderPriority = 0; renderPriority = 0;
rendererCache.length = 0; rendererCache.length = 0;
rendererOrder = false; rendererOrder = false;
@ -77,6 +83,16 @@ cc.RenderFlow.visitRootNode = function (rootNode){
//@ts-ignore //@ts-ignore
cc.RenderFlow.prototype._render = function (node) { cc.RenderFlow.prototype._render = function (node) {
let comp = node._renderComponent; let comp = node._renderComponent;
let preRenderPriority = renderPriority;
renderPriority = node._sortingEnabled ? node._sortingPriority : renderPriority;
if(node._sortingEnabled){
// cc.log(`++ ${node.name}`);
++renderLevel;
}
// cc.log(`${renderLevel} -> ${node.name}`);
if(renderLevel > 0){
if(comp instanceof cc.Mask){ if(comp instanceof cc.Mask){
flushRendererCache(); flushRendererCache();
@ -88,13 +104,34 @@ cc.RenderFlow.prototype._render = function (node) {
if (_batcher.worldMatDirty && comp._assembler.updateWorldVerts) { if (_batcher.worldMatDirty && comp._assembler.updateWorldVerts) {
comp._assembler.updateWorldVerts(comp); comp._assembler.updateWorldVerts(comp);
} }
if(comp instanceof sp.Skeleton){
_batcher.worldMatDirty++;
//@ts-ignore
comp.attachUtil._syncAttachedNode();
}
rendererCache.push(comp); rendererCache.push(comp);
comp.renderPriority = node._sortingEnabled ? node._sortingPriority : renderPriority; comp.renderPriority = node._sortingEnabled ? node._sortingPriority : renderPriority;
if(renderPriority != 0){ if(renderPriority != 0){
rendererOrder = true; rendererOrder = true;
} }
} }
}else{
//@ts-ignore
comp._checkBacth(_batcher, node._cullingMask);
//@ts-ignore
comp._assembler.fillBuffers(comp, _batcher);
}
this._next._func(node); this._next._func(node);
if(node._sortingEnabled){
// cc.log(`-- ${node.name}`);
--renderLevel;
if(renderLevel <= 0){
flushRendererCache();
}
}
renderPriority = preRenderPriority;
}; };
//@ts-ignore //@ts-ignore
@ -113,13 +150,13 @@ cc.RenderFlow.prototype._children = function (node) {
let cullingMask = _cullingMask; let cullingMask = _cullingMask;
let batcher = _batcher; let batcher = _batcher;
let preRenderPriority = renderPriority;
let parentOpacity = batcher.parentOpacity; let parentOpacity = batcher.parentOpacity;
let opacity = (batcher.parentOpacity *= (node._opacity / 255)); let opacity = (batcher.parentOpacity *= (node._opacity / 255));
renderPriority = node._sortingEnabled ? node._sortingPriority : renderPriority; if(!node._renderComponent && node._sortingEnabled){
// console.log(`${node.name} ${renderPriority}`); // cc.log(`++ ${node.name}`);
++renderLevel;
}
//@ts-ignore //@ts-ignore
let worldTransformFlag = batcher.worldMatDirty ? cc.RenderFlow.FLAG_WORLD_TRANSFORM : 0; let worldTransformFlag = batcher.worldMatDirty ? cc.RenderFlow.FLAG_WORLD_TRANSFORM : 0;
@ -147,7 +184,13 @@ cc.RenderFlow.prototype._children = function (node) {
batcher.parentOpacity = parentOpacity; batcher.parentOpacity = parentOpacity;
renderPriority = preRenderPriority;
this._next._func(node); this._next._func(node);
if(!node._renderComponent && node._sortingEnabled){
// cc.log(`-- ${node.name}`);
--renderLevel;
if(renderLevel <= 0){
flushRendererCache();
}
}
}; };

View File

@ -0,0 +1,653 @@
// @ts-ignore
const gfx = cc.gfx;
// @ts-ignore
const spine = sp.spine;
// @ts-ignore
const VFOneColor = gfx.VertexFormat.vfmtPosUvColor;
// @ts-ignore
const VFTwoColor = gfx.VertexFormat.vfmtPosUvTwoColor;
const FLAG_BATCH = 0x10;
const FLAG_TWO_COLOR = 0x01;
let _handleVal = 0x00;
let _quadTriangles = [0, 1, 2, 2, 3, 0];
let _slotColor = cc.color(0, 0, 255, 255);
let _boneColor = cc.color(255, 0, 0, 255);
let _originColor = cc.color(0, 255, 0, 255);
let _meshColor = cc.color(255, 255, 0, 255);
let _finalColor = null;
let _darkColor = null;
let _tempPos = null, _tempUv = null;
// @ts-ignore
if (!CC_NATIVERENDERER) {
_finalColor = new spine.Color(1, 1, 1, 1);
_darkColor = new spine.Color(1, 1, 1, 1);
_tempPos = new spine.Vector2();
_tempUv = new spine.Vector2();
}
let _premultipliedAlpha;
let _multiplier;
let _slotRangeStart;
let _slotRangeEnd;
let _useTint;
let _debugSlots;
let _debugBones;
let _debugMesh;
let _nodeR,
_nodeG,
_nodeB,
_nodeA;
let _finalColor32, _darkColor32;
let _vertexFormat;
let _perVertexSize;
let _perClipVertexSize;
let _vertexFloatCount = 0, _vertexCount = 0, _vertexFloatOffset = 0, _vertexOffset = 0,
_indexCount = 0, _indexOffset = 0, _vfOffset = 0;
let _tempr, _tempg, _tempb;
let _inRange;
let _mustFlush;
let _x, _y, _m00, _m04, _m12, _m01, _m05, _m13;
let _r, _g, _b, _fr, _fg, _fb, _fa, _dr, _dg, _db, _da;
let _comp, _buffer, _renderer, _node, _needColor, _vertexEffect;
function _getSlotMaterial (tex, blendMode) {
let src, dst;
switch (blendMode) {
case spine.BlendMode.Additive:
src = _premultipliedAlpha ? cc.macro.ONE : cc.macro.SRC_ALPHA;
dst = cc.macro.ONE;
break;
case spine.BlendMode.Multiply:
src = cc.macro.DST_COLOR;
dst = cc.macro.ONE_MINUS_SRC_ALPHA;
break;
case spine.BlendMode.Screen:
src = cc.macro.ONE;
dst = cc.macro.ONE_MINUS_SRC_COLOR;
break;
case spine.BlendMode.Normal:
default:
src = _premultipliedAlpha ? cc.macro.ONE : cc.macro.SRC_ALPHA;
dst = cc.macro.ONE_MINUS_SRC_ALPHA;
break;
}
let useModel = !_comp.enableBatch;
let baseMaterial = _comp._materials[0];
if (!baseMaterial) return null;
// The key use to find corresponding material
let key = tex.getId() + src + dst + _useTint + useModel;
let materialCache = _comp._materialCache;
let material = materialCache[key];
if (!material) {
if (!materialCache.baseMaterial) {
material = baseMaterial;
materialCache.baseMaterial = baseMaterial;
} else {
material = cc.MaterialVariant.create(baseMaterial, null);
}
material.define('CC_USE_MODEL', useModel);
material.define('USE_TINT', _useTint);
// update texture
material.setProperty('texture', tex);
// update blend function
material.setBlend(
true,
gfx.BLEND_FUNC_ADD,
src, dst,
gfx.BLEND_FUNC_ADD,
src, dst
);
materialCache[key] = material;
}
return material;
}
function _handleColor (color) {
// temp rgb has multiply 255, so need divide 255;
_fa = color.fa * _nodeA;
_multiplier = _premultipliedAlpha ? _fa / 255 : 1;
_r = _nodeR * _multiplier;
_g = _nodeG * _multiplier;
_b = _nodeB * _multiplier;
_fr = color.fr * _r;
_fg = color.fg * _g;
_fb = color.fb * _b;
_finalColor32 = ((_fa<<24) >>> 0) + (_fb<<16) + (_fg<<8) + _fr;
_dr = color.dr * _r;
_dg = color.dg * _g;
_db = color.db * _b;
_da = _premultipliedAlpha ? 255 : 0;
_darkColor32 = ((_da<<24) >>> 0) + (_db<<16) + (_dg<<8) + _dr;
}
function _spineColorToInt32 (spineColor) {
return ((spineColor.a<<24) >>> 0) + (spineColor.b<<16) + (spineColor.g<<8) + spineColor.r;
}
// @ts-ignore
sp.Skeleton.__assembler__.fillVertices = function (skeletonColor, attachmentColor, slotColor, clipper, slot) {
let vbuf = _buffer._vData,
ibuf = _buffer._iData,
uintVData = _buffer._uintVData;
let offsetInfo;
_finalColor.a = slotColor.a * attachmentColor.a * skeletonColor.a * _nodeA * 255;
_multiplier = _premultipliedAlpha? _finalColor.a : 255;
_tempr = _nodeR * attachmentColor.r * skeletonColor.r * _multiplier;
_tempg = _nodeG * attachmentColor.g * skeletonColor.g * _multiplier;
_tempb = _nodeB * attachmentColor.b * skeletonColor.b * _multiplier;
_finalColor.r = _tempr * slotColor.r;
_finalColor.g = _tempg * slotColor.g;
_finalColor.b = _tempb * slotColor.b;
if (slot.darkColor == null) {
_darkColor.set(0.0, 0.0, 0.0, 1.0);
} else {
_darkColor.r = slot.darkColor.r * _tempr;
_darkColor.g = slot.darkColor.g * _tempg;
_darkColor.b = slot.darkColor.b * _tempb;
}
_darkColor.a = _premultipliedAlpha ? 255 : 0;
if (!clipper.isClipping()) {
if (_vertexEffect) {
for (let v = _vertexFloatOffset, n = _vertexFloatOffset + _vertexFloatCount; v < n; v += _perVertexSize) {
_tempPos.x = vbuf[v];
_tempPos.y = vbuf[v + 1];
_tempUv.x = vbuf[v + 2];
_tempUv.y = vbuf[v + 3];
_vertexEffect.transform(_tempPos, _tempUv, _finalColor, _darkColor);
vbuf[v] = _tempPos.x; // x
vbuf[v + 1] = _tempPos.y; // y
vbuf[v + 2] = _tempUv.x; // u
vbuf[v + 3] = _tempUv.y; // v
uintVData[v + 4] = _spineColorToInt32(_finalColor); // light color
_useTint && (uintVData[v + 5] = _spineColorToInt32(_darkColor)); // dark color
}
} else {
_finalColor32 = _spineColorToInt32(_finalColor);
_darkColor32 = _spineColorToInt32(_darkColor);
for (let v = _vertexFloatOffset, n = _vertexFloatOffset + _vertexFloatCount; v < n; v += _perVertexSize) {
uintVData[v + 4] = _finalColor32; // light color
_useTint && (uintVData[v + 5] = _darkColor32); // dark color
}
}
} else {
let uvs = vbuf.subarray(_vertexFloatOffset + 2);
clipper.clipTriangles(vbuf.subarray(_vertexFloatOffset), _vertexFloatCount, ibuf.subarray(_indexOffset), _indexCount, uvs, _finalColor, _darkColor, _useTint, _perVertexSize);
let clippedVertices = new Float32Array(clipper.clippedVertices);
let clippedTriangles = clipper.clippedTriangles;
// insure capacity
_indexCount = clippedTriangles.length;
_vertexFloatCount = clippedVertices.length / _perClipVertexSize * _perVertexSize;
offsetInfo = _buffer.request(_vertexFloatCount / _perVertexSize, _indexCount);
_indexOffset = offsetInfo.indiceOffset,
_vertexOffset = offsetInfo.vertexOffset,
_vertexFloatOffset = offsetInfo.byteOffset >> 2;
vbuf = _buffer._vData,
ibuf = _buffer._iData;
uintVData = _buffer._uintVData;
// fill indices
ibuf.set(clippedTriangles, _indexOffset);
// fill vertices contain x y u v light color dark color
if (_vertexEffect) {
for (let v = 0, n = clippedVertices.length, offset = _vertexFloatOffset; v < n; v += _perClipVertexSize, offset += _perVertexSize) {
_tempPos.x = clippedVertices[v];
_tempPos.y = clippedVertices[v + 1];
_finalColor.set(clippedVertices[v + 2], clippedVertices[v + 3], clippedVertices[v + 4], clippedVertices[v + 5]);
_tempUv.x = clippedVertices[v + 6];
_tempUv.y = clippedVertices[v + 7];
if (_useTint) {
_darkColor.set(clippedVertices[v + 8], clippedVertices[v + 9], clippedVertices[v + 10], clippedVertices[v + 11]);
} else {
_darkColor.set(0, 0, 0, 0);
}
_vertexEffect.transform(_tempPos, _tempUv, _finalColor, _darkColor);
vbuf[offset] = _tempPos.x; // x
vbuf[offset + 1] = _tempPos.y; // y
vbuf[offset + 2] = _tempUv.x; // u
vbuf[offset + 3] = _tempUv.y; // v
uintVData[offset + 4] = _spineColorToInt32(_finalColor);
if (_useTint) {
uintVData[offset + 5] = _spineColorToInt32(_darkColor);
}
}
} else {
for (let v = 0, n = clippedVertices.length, offset = _vertexFloatOffset; v < n; v += _perClipVertexSize, offset += _perVertexSize) {
vbuf[offset] = clippedVertices[v]; // x
vbuf[offset + 1] = clippedVertices[v + 1]; // y
vbuf[offset + 2] = clippedVertices[v + 6]; // u
vbuf[offset + 3] = clippedVertices[v + 7]; // v
_finalColor32 = ((clippedVertices[v + 5]<<24) >>> 0) + (clippedVertices[v + 4]<<16) + (clippedVertices[v + 3]<<8) + clippedVertices[v + 2];
uintVData[offset + 4] = _finalColor32;
if (_useTint) {
_darkColor32 = ((clippedVertices[v + 11]<<24) >>> 0) + (clippedVertices[v + 10]<<16) + (clippedVertices[v + 9]<<8) + clippedVertices[v + 8];
uintVData[offset + 5] = _darkColor32;
}
}
}
}
}
// @ts-ignore
sp.Skeleton.__assembler__.realTimeTraverse = function (worldMat) {
let vbuf;
let ibuf;
let locSkeleton = _comp._skeleton;
let skeletonColor = locSkeleton.color;
let graphics = _comp._debugRenderer;
let clipper = _comp._clipper;
let material = null;
let attachment, attachmentColor, slotColor, uvs, triangles;
let isRegion, isMesh, isClip;
let offsetInfo;
let slot;
let worldMatm;
_slotRangeStart = _comp._startSlotIndex;
_slotRangeEnd = _comp._endSlotIndex;
_inRange = false;
if (_slotRangeStart == -1) _inRange = true;
_debugSlots = _comp.debugSlots;
_debugBones = _comp.debugBones;
_debugMesh = _comp.debugMesh;
if (graphics && (_debugBones || _debugSlots || _debugMesh)) {
graphics.clear();
graphics.lineWidth = 2;
}
// x y u v r1 g1 b1 a1 r2 g2 b2 a2 or x y u v r g b a
_perClipVertexSize = _useTint ? 12 : 8;
_vertexFloatCount = 0;
_vertexFloatOffset = 0;
_vertexOffset = 0;
_indexCount = 0;
_indexOffset = 0;
for (let slotIdx = 0, slotCount = locSkeleton.drawOrder.length; slotIdx < slotCount; slotIdx++) {
slot = locSkeleton.drawOrder[slotIdx];
if(slot == undefined || !slot.bone.active) {
continue;
}
if (_slotRangeStart >= 0 && _slotRangeStart == slot.data.index) {
_inRange = true;
}
if (!_inRange) {
clipper.clipEndWithSlot(slot);
continue;
}
if (_slotRangeEnd >= 0 && _slotRangeEnd == slot.data.index) {
_inRange = false;
}
_vertexFloatCount = 0;
_indexCount = 0;
attachment = slot.getAttachment();
if (!attachment) {
clipper.clipEndWithSlot(slot);
continue;
}
isRegion = attachment instanceof spine.RegionAttachment;
isMesh = attachment instanceof spine.MeshAttachment;
isClip = attachment instanceof spine.ClippingAttachment;
if (isClip) {
clipper.clipStart(slot, attachment);
continue;
}
if (!isRegion && !isMesh) {
clipper.clipEndWithSlot(slot);
continue;
}
material = _getSlotMaterial(attachment.region.texture._texture, slot.data.blendMode);
if (!material) {
clipper.clipEndWithSlot(slot);
continue;
}
if (_mustFlush || material.getHash() !== _renderer.material.getHash()) {
_mustFlush = false;
_renderer._flush();
_renderer.node = _node;
_renderer.material = material;
}
if (isRegion) {
triangles = _quadTriangles;
// insure capacity
_vertexFloatCount = 4 * _perVertexSize;
_indexCount = 6;
offsetInfo = _buffer.request(4, 6);
_indexOffset = offsetInfo.indiceOffset,
_vertexOffset = offsetInfo.vertexOffset,
_vertexFloatOffset = offsetInfo.byteOffset >> 2;
vbuf = _buffer._vData,
ibuf = _buffer._iData;
// compute vertex and fill x y
attachment.computeWorldVertices(slot.bone, vbuf, _vertexFloatOffset, _perVertexSize);
// draw debug slots if enabled graphics
if (graphics && _debugSlots) {
graphics.strokeColor = _slotColor;
graphics.moveTo(vbuf[_vertexFloatOffset], vbuf[_vertexFloatOffset + 1]);
for (let ii = _vertexFloatOffset + _perVertexSize, nn = _vertexFloatOffset + _vertexFloatCount; ii < nn; ii += _perVertexSize) {
graphics.lineTo(vbuf[ii], vbuf[ii + 1]);
}
graphics.close();
graphics.stroke();
}
}
else if (isMesh) {
triangles = attachment.triangles;
// insure capacity
_vertexFloatCount = (attachment.worldVerticesLength >> 1) * _perVertexSize;
_indexCount = triangles.length;
offsetInfo = _buffer.request(_vertexFloatCount / _perVertexSize, _indexCount);
_indexOffset = offsetInfo.indiceOffset,
_vertexOffset = offsetInfo.vertexOffset,
_vertexFloatOffset = offsetInfo.byteOffset >> 2;
vbuf = _buffer._vData,
ibuf = _buffer._iData;
// compute vertex and fill x y
attachment.computeWorldVertices(slot, 0, attachment.worldVerticesLength, vbuf, _vertexFloatOffset, _perVertexSize);
// draw debug mesh if enabled graphics
if (graphics && _debugMesh) {
graphics.strokeColor = _meshColor;
for (let ii = 0, nn = triangles.length; ii < nn; ii += 3) {
let v1 = triangles[ii] * _perVertexSize + _vertexFloatOffset;
let v2 = triangles[ii + 1] * _perVertexSize + _vertexFloatOffset;
let v3 = triangles[ii + 2] * _perVertexSize + _vertexFloatOffset;
graphics.moveTo(vbuf[v1], vbuf[v1 + 1]);
graphics.lineTo(vbuf[v2], vbuf[v2 + 1]);
graphics.lineTo(vbuf[v3], vbuf[v3 + 1]);
graphics.close();
graphics.stroke();
}
}
}
if (_vertexFloatCount == 0 || _indexCount == 0) {
clipper.clipEndWithSlot(slot);
continue;
}
// fill indices
ibuf.set(triangles, _indexOffset);
// fill u v
uvs = attachment.uvs;
for (let v = _vertexFloatOffset, n = _vertexFloatOffset + _vertexFloatCount, u = 0; v < n; v += _perVertexSize, u += 2) {
vbuf[v + 2] = uvs[u]; // u
vbuf[v + 3] = uvs[u + 1]; // v
}
attachmentColor = attachment.color,
slotColor = slot.color;
this.fillVertices(skeletonColor, attachmentColor, slotColor, clipper, slot);
// reset buffer pointer, because clipper maybe realloc a new buffer in file Vertices function.
vbuf = _buffer._vData,
ibuf = _buffer._iData;
if (_indexCount > 0) {
for (let ii = _indexOffset, nn = _indexOffset + _indexCount; ii < nn; ii++) {
ibuf[ii] += _vertexOffset;
}
if (worldMat) {
worldMatm = worldMat.m;
_m00 = worldMatm[0];
_m04 = worldMatm[4];
_m12 = worldMatm[12];
_m01 = worldMatm[1];
_m05 = worldMatm[5];
_m13 = worldMatm[13];
for (let ii = _vertexFloatOffset, nn = _vertexFloatOffset + _vertexFloatCount; ii < nn; ii += _perVertexSize) {
_x = vbuf[ii];
_y = vbuf[ii + 1];
vbuf[ii] = _x * _m00 + _y * _m04 + _m12;
vbuf[ii + 1] = _x * _m01 + _y * _m05 + _m13;
}
}
_buffer.adjust(_vertexFloatCount / _perVertexSize, _indexCount);
}
clipper.clipEndWithSlot(slot);
}
clipper.clipEnd();
if (graphics && _debugBones) {
let bone;
graphics.strokeColor = _boneColor;
graphics.fillColor = _slotColor; // Root bone color is same as slot color.
for (let i = 0, n = locSkeleton.bones.length; i < n; i++) {
bone = locSkeleton.bones[i];
let x = bone.data.length * bone.a + bone.worldX;
let y = bone.data.length * bone.c + bone.worldY;
// Bone lengths.
graphics.moveTo(bone.worldX, bone.worldY);
graphics.lineTo(x, y);
graphics.stroke();
// Bone origins.
graphics.circle(bone.worldX, bone.worldY, Math.PI * 1.5);
graphics.fill();
if (i === 0) {
graphics.fillColor = _originColor;
}
}
}
}
// @ts-ignore
sp.Skeleton.__assembler__.cacheTraverse = function (worldMat) {
let frame = _comp._curFrame;
if (!frame) return;
let segments = frame.segments;
if (segments.length == 0) return;
let vbuf, ibuf, uintbuf;
let material;
let offsetInfo;
let vertices = frame.vertices;
let indices = frame.indices;
let worldMatm;
let frameVFOffset = 0, frameIndexOffset = 0, segVFCount = 0;
if (worldMat) {
worldMatm = worldMat.m;
_m00 = worldMatm[0];
_m01 = worldMatm[1];
_m04 = worldMatm[4];
_m05 = worldMatm[5];
_m12 = worldMatm[12];
_m13 = worldMatm[13];
}
let justTranslate = _m00 === 1 && _m01 === 0 && _m04 === 0 && _m05 === 1;
let needBatch = (_handleVal & FLAG_BATCH);
let calcTranslate = needBatch && justTranslate;
let colorOffset = 0;
let colors = frame.colors;
let nowColor = colors[colorOffset++];
let maxVFOffset = nowColor.vfOffset;
_handleColor(nowColor);
for (let i = 0, n = segments.length; i < n; i++) {
let segInfo = segments[i];
material = _getSlotMaterial(segInfo.tex, segInfo.blendMode);
if (!material) continue;
if (_mustFlush || material.getHash() !== _renderer.material.getHash()) {
_mustFlush = false;
_renderer._flush();
_renderer.node = _node;
_renderer.material = material;
}
_vertexCount = segInfo.vertexCount;
_indexCount = segInfo.indexCount;
offsetInfo = _buffer.request(_vertexCount, _indexCount);
_indexOffset = offsetInfo.indiceOffset;
_vertexOffset = offsetInfo.vertexOffset;
_vfOffset = offsetInfo.byteOffset >> 2;
vbuf = _buffer._vData;
ibuf = _buffer._iData;
uintbuf = _buffer._uintVData;
for (let ii = _indexOffset, il = _indexOffset + _indexCount; ii < il; ii++) {
ibuf[ii] = _vertexOffset + indices[frameIndexOffset++];
}
segVFCount = segInfo.vfCount;
vbuf.set(vertices.subarray(frameVFOffset, frameVFOffset + segVFCount), _vfOffset);
frameVFOffset += segVFCount;
if (calcTranslate) {
for (let ii = _vfOffset, il = _vfOffset + segVFCount; ii < il; ii += 6) {
vbuf[ii] += _m12;
vbuf[ii + 1] += _m13;
}
} else if (needBatch) {
for (let ii = _vfOffset, il = _vfOffset + segVFCount; ii < il; ii += 6) {
_x = vbuf[ii];
_y = vbuf[ii + 1];
vbuf[ii] = _x * _m00 + _y * _m04 + _m12;
vbuf[ii + 1] = _x * _m01 + _y * _m05 + _m13;
}
}
_buffer.adjust(_vertexCount, _indexCount);
if ( !_needColor ) continue;
// handle color
let frameColorOffset = frameVFOffset - segVFCount;
for (let ii = _vfOffset + 4, il = _vfOffset + 4 + segVFCount; ii < il; ii += 6, frameColorOffset += 6) {
if (frameColorOffset >= maxVFOffset) {
nowColor = colors[colorOffset++];
_handleColor(nowColor);
maxVFOffset = nowColor.vfOffset;
}
uintbuf[ii] = _finalColor32;
uintbuf[ii + 1] = _darkColor32;
}
}
}
// @ts-ignore
sp.Skeleton.__assembler__.fillBuffers = function (comp, renderer) {
let node = comp.node;
// @ts-ignore
node._renderFlag |= cc.RenderFlow.FLAG_UPDATE_RENDER_DATA;
if (!comp._skeleton) return;
let nodeColor = node._color;
_nodeR = nodeColor.r / 255;
_nodeG = nodeColor.g / 255;
_nodeB = nodeColor.b / 255;
_nodeA = nodeColor.a / 255;
_useTint = comp.useTint || comp.isAnimationCached();
_vertexFormat = _useTint? VFTwoColor : VFOneColor;
// x y u v color1 color2 or x y u v color
_perVertexSize = _useTint ? 6 : 5;
_node = comp.node;
_buffer = renderer.getBuffer('spine', _vertexFormat);
_renderer = renderer;
_comp = comp;
_mustFlush = true;
_premultipliedAlpha = comp.premultipliedAlpha;
_multiplier = 1.0;
_handleVal = 0x00;
_needColor = false;
_vertexEffect = comp._effectDelegate && comp._effectDelegate._vertexEffect;
if (nodeColor._val !== 0xffffffff || _premultipliedAlpha) {
_needColor = true;
}
if (_useTint) {
_handleVal |= FLAG_TWO_COLOR;
}
let worldMat = undefined;
if (_comp.enableBatch) {
worldMat = _node._worldMatrix;
_mustFlush = false;
_handleVal |= FLAG_BATCH;
}
if (comp.isAnimationCached()) {
// Traverse input assembler.
this.cacheTraverse(worldMat);
} else {
if (_vertexEffect) _vertexEffect.begin(comp._skeleton);
this.realTimeTraverse(worldMat);
if (_vertexEffect) _vertexEffect.end();
}
// Clear temp var.
_node = undefined;
_buffer = undefined;
_renderer = undefined;
_comp = undefined;
_vertexEffect = null;
}

View File

@ -0,0 +1,10 @@
{
"ver": "1.1.0",
"uuid": "85ae9edc-379f-4b40-bf6e-81b46c8f92b5",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -4,15 +4,11 @@
*/ */
export enum SortingLayer { export enum SortingLayer {
//-- 自定义,在此之上,小于 DEFAULT 的层级
/** /**
* UI渲染上的默认层级 ** *
*/ */
DEFAULT = 0, DEFAULT = 0,
//-- 自定义,在此之下,大于 DEFAULT 的层级
// 测试定义,可以直接移除 // 测试定义,可以直接移除
TEST_LIST_ITEM = 1, TEST_LIST_ITEM = 1,
} }

View File

@ -1265,18 +1265,6 @@
"_atlas": null, "_atlas": null,
"_id": "" "_id": ""
}, },
{
"__type__": "ac8d9FmQixM06C+C9zdtS2i",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_sortingLayer": 1,
"_orderInLayer": 0,
"_id": ""
},
{ {
"__type__": "9f538fWaWpEkYLqGkQ0A+08", "__type__": "9f538fWaWpEkYLqGkQ0A+08",
"_name": "", "_name": "",
@ -1308,6 +1296,18 @@
}, },
"_id": "" "_id": ""
}, },
{
"__type__": "ac8d9FmQixM06C+C9zdtS2i",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_sortingLayer": 0,
"_orderInLayer": 0,
"_id": ""
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@ -75,19 +75,22 @@
"__id__": 5 "__id__": 5
}, },
{ {
"__id__": 15 "__id__": 16
},
{
"__id__": 18
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 24 "__id__": 27
}, },
{ {
"__id__": 25 "__id__": 28
}, },
{ {
"__id__": 26 "__id__": 29
} }
], ],
"_prefab": null, "_prefab": null,
@ -251,7 +254,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 14 "__id__": 15
} }
], ],
"_prefab": null, "_prefab": null,
@ -317,7 +320,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 13 "__id__": 14
} }
], ],
"_prefab": null, "_prefab": null,
@ -383,10 +386,10 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 11 "__id__": 12
}, },
{ {
"__id__": 12 "__id__": 13
} }
], ],
"_prefab": null, "_prefab": null,
@ -452,6 +455,9 @@
}, },
{ {
"__id__": 10 "__id__": 10
},
{
"__id__": 11
} }
], ],
"_prefab": null, "_prefab": null,
@ -561,6 +567,18 @@
"_N$affectedByScale": false, "_N$affectedByScale": false,
"_id": "99ZnNIIfdGYr/767ja4ooN" "_id": "99ZnNIIfdGYr/767ja4ooN"
}, },
{
"__type__": "ac8d9FmQixM06C+C9zdtS2i",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": false,
"_sortingLayer": 1,
"_orderInLayer": 0,
"_id": "95L6yHtudDn4DXi9XNXUWm"
},
{ {
"__type__": "cc.Mask", "__type__": "cc.Mask",
"_name": "", "_name": "",
@ -666,6 +684,110 @@
"_atlas": null, "_atlas": null,
"_id": "c3cT/PBaxC0ZZTS52ZUc/N" "_id": "c3cT/PBaxC0ZZTS52ZUc/N"
}, },
{
"__type__": "cc.Node",
"_name": "raptor-pro",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 17
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280.26,
"height": 1039.44
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-573.152,
-334.2,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "b2sxgOXEtLurYDvQ/Y6o1s"
},
{
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
},
"_enabled": true,
"_materials": [
{
"__uuid__": "7afd064b-113f-480e-b793-8817d19f63c3"
}
],
"paused": false,
"defaultSkin": "default",
"defaultAnimation": "walk",
"_preCacheMode": 0,
"_cacheMode": 0,
"loop": true,
"premultipliedAlpha": true,
"timeScale": 1,
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_skeletonCache": null,
"_animationName": "walk",
"_animationQueue": [],
"_headAniInfo": null,
"_playTimes": 0,
"_isAniComplete": true,
"_N$skeletonData": {
"__uuid__": "48c998f8-8b63-4afa-b422-3a16c9af34f1"
},
"_N$_defaultCacheMode": 0,
"_N$debugSlots": false,
"_N$debugBones": false,
"_N$debugMesh": false,
"_N$useTint": false,
"_N$enableBatch": false,
"_id": "e11y2DpPVHi7Kf0FQ5dF3T"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "New Node", "_name": "New Node",
@ -674,20 +796,20 @@
"__id__": 2 "__id__": 2
}, },
"_children": [ "_children": [
{
"__id__": 16
},
{ {
"__id__": 19 "__id__": 19
}, },
{ {
"__id__": 21 "__id__": 22
},
{
"__id__": 24
} }
], ],
"_active": false, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 23 "__id__": 26
} }
], ],
"_prefab": null, "_prefab": null,
@ -713,7 +835,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-604, -185.437,
-360, -360,
0, 0,
0, 0,
@ -743,16 +865,16 @@
"_name": "New Label 1", "_name": "New Label 1",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 15 "__id__": 18
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 17 "__id__": 20
}, },
{ {
"__id__": 18 "__id__": 21
} }
], ],
"_prefab": null, "_prefab": null,
@ -808,7 +930,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 16 "__id__": 19
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
@ -841,7 +963,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 16 "__id__": 19
}, },
"_enabled": true, "_enabled": true,
"_sortingLayer": 1, "_sortingLayer": 1,
@ -853,13 +975,13 @@
"_name": "New Sprite(Splash)", "_name": "New Sprite(Splash)",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 15 "__id__": 18
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 20 "__id__": 23
} }
], ],
"_prefab": null, "_prefab": null,
@ -915,7 +1037,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 19 "__id__": 22
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
@ -947,13 +1069,13 @@
"_name": "New Label 2", "_name": "New Label 2",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 15 "__id__": 18
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 22 "__id__": 25
} }
], ],
"_prefab": null, "_prefab": null,
@ -1009,7 +1131,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 21 "__id__": 24
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
@ -1042,7 +1164,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 15 "__id__": 18
}, },
"_enabled": true, "_enabled": true,
"_sortingLayer": 1, "_sortingLayer": 1,

View File

@ -684,7 +684,7 @@
"__id__": 21 "__id__": 21
} }
], ],
"_active": false, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 23 "__id__": 23

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "d123a0ff-b542-4d81-aee4-255cc3ba2f13",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,272 @@
raptor-pro.png
size: 2017,918
format: RGBA8888
filter: Linear,Linear
repeat: none
back-arm
rotate: false
xy: 1772, 17
size: 91, 48
orig: 91, 49
offset: 0, 0
index: -1
back-bracer
rotate: false
xy: 1481, 34
size: 77, 55
orig: 77, 55
offset: 0, 0
index: -1
back-hand
rotate: false
xy: 1407, 21
size: 72, 68
orig: 72, 68
offset: 0, 0
index: -1
back-knee
rotate: false
xy: 1902, 69
size: 97, 134
orig: 97, 134
offset: 0, 0
index: -1
back-thigh
rotate: false
xy: 1018, 125
size: 78, 47
orig: 78, 47
offset: 0, 0
index: -1
eyes-open
rotate: false
xy: 719, 17
size: 93, 89
orig: 93, 89
offset: 0, 0
index: -1
front-arm
rotate: false
xy: 402, 14
size: 96, 51
orig: 96, 51
offset: 0, 0
index: -1
front-bracer
rotate: true
xy: 1347, 15
size: 81, 58
orig: 81, 58
offset: 0, 0
index: -1
front-hand
rotate: true
xy: 1018, 41
size: 82, 75
orig: 82, 75
offset: 0, 0
index: -1
front-open-hand
rotate: true
xy: 1258, 10
size: 86, 87
orig: 86, 87
offset: 0, 0
index: -1
front-thigh
rotate: false
xy: 96, 7
size: 114, 58
orig: 114, 58
offset: 0, 0
index: -1
gun
rotate: false
xy: 1577, 240
size: 212, 206
orig: 213, 206
offset: 0, 0
index: -1
gun-nohand
rotate: false
xy: 1561, 35
size: 209, 203
orig: 210, 203
offset: 0, 0
index: -1
head
rotate: false
xy: 1605, 618
size: 271, 298
orig: 271, 298
offset: 0, 0
index: -1
lower-leg
rotate: false
xy: 1413, 91
size: 146, 189
orig: 146, 195
offset: 0, 6
index: -1
mouth-grind
rotate: false
xy: 212, 6
size: 93, 59
orig: 93, 59
offset: 0, 0
index: -1
mouth-smile
rotate: false
xy: 307, 6
size: 93, 59
orig: 93, 59
offset: 0, 0
index: -1
neck
rotate: false
xy: 1865, 24
size: 35, 41
orig: 36, 41
offset: 0, 0
index: -1
raptor-back-arm
rotate: true
xy: 844, 9
size: 163, 172
orig: 163, 172
offset: 0, 0
index: -1
raptor-body
rotate: false
xy: 2, 451
size: 1261, 465
orig: 1264, 465
offset: 0, 0
index: -1
raptor-front-arm
rotate: false
xy: 1413, 282
size: 162, 203
orig: 162, 203
offset: 0, 0
index: -1
raptor-front-leg
rotate: true
xy: 2, 67
size: 382, 514
orig: 382, 514
offset: 0, 0
index: -1
raptor-hindleg-back
rotate: false
xy: 1265, 487
size: 338, 429
orig: 338, 429
offset: 0, 0
index: -1
raptor-horn
rotate: true
xy: 1098, 86
size: 363, 158
orig: 363, 159
offset: 0, 0
index: -1
raptor-horn-back
rotate: true
xy: 1258, 98
size: 351, 153
orig: 351, 153
offset: 0, 0
index: -1
raptor-jaw
rotate: false
xy: 844, 174
size: 252, 275
orig: 252, 275
offset: 0, 0
index: -1
raptor-jaw-tooth
rotate: true
xy: 2, 2
size: 63, 92
orig: 73, 96
offset: 7, 4
index: -1
raptor-mouth-inside
rotate: false
xy: 1095, 2
size: 71, 82
orig: 71, 82
offset: 0, 0
index: -1
raptor-saddle-strap-back
rotate: false
xy: 1907, 205
size: 108, 148
orig: 108, 148
offset: 0, 0
index: -1
raptor-saddle-strap-front
rotate: false
xy: 1791, 257
size: 114, 189
orig: 114, 189
offset: 0, 0
index: -1
raptor-saddle-w-shadow
rotate: false
xy: 518, 108
size: 324, 341
orig: 324, 341
offset: 0, 0
index: -1
raptor-tail-shadow
rotate: true
xy: 1878, 539
size: 377, 126
orig: 377, 126
offset: 0, 0
index: -1
raptor-tongue
rotate: true
xy: 1772, 67
size: 171, 128
orig: 171, 128
offset: 0, 0
index: -1
stirrup-back
rotate: false
xy: 1168, 15
size: 87, 69
orig: 87, 69
offset: 0, 0
index: -1
stirrup-front
rotate: true
xy: 518, 17
size: 89, 100
orig: 89, 100
offset: 0, 0
index: -1
stirrup-strap
rotate: false
xy: 620, 15
size: 97, 91
orig: 97, 91
offset: 0, 0
index: -1
torso
rotate: false
xy: 1907, 355
size: 108, 182
orig: 108, 182
offset: 0, 0
index: -1
visor
rotate: false
xy: 1605, 448
size: 261, 168
orig: 261, 168
offset: 0, 0
index: -1

View File

@ -0,0 +1,6 @@
{
"ver": "1.0.3",
"uuid": "4ebb9735-2b25-4da4-a382-5bb4efa78216",
"importer": "asset",
"subMetas": {}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,10 @@
{
"ver": "1.2.5",
"uuid": "48c998f8-8b63-4afa-b422-3a16c9af34f1",
"importer": "spine",
"textures": [
"e2b3fdde-c253-4268-9a1b-8b780707f98f"
],
"scale": 1,
"subMetas": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

@ -0,0 +1,38 @@
{
"ver": "2.3.7",
"uuid": "e2b3fdde-c253-4268-9a1b-8b780707f98f",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2017,
"height": 918,
"platformSettings": {},
"subMetas": {
"raptor-pro": {
"ver": "1.0.6",
"uuid": "e04b0422-0423-41ca-a1fd-a5fedcb8933a",
"importer": "sprite-frame",
"rawTextureUuid": "e2b3fdde-c253-4268-9a1b-8b780707f98f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 2,
"trimY": 2,
"width": 2013,
"height": 914,
"rawWidth": 2017,
"rawHeight": 918,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

View File

@ -131,6 +131,12 @@ public:
void setUseModel(bool useModel) { _useModel = useModel; } void setUseModel(bool useModel) { _useModel = useModel; }
void changeCommitState(CommitState state); void changeCommitState(CommitState state);
void setSortingLevel(int value){
_sortingLevel = value;
}
int getSortingLevel() const {
return _sortingLevel;
}
void setSortingPriority(float_t value){ void setSortingPriority(float_t value){
_sortingPriority = value; _sortingPriority = value;
} }
@ -168,6 +174,7 @@ private:
std::unordered_map<VertexFormat*, MeshBuffer*> _buffers; std::unordered_map<VertexFormat*, MeshBuffer*> _buffers;
float_t _sortingPriority = 0; float_t _sortingPriority = 0;
int _sortingLevel = 0;
bool _rendererOrder = false; bool _rendererOrder = false;
std::vector<NodeProxy*> _rendererCache; std::vector<NodeProxy*> _rendererCache;
}; };

View File

@ -531,6 +531,9 @@ void NodeProxy::render(NodeProxy* node, ModelBatcher* batcher, Scene* scene)
float_t preSortingPriority = batcher->getSortingPriority(); float_t preSortingPriority = batcher->getSortingPriority();
batcher->setSortingPriority(node->getSortingEnabled() ? node->getSortingPriority() : preSortingPriority); batcher->setSortingPriority(node->getSortingEnabled() ? node->getSortingPriority() : preSortingPriority);
if(node->getSortingEnabled()){
batcher->setSortingLevel(batcher->getSortingLevel() + 1);
}
bool needRender = *node->_dirty & RenderFlow::RENDER; bool needRender = *node->_dirty & RenderFlow::RENDER;
if (node->_needRender != needRender) if (node->_needRender != needRender)
@ -541,6 +544,7 @@ void NodeProxy::render(NodeProxy* node, ModelBatcher* batcher, Scene* scene)
// pre render // pre render
if (node->_assembler && needRender) { if (node->_assembler && needRender) {
if(batcher->getSortingLevel() > 0){
if(node->_assembler->isMaskAssembler()){ if(node->_assembler->isMaskAssembler()){
batcher->flushRendererCache(); batcher->flushRendererCache();
node->_assembler->handle(node, batcher, scene); node->_assembler->handle(node, batcher, scene);
@ -551,6 +555,10 @@ void NodeProxy::render(NodeProxy* node, ModelBatcher* batcher, Scene* scene)
batcher->setRendererOrder(true); batcher->setRendererOrder(true);
} }
} }
}else{
batcher->flushRendererCache();
node->_assembler->handle(node, batcher, scene);
}
} }
node->reorderChildren(); node->reorderChildren();
@ -569,6 +577,12 @@ void NodeProxy::render(NodeProxy* node, ModelBatcher* batcher, Scene* scene)
node->_assembler->postHandle(node, batcher, scene); node->_assembler->postHandle(node, batcher, scene);
} }
if(node->getSortingEnabled()){
batcher->setSortingLevel(batcher->getSortingLevel() - 1);
if(batcher->getSortingLevel() <= 0){
batcher->flushRendererCache();
}
}
batcher->setSortingPriority(preSortingPriority); batcher->setSortingPriority(preSortingPriority);
} }
@ -590,6 +604,9 @@ void NodeProxy::visit(NodeProxy* node, ModelBatcher* batcher, Scene* scene)
float_t preSortingPriority = batcher->getSortingPriority(); float_t preSortingPriority = batcher->getSortingPriority();
batcher->setSortingPriority(node->getSortingEnabled() ? node->getSortingPriority() : preSortingPriority); batcher->setSortingPriority(node->getSortingEnabled() ? node->getSortingPriority() : preSortingPriority);
if(node->getSortingEnabled()){
batcher->setSortingLevel(batcher->getSortingLevel() + 1);
}
bool needRender = *(node->_dirty) & RenderFlow::RENDER; bool needRender = *(node->_dirty) & RenderFlow::RENDER;
if (node->_needRender != needRender) if (node->_needRender != needRender)
@ -600,6 +617,7 @@ void NodeProxy::visit(NodeProxy* node, ModelBatcher* batcher, Scene* scene)
// pre render // pre render
if (node->_assembler && needRender){ if (node->_assembler && needRender){
if(batcher->getSortingLevel() > 0){
if(node->_assembler->isMaskAssembler()){ if(node->_assembler->isMaskAssembler()){
batcher->flushRendererCache(); batcher->flushRendererCache();
node->_assembler->handle(node, batcher, scene); node->_assembler->handle(node, batcher, scene);
@ -610,6 +628,10 @@ void NodeProxy::visit(NodeProxy* node, ModelBatcher* batcher, Scene* scene)
batcher->setRendererOrder(true); batcher->setRendererOrder(true);
} }
} }
}else{
batcher->flushRendererCache();
node->_assembler->handle(node, batcher, scene);
}
} }
node->reorderChildren(); node->reorderChildren();
@ -627,6 +649,12 @@ void NodeProxy::visit(NodeProxy* node, ModelBatcher* batcher, Scene* scene)
node->_assembler->postHandle(node, batcher, scene); node->_assembler->postHandle(node, batcher, scene);
} }
if(node->getSortingEnabled()){
batcher->setSortingLevel(batcher->getSortingLevel() - 1);
if(batcher->getSortingLevel() <= 0){
batcher->flushRendererCache();
}
}
batcher->setSortingPriority(preSortingPriority); batcher->setSortingPriority(preSortingPriority);
} }

View File

@ -351,6 +351,7 @@ void RenderFlow::render(NodeProxy* scene, float deltaTime, Camera *camera)
#endif #endif
_batcher->startBatch(); _batcher->startBatch();
_batcher->setSortingLevel(0);
_batcher->setSortingPriority(0); _batcher->setSortingPriority(0);
_batcher->setRendererOrder(false); _batcher->setRendererOrder(false);

View File

@ -33,5 +33,5 @@
"enable": false "enable": false
} }
}, },
"last-module-event-record-time": 1675838102527 "last-module-event-record-time": 1679408081766
} }