Skip to content

[v3.8.6] Inline enum for particle 3d module.#18193

Merged
minggo merged 3 commits into
cocos:v3.8.6from
dumganhar:386-particle3d-enum-inline
Jan 15, 2025
Merged

[v3.8.6] Inline enum for particle 3d module.#18193
minggo merged 3 commits into
cocos:v3.8.6from
dumganhar:386-particle3d-enum-inline

Conversation

@dumganhar

Copy link
Copy Markdown
Contributor

Re: #

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

@github-actions

github-actions Bot commented Jan 15, 2025

Copy link
Copy Markdown

👍 Package size ⤵ -1215 bytes, old: 5242908, new: 5241693

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -22937,12 +22937,9 @@
          * 这个控件包含了两种取色模式:
          * 混合模式对取到的最近两个颜色帧进行插值计算。
          * 固定模式直接取最近的颜色帧返回,不进行插值。
          */
-        static Mode: {
-            Blend: number;
-            Fixed: number;
-        };
+        static Mode: typeof __private._cocos_core_curves_gradient__GradientMode;
         /**
          * @en Array of color key.
          * @zh 颜色关键帧列表。
          */
@@ -22955,9 +22952,9 @@
         /**
          * @en Blend mode.
          * @zh 混合模式。
          */
-        mode: number;
+        mode: __private._cocos_core_curves_gradient__GradientMode;
         /**
          * @en Set color keys array and alpha keys array.
          * @zh 设置颜色和透明度的关键帧列表。
          * @param colorKeys @en Array of color keys @zh 颜色关键帧列表
@@ -46346,9 +46343,9 @@
         /**
          * @en The space of particle scaling.
          * @zh 计算粒子缩放的空间。
          */
-        scaleSpace: number;
+        scaleSpace: __private._cocos_particle_enum__ParticleSpace;
         /**
          * @en Whether to modify particle size on XYZ axis.
          * @zh 是否需要修改粒子在三个轴上的大小。
          */
@@ -46467,18 +46464,14 @@
          * @zh 粒子剔除模式选择。包括暂停模拟,暂停以后快进继续以及不间断模拟。
          */
         get cullingMode(): number;
         set cullingMode(value: number);
-        _cullingMode: number;
+        _cullingMode: __private._cocos_particle_enum__ParticleCullingMode;
         /**
          * @en Emitter culling mode.
          * @zh 发射器的各种剔除模式。
          */
-        static CullingMode: {
-            Pause: number;
-            PauseAndCatchup: number;
-            AlwaysSimulate: number;
-        };
+        static CullingMode: typeof __private._cocos_particle_enum__ParticleCullingMode;
         /**
          * @en Particle bounding box half width.
          * @zh 粒子包围盒半宽。
          */
@@ -64106,8 +64099,12 @@
          * - 插值模式:球面线性插值
          * - 值:单位四元数
          */
         export type _cocos_core_curves_quat_curve__QuatKeyframeValueParameters = Partial<QuatKeyframeValue>;
+        export enum _cocos_core_curves_gradient__GradientMode {
+            Blend = 0,
+            Fixed = 1
+        }
         export type _cocos_core_value_types_enum__EnumType = Record<string, string | number>;
         export class _cocos_rendering_shadow_csm_layers__ShadowLayerVolume {
             protected _shadowObjects: pipeline.IRenderObject[];
             protected _shadowCameraFar: number;
@@ -67984,8 +67981,23 @@
             constructor(point?: math.Vec2, dir?: math.Vec2);
             setPoint(x: any, y: any): void;
             setDir(x: any, y: any): void;
         }
+        export enum _cocos_particle_enum__ParticleSpace {
+            World = 0,
+            Local = 1,
+            Custom = 2
+        }
+        /**
+         * @en Particle emitter culling mode
+         * @zh 粒子的剔除模式。
+         * @enum ParticleSystem.CullingMode
+         */
+        export enum _cocos_particle_enum__ParticleCullingMode {
+            Pause = 0,
+            PauseAndCatchup = 1,
+            AlwaysSimulate = 2
+        }
         export class _cocos_particle_particle__Particle {
             static INDENTIFY_NEG_QUAT: number;
             static R2D: number;
             particleSystem: ParticleSystem;
@@ -68043,8 +68055,18 @@
             doDestroy(): void;
             set useInstance(value: boolean);
             get useInstance(): boolean;
         }
+        /**
+         * @en Particle emitter alignment space
+         * @zh 粒子的对齐模式。
+         * @enum ParticleSystemRenderer.AlignmentSpace
+         */
+        export enum _cocos_particle_enum__ParticleAlignmentSpace {
+            World = 0,
+            Local = 1,
+            View = 2
+        }
         export class _cocos_particle_renderer_particle_system_renderer_data__default {
             /**
              * @zh 设定粒子生成模式。
              */
@@ -68097,13 +68119,9 @@
              * @zh 粒子对齐空间选择。包括世界空间,局部空间和视角空间。
              */
             get alignSpace(): number;
             set alignSpace(val: number);
-            static AlignmentSpace: {
-                World: number;
-                Local: number;
-                View: number;
-            };
+            static AlignmentSpace: typeof _cocos_particle_enum__ParticleAlignmentSpace;
             create(ps: ParticleSystem): void;
             onInit(ps: ParticleSystem): void;
         }
         export interface _cocos_particle_particle__IParticleModule {
@@ -68195,8 +68213,74 @@
              */
             animate(particle: _cocos_particle_particle__Particle): void;
         }
         /**
+         * 粒子发射器类型。
+         * @enum shapeModule.ShapeType
+         */
+        export enum _cocos_particle_enum__ParticleShapeType {
+            /**
+             * 立方体类型粒子发射器。
+             */
+            Box = 0,
+            /**
+             * 圆形粒子发射器。
+             */
+            Circle = 1,
+            /**
+             * 圆锥体粒子发射器。
+             */
+            Cone = 2,
+            /**
+             * 球体粒子发射器。
+             */
+            Sphere = 3,
+            /**
+             * 半球体粒子发射器。
+             */
+            Hemisphere = 4
+        }
+        /**
+         * 粒子从发射器的哪个部位发射。
+         * @enum shapeModule.EmitLocation
+         */
+        export enum _cocos_particle_enum__ParticleEmitLocation {
+            /**
+             * 基础位置发射(仅对 Circle 类型及 Cone 类型的粒子发射器适用)。
+             */
+            Base = 0,
+            /**
+             * 边框位置发射(仅对 Box 类型及 Circle 类型的粒子发射器适用)。
+             */
+            Edge = 1,
+            /**
+             * 表面位置发射(对所有类型的粒子发射器都适用)。
+             */
+            Shell = 2,
+            /**
+             * 内部位置发射(对所有类型的粒子发射器都适用)。
+             */
+            Volume = 3
+        }
+        /**
+         * 粒子在扇形区域的发射方式。
+         * @enum shapeModule.ArcMode
+         */
+        export enum _cocos_particle_enum__ParticleArcMode {
+            /**
+             * 随机位置发射。
+             */
+            Random = 0,
+            /**
+             * 沿某一方向循环发射,每次循环方向相同。
+             */
+            Loop = 1,
+            /**
+             * 循环发射,每次循环方向相反。
+             */
+            PingPong = 2
+        }
+        /**
          * @en
          * This module defines the the volume or surface from which particles can be emitted, and the direction of the start velocity.
          * The Shape property defines the shape of the emission volume, and the rest of the module properties vary depending on the Shape you choose.
          * All shapes have properties that define their dimensions, such as the Radius property.
@@ -68252,16 +68336,16 @@
              * @zh 粒子发射器类型 [[ShapeType]]。
              *
              * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
              */
