Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize code size for render-data.ts #18259

Open
wants to merge 1 commit into
base: v3.8.6
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions cocos/2d/renderer/render-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ export class BaseRenderData {
}
}

/**
* @engineInternal
* @mangle
*/
protected setRenderDrawInfoAttributes (): void {
if (JSB) {
if (!this._renderDrawInfo) {
Expand Down Expand Up @@ -347,7 +351,7 @@ export class RenderData extends BaseRenderData {
}
}

protected setRenderDrawInfoAttributes (): void {
protected override setRenderDrawInfoAttributes (): void {
if (JSB) {
if (!this._renderDrawInfo) {
return;
Expand Down Expand Up @@ -759,28 +763,33 @@ export class MeshRenderData extends BaseRenderData {
}
}

public setRenderDrawInfoAttributes (): void {
public override setRenderDrawInfoAttributes (): void {
if (JSB) {
if (!this._renderDrawInfo) {
const renderDrawInfo = this._renderDrawInfo;
if (!renderDrawInfo) {
return;
}
this._renderDrawInfo.setVData(this.vData.buffer);
this._renderDrawInfo.setIData(this.iData.buffer);
this._renderDrawInfo.setVBCount(this._vc);
this._renderDrawInfo.setIBCount(this._ic);
this._renderDrawInfo.setVertexOffset(this.vertexStart);
this._renderDrawInfo.setIndexOffset(this.indexStart);

this._renderDrawInfo.setIsMeshBuffer(this._isMeshBuffer);
this._renderDrawInfo.setMaterial(this.material!);
renderDrawInfo.setVData(this.vData.buffer);
renderDrawInfo.setIData(this.iData.buffer);
renderDrawInfo.setVBCount(this._vc);
renderDrawInfo.setIBCount(this._ic);
renderDrawInfo.setVertexOffset(this.vertexStart);
renderDrawInfo.setIndexOffset(this.indexStart);

renderDrawInfo.setIsMeshBuffer(this._isMeshBuffer);
renderDrawInfo.setMaterial(this.material!);
if (this.frame) {
this._renderDrawInfo.setTexture(this.frame.getGFXTexture());
this._renderDrawInfo.setSampler(this.frame.getGFXSampler());
renderDrawInfo.setTexture(this.frame.getGFXTexture());
renderDrawInfo.setSampler(this.frame.getGFXSampler());
}
}
}

// only for particle2d
/**
* only for particle2d
* @engineInternal
* @mangle
*/
public particleInitRenderDrawInfo (entity: RenderEntity): void {
if (JSB) {
if (entity.renderEntityType === RenderEntityType.STATIC) {
Expand Down
Loading