diff --git a/cocos/2d/assembler/graphics/webgl/impl.ts b/cocos/2d/assembler/graphics/webgl/impl.ts index 32715eabf3f..bf3014b8671 100644 --- a/cocos/2d/assembler/graphics/webgl/impl.ts +++ b/cocos/2d/assembler/graphics/webgl/impl.ts @@ -66,6 +66,7 @@ export class Path { } } +/** @mangle */ export class Impl { public dataOffset = 0; public updatePathOffset = false; diff --git a/cocos/2d/framework/ui-renderer-manager.ts b/cocos/2d/framework/ui-renderer-manager.ts index a0a76cda8ab..1946acaacfb 100644 --- a/cocos/2d/framework/ui-renderer-manager.ts +++ b/cocos/2d/framework/ui-renderer-manager.ts @@ -27,6 +27,7 @@ import { assert, js } from '../../core'; import { UIMeshRenderer } from '../components'; import { UIRenderer } from './ui-renderer'; +/** @mangle */ export class UIRendererManager { private _allRenderers: (UIRenderer | UIMeshRenderer)[] = []; private _dirtyRenderers: (UIRenderer | UIMeshRenderer)[] = []; diff --git a/cocos/2d/renderer/render-draw-info.ts b/cocos/2d/renderer/render-draw-info.ts index 45a0402cb6a..e6f024494cb 100644 --- a/cocos/2d/renderer/render-draw-info.ts +++ b/cocos/2d/renderer/render-draw-info.ts @@ -60,6 +60,7 @@ export enum RenderDrawInfoType { SUB_NODE, } +/** @mangle */ export class RenderDrawInfo { protected _accId = -1; protected _bufferId = -1; diff --git a/cocos/2d/renderer/render-entity.ts b/cocos/2d/renderer/render-entity.ts index 7e6bac165c0..7157e63cb90 100644 --- a/cocos/2d/renderer/render-entity.ts +++ b/cocos/2d/renderer/render-entity.ts @@ -64,6 +64,7 @@ export enum MaskMode { MASK_NODE_INVERTED } +/** @mangle */ export class RenderEntity { private _renderEntityType: RenderEntityType = RenderEntityType.STATIC; diff --git a/cocos/2d/renderer/stencil-manager.ts b/cocos/2d/renderer/stencil-manager.ts index e58469aa6a9..92a25d16905 100644 --- a/cocos/2d/renderer/stencil-manager.ts +++ b/cocos/2d/renderer/stencil-manager.ts @@ -66,6 +66,18 @@ export enum StencilSharedBufferView { count, } +/** @mangle */ +interface StencilPattern { + stencilTest: boolean; + func: ComparisonFunc; + stencilMask: number; + writeMask: number; + failOp: StencilOp; + zFailOp: StencilOp; + passOp: StencilOp; + ref: number; +} + /** * @en Stencil state manager. * @zh 模板状态管理器。 @@ -73,8 +85,8 @@ export enum StencilSharedBufferView { */ export class StencilManager { public static sharedManager: StencilManager | null = null; - private _maskStack: any[] = []; - private _stencilPattern = { + private _maskStack: number[] = []; + private _stencilPattern: StencilPattern = { stencilTest: true, func: ComparisonFunc.ALWAYS, stencilMask: 0xffff, @@ -121,7 +133,7 @@ export class StencilManager { * @zh 添加mask嵌套。 * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future. */ - public pushMask (mask: any): void { + public pushMask (mask: number): void { this._maskStack.push(mask); } @@ -248,26 +260,27 @@ export class StencilManager { return cacheMap.get(key) as DepthStencilState; } this.setStateFromStage(stage); + const stencilPattern = this._stencilPattern; const depthStencilState = new DepthStencilState( depthTest, depthWrite, depthFunc, - this._stencilPattern.stencilTest, - this._stencilPattern.func, - this._stencilPattern.stencilMask, - this._stencilPattern.writeMask, - this._stencilPattern.failOp, - this._stencilPattern.zFailOp, - this._stencilPattern.passOp, - this._stencilPattern.ref, - this._stencilPattern.stencilTest, - this._stencilPattern.func, - this._stencilPattern.stencilMask, - this._stencilPattern.writeMask, - this._stencilPattern.failOp, - this._stencilPattern.zFailOp, - this._stencilPattern.passOp, - this._stencilPattern.ref, + stencilPattern.stencilTest, + stencilPattern.func, + stencilPattern.stencilMask, + stencilPattern.writeMask, + stencilPattern.failOp, + stencilPattern.zFailOp, + stencilPattern.passOp, + stencilPattern.ref, + stencilPattern.stencilTest, + stencilPattern.func, + stencilPattern.stencilMask, + stencilPattern.writeMask, + stencilPattern.failOp, + stencilPattern.zFailOp, + stencilPattern.passOp, + stencilPattern.ref, ); cacheMap.set(key, depthStencilState); return depthStencilState; @@ -283,7 +296,7 @@ export class StencilManager { } // Notice: Only children node in Mask need use this.stage - private setStateFromStage (stage): void { + private setStateFromStage (stage: Stage): void { const pattern = this._stencilPattern; if (stage === Stage.DISABLED) { pattern.stencilTest = false; diff --git a/cocos/2d/renderer/vertex-format.ts b/cocos/2d/renderer/vertex-format.ts index 3d8cdefa08c..f4e0aab25cf 100644 --- a/cocos/2d/renderer/vertex-format.ts +++ b/cocos/2d/renderer/vertex-format.ts @@ -25,12 +25,17 @@ import { AttributeName, Format, FormatInfos, Attribute } from '../../gfx'; import { cclegacy } from '../../core'; +const ATTR_POSITION = AttributeName.ATTR_POSITION; +const ATTR_COLOR = AttributeName.ATTR_COLOR; +const ATTR_TEX_COORD = AttributeName.ATTR_TEX_COORD; +const ATTR_COLOR2 = AttributeName.ATTR_COLOR2; + /** * @en Vertex format with vector 3 position attribute * @zh 包含三维位置属性的顶点格式 */ export const vfmt = [ - new Attribute(AttributeName.ATTR_POSITION, Format.RGB32F), + new Attribute(ATTR_POSITION, Format.RGB32F), ]; /** @@ -42,8 +47,8 @@ export const vfmt = [ * 2. RGBA 颜色属性(Float32) */ export const vfmtPosColor = [ - new Attribute(AttributeName.ATTR_POSITION, Format.RGB32F), - new Attribute(AttributeName.ATTR_COLOR, Format.RGBA32F), + new Attribute(ATTR_POSITION, Format.RGB32F), + new Attribute(ATTR_COLOR, Format.RGBA32F), ]; /** @@ -57,9 +62,9 @@ export const vfmtPosColor = [ * 3. RGBA 颜色属性(Float32) */ export const vfmtPosUvColor = [ - new Attribute(AttributeName.ATTR_POSITION, Format.RGB32F), - new Attribute(AttributeName.ATTR_TEX_COORD, Format.RG32F), - new Attribute(AttributeName.ATTR_COLOR, Format.RGBA32F), + new Attribute(ATTR_POSITION, Format.RGB32F), + new Attribute(ATTR_TEX_COORD, Format.RG32F), + new Attribute(ATTR_COLOR, Format.RGBA32F), ]; /** @@ -73,9 +78,9 @@ export const vfmtPosUvColor = [ * 3. RGBA 颜色属性(Byte) */ export const vfmtPosUvColor4B = [ - new Attribute(AttributeName.ATTR_POSITION, Format.RGB32F), - new Attribute(AttributeName.ATTR_TEX_COORD, Format.RG32F), - new Attribute(AttributeName.ATTR_COLOR, Format.RGBA8, true), + new Attribute(ATTR_POSITION, Format.RGB32F), + new Attribute(ATTR_TEX_COORD, Format.RG32F), + new Attribute(ATTR_COLOR, Format.RGBA8, true), ]; /** @@ -91,10 +96,10 @@ export const vfmtPosUvColor4B = [ * 4. 第二套 RGBA 颜色属性(Float32) */ export const vfmtPosUvTwoColor = [ - new Attribute(AttributeName.ATTR_POSITION, Format.RGB32F), - new Attribute(AttributeName.ATTR_TEX_COORD, Format.RG32F), - new Attribute(AttributeName.ATTR_COLOR, Format.RGBA32F), - new Attribute(AttributeName.ATTR_COLOR2, Format.RGBA32F), + new Attribute(ATTR_POSITION, Format.RGB32F), + new Attribute(ATTR_TEX_COORD, Format.RG32F), + new Attribute(ATTR_COLOR, Format.RGBA32F), + new Attribute(ATTR_COLOR2, Format.RGBA32F), ]; /** @@ -110,10 +115,10 @@ export const vfmtPosUvTwoColor = [ * 4. 第二套 RGBA 颜色属性(Byte) */ export const vfmtPosUvTwoColor4B = [ - new Attribute(AttributeName.ATTR_POSITION, Format.RGB32F), - new Attribute(AttributeName.ATTR_TEX_COORD, Format.RG32F), - new Attribute(AttributeName.ATTR_COLOR, Format.RGBA8, true), - new Attribute(AttributeName.ATTR_COLOR2, Format.RGBA8, true), + new Attribute(ATTR_POSITION, Format.RGB32F), + new Attribute(ATTR_TEX_COORD, Format.RG32F), + new Attribute(ATTR_COLOR, Format.RGBA8, true), + new Attribute(ATTR_COLOR2, Format.RGBA8, true), ]; /**