-            _shapeType: number;
+            _shapeType: _cocos_particle_enum__ParticleShapeType;
             get shapeType(): number;
             set shapeType(val: number);
             /**
              * @en Particles emitted from which part of the shape [[EmitLocation]] (Box Cone Sphere Hemisphere).
              * @zh 粒子从发射器哪个部位发射 [[EmitLocation]]。
              */
-            emitFrom: number;
+            emitFrom: _cocos_particle_enum__ParticleEmitLocation;
             /**
              * @en Align particle with particle direction.
              * @zh 根据粒子的初始方向决定粒子的移动方向。
              */
@@ -68300,9 +68384,9 @@
             /**
              * @en Arc mode for Cone and Circle shape.
              * @zh 粒子在扇形范围内的发射方式 [[ArcMode]]。
              */
-            arcMode: number;
+            arcMode: _cocos_particle_enum__ParticleArcMode;
             /**
              * @en Control arc spread for Cone and circle shape.
              * @zh 控制可能产生粒子的弧周围的离散间隔。
              */
@@ -68434,9 +68518,9 @@
             /**
              * @en Velocity [[Space]] used to calculate particle velocity.
              * @zh 速度计算时采用的坐标系[[Space]]。
              */
-            space: number;
+            space: _cocos_particle_enum__ParticleSpace;
             name: string;
             constructor();
             /**
              * @en Update velocity overtime module calculate transform.
@@ -68489,9 +68573,9 @@
             /**
              * @en Force calculation coordinate. See [[Space]].
              * @zh 加速度计算时采用的坐标系 [[Space]]。
              */
-            space: number;
+            space: _cocos_particle_enum__ParticleSpace;
             randomized: boolean;
             name: string;
             constructor();
             /**
@@ -68562,9 +68646,9 @@
             /**
              * @en Space used to calculate limit velocity.
              * @zh 计算速度下限时采用的坐标系 [[Space]]。
              */
-            space: number;
+            space: _cocos_particle_enum__ParticleSpace;
             drag: null;
             multiplyDragByParticleSize: boolean;
             multiplyDragByParticleVelocity: boolean;
             name: string;
@@ -68839,8 +68923,29 @@
              * @param height @en Texture height @zh 噪声图高度
              */
             getNoisePreview(out: number[], ps: ParticleSystem, width: number, height: number): void;
         }
+        /**
+         * 选择如何为粒子系统生成轨迹。
+         * @enum trailModule.TrailMode
+         */
+        export enum _cocos_particle_enum__ParticleTrailMode {
+            /**
+             * 粒子模式<bg>。
+             * 创建一种效果,其中每个粒子在其路径中留下固定的轨迹。
+             */
+            Particles = 0
+        }
+        /**
+         * 纹理填充模式。
+         * @enum trailModule.TextureMode
+         */
+        export enum _cocos_particle_enum__ParticleTextureMode {
+            /**
+             * 拉伸填充纹理。
+             */
+            Stretch = 0
+        }
         export class _cocos_particle_renderer_trail__default {
             /**
              * 是否启用。
              */
@@ -68852,9 +68957,9 @@
             _enable: boolean;
             /**
              * 设定粒子生成轨迹的方式。
              */
-            mode: number;
+            mode: _cocos_particle_enum__ParticleTrailMode;
             /**
              * 轨迹存在的生命周期。
              */
             lifeTime: CurveRange;
@@ -68875,9 +68980,9 @@
             existWithParticles: boolean;
             /**
              * 设定纹理填充方式。
              */
-            textureMode: number;
+            textureMode: _cocos_particle_enum__ParticleTextureMode;
             widthFromParticle: boolean;
             /**
              * 控制轨迹长度的曲线。
              */

@dumganhar dumganhar requested a review from minggo January 15, 2025 06:15
@minggo minggo merged commit a107d84 into cocos:v3.8.6 Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants