-
Notifications
You must be signed in to change notification settings - Fork 2k
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 2D modules #18332
Draft
dumganhar
wants to merge
12
commits into
cocos:v3.8.6
Choose a base branch
from
dumganhar:386-only-2d-new-2
base: v3.8.6
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # cocos/2d/renderer/render-data.ts # cocos/root.ts
Code Size Check Report
Interface Check Report! WARNING this pull request has changed these public interfaces:
@@ -3019,9 +3019,9 @@
protected _userDefinedFont: TTFFont | null;
protected _cacheMode: CacheMode;
protected _imageAtlas: SpriteAtlas | null;
protected _handleTouchEvent: boolean;
- protected _textArray: IHtmlTextParserResultObj[];
+ protected _textArray: __private._cocos_2d_utils_html_text_parser__IHtmlTextParserResultObj[];
protected _segments: __private._cocos_2d_components_rich_text__ISegment[];
protected _labelSegmentsCache: __private._cocos_2d_components_rich_text__ISegment[];
protected _linesWidth: number[];
protected _lineCount: number;
@@ -3051,10 +3051,10 @@
protected _addLabelSegment(stringToken: string, styleIndex: number): __private._cocos_2d_components_rich_text__ISegment;
protected _updateRichTextWithMaxWidth(labelString: string, labelWidth: number, styleIndex: number): void;
protected _isLastComponentCR(stringToken: any): boolean;
protected _updateLineInfo(): void;
- protected _needsUpdateTextLayout(newTextArray: IHtmlTextParserResultObj[]): boolean;
- protected _addRichTextImageElement(richTextElement: IHtmlTextParserResultObj): void;
+ protected _needsUpdateTextLayout(newTextArray: __private._cocos_2d_utils_html_text_parser__IHtmlTextParserResultObj[]): boolean;
+ protected _addRichTextImageElement(richTextElement: __private._cocos_2d_utils_html_text_parser__IHtmlTextParserResultObj): void;
protected _updateTextDefaultColor(): void;
protected _updateRichText(): void;
protected _getFirstWordLen(text: string, startIndex: number, textLen: number): number;
protected _updateRichTextPosition(): void;
@@ -3843,52 +3843,8 @@
* @method destroy
*/
destroy(): void;
}
- /**
- * @en A utils class for parsing HTML texts. The parsed results will be an object array.
- * @zh 一个用于解析HTML文本的工具类。解析后的结果将是一个对象数组。
- * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
- */
- export interface IHtmlTextParserResultObj {
- text?: string;
- style?: IHtmlTextParserStack;
- }
- /**
- * @en Html Text Parser Stack interface
- * @zh Html 文本解析器接口
- * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
- */
- export interface IHtmlTextParserStack {
- color?: string;
- size?: number;
- event?: {
- [k: string]: string;
- };
- isNewLine?: boolean;
- isImage?: boolean;
- src?: string;
- imageWidth?: number;
- imageHeight?: number;
- imageOffset?: string;
- imageAlign?: string;
- underline?: boolean;
- italic?: boolean;
- bold?: boolean;
- outline?: {
- color: string;
- width: number;
- };
- }
- /**
- * @en Html Text Parser Stack
- * @zh Html 文本解析器
- * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
- */
- export class HtmlTextParser {
- constructor();
- parse(htmlString: string): IHtmlTextParserResultObj[];
- }
export function getBaselineOffset(): number;
/**
* @deprecated since v3.7.2, this is an engine private interface that will be removed in the future.
*/
@@ -4642,44 +4598,22 @@
/**
* @en Shadow projection mode enumeration.
* @zh 阴影投射方式枚举。
*/
- static ShadowCastingMode: {
- /**
- * @en Disable shadow projection.
- * @zh 不投射阴影。
- */
- OFF: number;
- /**
- * @en Enable shadow projection.
- * @zh 开启阴影投射。
- */
- ON: number;
- };
+ static ShadowCastingMode: typeof __private._cocos_3d_framework_mesh_renderer__ModelShadowCastingMode;
/**
* @en Shadow receive mode enumeration.
* @zh 阴影接收方式枚举。
*/
- static ShadowReceivingMode: {
- /**
- * @en Disable shadow receiving.
- * @zh 不接收阴影。
- */
- OFF: number;
- /**
- * @en Enable shadow receiving.
- * @zh 开启阴影投射。
- */
- ON: number;
- };
+ static ShadowReceivingMode: typeof __private._cocos_3d_framework_mesh_renderer__ModelShadowReceivingMode;
/**
* @en The settings for GI baking, it was called lightmapSettings before
* @zh 全局光照烘焙的配置,以前名称为lightmapSettings
*/
bakeSettings: __private._cocos_3d_framework_mesh_renderer__ModelBakeSettings;
protected _mesh: Mesh | null;
- protected _shadowCastingMode: number;
- protected _shadowReceivingMode: number;
+ protected _shadowCastingMode: __private._cocos_3d_framework_mesh_renderer__ModelShadowCastingMode;
+ protected _shadowReceivingMode: __private._cocos_3d_framework_mesh_renderer__ModelShadowReceivingMode;
protected _shadowBias: number;
protected _shadowNormalBias: number;
protected _reflectionProbeId: number;
protected _reflectionProbeBlendId: number;
@@ -5027,12 +4961,9 @@
/**
* @en The physical term used for light.
* @zh 光源所使用的物理计量单位。
*/
- static PhotometricTerm: {
- LUMINOUS_FLUX: number;
- LUMINANCE: number;
- };
+ static PhotometricTerm: typeof __private._cocos_3d_lights_light_component__PhotometricTerm;
protected _color: math.Color;
protected _useColorTemperature: boolean;
protected _colorTemperature: number;
protected _staticSettings: __private._cocos_3d_lights_light_component__StaticLightSettings;
@@ -12238,9 +12169,9 @@
/**
* @zh 阴影贴图分辨率。
* @en The shadow map size.
* @static
- * @enum Shadows.ShadowSize
+ * @enum ShadowSize
*/
export const ShadowSize: {
/**
* @zh 分辨率 256 * 256。
@@ -12484,44 +12415,44 @@
* 全局雾类型。
* @en
* The global fog type
* @static
- * @enum FogInfo.FogType
+ * @enum FogType
*/
- export const FogType: {
+ export enum FogType {
/**
* @zh
* 线性雾。
* @en
* Linear fog
* @readonly
*/
- LINEAR: number;
+ LINEAR = 0,
/**
* @zh
* 指数雾。
* @en
* Exponential fog
* @readonly
*/
- EXP: number;
+ EXP = 1,
/**
* @zh
* 指数平方雾。
* @en
* Exponential square fog
* @readonly
*/
- EXP_SQUARED: number;
+ EXP_SQUARED = 2,
/**
* @zh
* 层叠雾。
* @en
* Layered fog
* @readonly
*/
- LAYERED: number;
- };
+ LAYERED = 3
+ }
export const FOG_TYPE_NONE: number;
/**
* @en The fog representation in the render scene.
* @zh 渲染场景中的全局雾效配置
@@ -26459,9 +26390,9 @@
* @zh 使用自定义的天空盒材质
*/
set skyboxMaterial(val: Material | null);
get skyboxMaterial(): Material | null;
- protected _envLightingType: renderer.scene.EnvironmentLightingType;
+ protected _envLightingType: number;
protected _envmapHDR: TextureCube | null;
protected _envmapLDR: TextureCube | null;
protected _diffuseMapHDR: TextureCube | null;
protected _diffuseMapLDR: TextureCube | null;
@@ -26501,14 +26432,9 @@
* @zh 全局雾相关配置
* @en Global fog configuration
*/
export class FogInfo {
- static FogType: {
- LINEAR: number;
- EXP: number;
- EXP_SQUARED: number;
- LAYERED: number;
- };
+ static FogType: number | typeof renderer.scene.FogType;
/**
* @zh 是否启用全局雾效
* @en Enable global fog
*/
@@ -26567,9 +26493,9 @@
* @en Global fog range, only for layered fog
*/
get fogRange(): number;
set fogRange(val: number);
- protected _type: number;
+ protected _type: renderer.scene.FogType;
protected _fogColor: math.Color;
protected _enabled: boolean;
protected _fogDensity: number;
protected _fogStart: number;
@@ -61776,8 +61702,45 @@
contentSizeExtend: math.Size;
startPosition: math.Vec2;
reset(): void;
}
+ /**
+ * @en Html Text Parser Stack interface
+ * @zh Html 文本解析器接口
+ * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+ * @mangle
+ */
+ export interface _cocos_2d_utils_html_text_parser__IHtmlTextParserStack {
+ color?: string;
+ size?: number;
+ event?: {
+ [k: string]: string;
+ };
+ isNewLine?: boolean;
+ isImage?: boolean;
+ src?: string;
+ imageWidth?: number;
+ imageHeight?: number;
+ imageOffset?: string;
+ imageAlign?: string;
+ underline?: boolean;
+ italic?: boolean;
+ bold?: boolean;
+ outline?: {
+ color: string;
+ width: number;
+ };
+ }
+ /**
+ * @en A utils class for parsing HTML texts. The parsed results will be an object array.
+ * @zh 一个用于解析HTML文本的工具类。解析后的结果将是一个对象数组。
+ * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+ * @mangle
+ */
+ export interface _cocos_2d_utils_html_text_parser__IHtmlTextParserResultObj {
+ text?: string;
+ style?: _cocos_2d_utils_html_text_parser__IHtmlTextParserStack;
+ }
export interface _cocos_2d_components_rich_text__ISegment {
node: Node;
comp: Label | Sprite | null;
lineCount: number;
@@ -61971,8 +61934,40 @@
*/
export interface _cocos_3d_assets_morph_rendering__MorphRendering {
createInstance(): _cocos_3d_assets_morph_rendering__MorphRenderingInstance;
}
+ /**
+ * @en Shadow projection mode.
+ * @zh 阴影投射方式。
+ */
+ export enum _cocos_3d_framework_mesh_renderer__ModelShadowCastingMode {
+ /**
+ * @en Disable shadow projection.
+ * @zh 不投射阴影。
+ */
+ OFF = 0,
+ /**
+ * @en Enable shadow projection.
+ * @zh 开启阴影投射。
+ */
+ ON = 1
+ }
+ /**
+ * @en Shadow receive mode.
+ * @zh 阴影接收方式。
+ */
+ export enum _cocos_3d_framework_mesh_renderer__ModelShadowReceivingMode {
+ /**
+ * @en Disable shadow receiving.
+ * @zh 不接收阴影。
+ */
+ OFF = 0,
+ /**
+ * @en Enable shadow receiving.
+ * @zh 开启阴影投射。
+ */
+ ON = 1
+ }
export enum _cocos_3d_framework_mesh_renderer__ModelBakeSettingsEvent {
/**
* @en The event which will be triggered when the useLightProbe is changed.
* @zh useLightProbe属性修改时触发的事件
@@ -62073,41 +62068,17 @@
*/
get bakeToReflectionProbe(): boolean;
set bakeToReflectionProbe(val: boolean);
}
- /**
- * @en Shadow projection mode.
- * @zh 阴影投射方式。
- */
- export const _cocos_3d_framework_mesh_renderer__ModelShadowCastingMode: {
- /**
- * @en Disable shadow projection.
- * @zh 不投射阴影。
- */
- OFF: number;
- /**
- * @en Enable shadow projection.
- * @zh 开启阴影投射。
- */
- ON: number;
- };
export type __types_globals__EnumAlias<EnumT> = EnumT[keyof EnumT];
/**
- * @en Shadow receive mode.
- * @zh 阴影接收方式。
+ * @en The physical term used for light.
+ * @zh 光源所使用的物理计量单位。
*/
- export const _cocos_3d_framework_mesh_renderer__ModelShadowReceivingMode: {
- /**
- * @en Disable shadow receiving.
- * @zh 不接收阴影。
- */
- OFF: number;
- /**
- * @en Enable shadow receiving.
- * @zh 开启阴影投射。
- */
- ON: number;
- };
+ export enum _cocos_3d_lights_light_component__PhotometricTerm {
+ LUMINOUS_FLUX = 0,
+ LUMINANCE = 1
+ }
/**
* @en Static light settings.
* @zh 静态灯光设置
*/
@@ -62134,16 +62105,8 @@
get castShadow(): boolean;
set castShadow(val: boolean);
}
/**
- * @en The physical term used for light.
- * @zh 光源所使用的物理计量单位。
- */
- export const _cocos_3d_lights_light_component__PhotometricTerm: {
- LUMINOUS_FLUX: number;
- LUMINANCE: number;
- };
- /**
* @en
* The model that support morph target rendering.
* @zh
* 支持渲染蒙皮形变的模型。
|
…86-only-2d-new-2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Re: #18222
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: