mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
remove unnecessary code (#15687)
* Revert "Revert "remove useless code (#15682)" (#15683)"
This reverts commit b318b39eb9.
* fix lint
* Revert "fix lint"
This reverts commit 269acd1715a93d59f61286d336afa9a03f07f805.
* revert some change
* fix lint
This commit is contained in:
@@ -60,8 +60,6 @@ export const ttf: IAssembler = {
|
||||
Color.toArray(vData, WHITE, offset);
|
||||
offset += 9;
|
||||
}
|
||||
renderData.vertexRow = 2;
|
||||
renderData.vertexCol = 2;
|
||||
renderData.chunk.setIndexBuffer(QUAD_INDICES);
|
||||
return renderData;
|
||||
},
|
||||
@@ -149,7 +147,7 @@ export const ttf: IAssembler = {
|
||||
},
|
||||
|
||||
updateColor (comp: Label) {
|
||||
|
||||
// no needs to update color
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -196,8 +196,6 @@ export const barFilled: IAssembler = {
|
||||
// 0-4 for local vertex
|
||||
renderData.dataLength = 4;
|
||||
renderData.resize(4, 6);
|
||||
renderData.vertexRow = 2;
|
||||
renderData.vertexCol = 2;
|
||||
renderData.chunk.setIndexBuffer(QUAD_INDICES);
|
||||
|
||||
// not need
|
||||
|
||||
@@ -45,8 +45,6 @@ export const simple: IAssembler = {
|
||||
const renderData = sprite.requestRenderData();
|
||||
renderData.dataLength = 4;
|
||||
renderData.resize(4, 6);
|
||||
renderData.vertexRow = 2;
|
||||
renderData.vertexCol = 2;
|
||||
renderData.chunk.setIndexBuffer(QUAD_INDICES);
|
||||
return renderData;
|
||||
},
|
||||
@@ -107,36 +105,29 @@ export const simple: IAssembler = {
|
||||
}
|
||||
|
||||
// quick version
|
||||
const bid = chunk.bufferId;
|
||||
const vidOrigin = chunk.vertexOffset;
|
||||
const meshBuffer = chunk.meshBuffer;
|
||||
const ib = chunk.meshBuffer.iData;
|
||||
let indexOffset = meshBuffer.indexOffset;
|
||||
|
||||
// rect count = vertex count - 1
|
||||
for (let curRow = 0; curRow < renderData.vertexRow - 1; curRow++) {
|
||||
for (let curCol = 0; curCol < renderData.vertexCol - 1; curCol++) {
|
||||
// vid is the index of the left bottom vertex in each rect.
|
||||
const vid = vidOrigin + curRow * renderData.vertexCol + curCol;
|
||||
const vid = vidOrigin;
|
||||
|
||||
// left bottom
|
||||
ib[indexOffset++] = vid;
|
||||
// right bottom
|
||||
ib[indexOffset++] = vid + 1;
|
||||
// left top
|
||||
ib[indexOffset++] = vid + renderData.vertexCol;
|
||||
// left bottom
|
||||
ib[indexOffset++] = vid;
|
||||
// right bottom
|
||||
ib[indexOffset++] = vid + 1;
|
||||
// left top
|
||||
ib[indexOffset++] = vid + 2;
|
||||
|
||||
// right bottom
|
||||
ib[indexOffset++] = vid + 1;
|
||||
// right top
|
||||
ib[indexOffset++] = vid + 1 + renderData.vertexCol;
|
||||
// left top
|
||||
ib[indexOffset++] = vid + renderData.vertexCol;
|
||||
// right bottom
|
||||
ib[indexOffset++] = vid + 1;
|
||||
// right top
|
||||
ib[indexOffset++] = vid + 3;
|
||||
// left top
|
||||
ib[indexOffset++] = vid + 2;
|
||||
|
||||
// IndexOffset should add 6 when vertices of a rect are visited.
|
||||
meshBuffer.indexOffset += 6;
|
||||
}
|
||||
}
|
||||
// IndexOffset should add 6 when vertices of a rect are visited.
|
||||
meshBuffer.indexOffset += 6;
|
||||
// slow version
|
||||
// renderer.switchBufferAccessor().appendIndices(chunk);
|
||||
},
|
||||
|
||||
@@ -47,8 +47,6 @@ export const sliced: IAssembler = {
|
||||
// 0-4 for local vertex
|
||||
renderData.dataLength = 16;
|
||||
renderData.resize(16, 54);
|
||||
renderData.vertexRow = 4;
|
||||
renderData.vertexCol = 4;
|
||||
this.QUAD_INDICES = new Uint16Array(54);
|
||||
this.createQuadIndices(4, 4);
|
||||
renderData.chunk.setIndexBuffer(this.QUAD_INDICES as Uint16Array);
|
||||
@@ -140,9 +138,9 @@ export const sliced: IAssembler = {
|
||||
tempRenderData[3].x = width - appX;
|
||||
tempRenderData[3].y = height - appY;
|
||||
|
||||
for (let curRow = 0; curRow < renderData.vertexRow; curRow++) {
|
||||
for (let curCol = 0; curCol < renderData.vertexCol; curCol++) {
|
||||
const curIndex = curRow * renderData.vertexCol + curCol;
|
||||
for (let curRow = 0; curRow < 4; curRow++) {
|
||||
for (let curCol = 0; curCol < 4; curCol++) {
|
||||
const curIndex = curRow * 4 + curCol;
|
||||
if (curIndex < renderData.dataLength
|
||||
&& curRow < tempRenderData.length
|
||||
&& curCol < tempRenderData.length) {
|
||||
|
||||
Reference in New Issue
Block a user