From 42c30271c88290cb53d74fe052ba3ba69b5436bf Mon Sep 17 00:00:00 2001 From: ChiaNing <42071583+LinYunMo@users.noreply.github.com> Date: Tue, 30 Apr 2019 16:59:22 +0800 Subject: [PATCH] docs for particle system (#4357) --- .../particle/animator/color-overtime.ts | 6 + .../particle/animator/force-overtime.ts | 15 ++ .../animator/limit-velocity-overtime.ts | 24 ++++ .../particle/animator/rotation-overtime.ts | 15 ++ .../particle/animator/size-overtime.ts | 18 +++ .../particle/animator/texture-animation.ts | 55 ++++++++ .../particle/animator/velocity-overtime.ts | 18 +++ cocos/3d/framework/particle/burst.ts | 18 +++ .../particle/emitter/shape-module.ts | 131 ++++++++++++++++++ .../particle/particle-system-component.ts | 93 +++++++++++++ .../renderer/particle-system-renderer.ts | 36 +++++ cocos/3d/framework/particle/renderer/trail.ts | 51 +++++++ 12 files changed, 480 insertions(+) diff --git a/cocos/3d/framework/particle/animator/color-overtime.ts b/cocos/3d/framework/particle/animator/color-overtime.ts index 02cc54fe69..bb9813eb6b 100644 --- a/cocos/3d/framework/particle/animator/color-overtime.ts +++ b/cocos/3d/framework/particle/animator/color-overtime.ts @@ -11,11 +11,17 @@ const COLOR_OVERTIME_RAND_OFFSET = 91041; @ccclass('cc.ColorOvertimeModule') export default class ColorOvertimeModule { + /** + * 是否启用 + */ @property({ displayOrder: 0, }) public enable = false; + /** + * 颜色随时间变化的参数,各个 key 之间线性差值变化 + */ @property({ type: GradientRange, displayOrder: 1, diff --git a/cocos/3d/framework/particle/animator/force-overtime.ts b/cocos/3d/framework/particle/animator/force-overtime.ts index 000d68272d..5940436ca0 100644 --- a/cocos/3d/framework/particle/animator/force-overtime.ts +++ b/cocos/3d/framework/particle/animator/force-overtime.ts @@ -10,29 +10,44 @@ const FORCE_OVERTIME_RAND_OFFSET = 212165; @ccclass('cc.ForceOvertimeModule') export default class ForceOvertimeModule { + /** + * 是否启用 + */ @property({ displayOrder: 0, }) public enable = false; + /** + * X 轴方向上的加速度分量 + */ @property({ type: CurveRange, displayOrder: 2, }) public x = new CurveRange(); + /** + * Y 轴方向上的加速度分量 + */ @property({ type: CurveRange, displayOrder: 3, }) public y = new CurveRange(); + /** + * Z 轴方向上的加速度分量 + */ @property({ type: CurveRange, displayOrder: 4, }) public z = new CurveRange(); + /** + * 加速度计算时采用的坐标系 + */ @property({ type: Space, displayOrder: 1, diff --git a/cocos/3d/framework/particle/animator/limit-velocity-overtime.ts b/cocos/3d/framework/particle/animator/limit-velocity-overtime.ts index 633aeb218e..e5bb0726fa 100644 --- a/cocos/3d/framework/particle/animator/limit-velocity-overtime.ts +++ b/cocos/3d/framework/particle/animator/limit-velocity-overtime.ts @@ -11,45 +11,69 @@ const LIMIT_VELOCITY_RAND_OFFSET = 23541; @ccclass('cc.LimitVelocityOvertimeModule') export default class LimitVelocityOvertimeModule { + /** + * 是否启用 + */ @property({ displayOrder: 0, }) public enable = false; + /** + * X 轴方向上的速度下限 + */ @property({ type: CurveRange, displayOrder: 4, }) public limitX = new CurveRange(); + /** + * Y 轴方向上的速度下限 + */ @property({ type: CurveRange, displayOrder: 5, }) public limitY = new CurveRange(); + /** + * Z 轴方向上的速度下限 + */ @property({ type: CurveRange, displayOrder: 6, }) public limitZ = new CurveRange(); + /** + * 速度下限 + */ @property({ type: CurveRange, displayOrder: 3, }) public limit = new CurveRange(); + /** + * 当前速度与速度下限的插值 + */ @property({ displayOrder: 7, }) public dampen = 3; + /** + * 是否三个轴分开限制 + */ @property({ displayOrder: 2, }) public separateAxes = false; + /** + * 计算速度下限时采用的坐标系 + */ @property({ type: Space, displayOrder: 1, diff --git a/cocos/3d/framework/particle/animator/rotation-overtime.ts b/cocos/3d/framework/particle/animator/rotation-overtime.ts index 4ef6bb13f5..43f2f781f4 100644 --- a/cocos/3d/framework/particle/animator/rotation-overtime.ts +++ b/cocos/3d/framework/particle/animator/rotation-overtime.ts @@ -10,6 +10,9 @@ const ROTATION_OVERTIME_RAND_OFFSET = 125292; @ccclass('cc.RotationOvertimeModule') export default class RotationOvertimeModule { + /** + * 是否启用 + */ @property({ displayOrder: 0, }) @@ -18,6 +21,9 @@ export default class RotationOvertimeModule { @property private _separateAxes = false; + /** + * 是否三个轴分开设定旋转(暂不支持) + */ @property({ displayOrder: 1, }) @@ -34,18 +40,27 @@ export default class RotationOvertimeModule { } } + /** + * 绕 X 轴设定旋转 + */ @property({ type: CurveRange, displayOrder: 2, }) public x = new CurveRange(); + /** + * 绕 Y 轴设定旋转 + */ @property({ type: CurveRange, displayOrder: 3, }) public y = new CurveRange(); + /** + * 绕 X 轴设定旋转 + */ @property({ type: CurveRange, displayOrder: 4, diff --git a/cocos/3d/framework/particle/animator/size-overtime.ts b/cocos/3d/framework/particle/animator/size-overtime.ts index d7a5730a28..37b871db9c 100644 --- a/cocos/3d/framework/particle/animator/size-overtime.ts +++ b/cocos/3d/framework/particle/animator/size-overtime.ts @@ -10,34 +10,52 @@ const SIZE_OVERTIME_RAND_OFFSET = 39825; @ccclass('cc.SizeOvertimeModule') export default class SizeOvertimeModule { + /** + * 是否启用 + */ @property({ displayOrder: 0, }) public enable = false; + /** + * 决定是否在每个轴上独立控制粒子大小 + */ @property({ displayOrder: 1, }) public separateAxes = false; + /** + * 定义一条曲线来决定粒子在其生命周期中的大小变化 + */ @property({ type: CurveRange, displayOrder: 2, }) public size = new CurveRange(); + /** + * 定义一条曲线来决定粒子在其生命周期中 X 轴方向上的大小变化 + */ @property({ type: CurveRange, displayOrder: 3, }) public x = new CurveRange(); + /** + * 定义一条曲线来决定粒子在其生命周期中 Y 轴方向上的大小变化 + */ @property({ type: CurveRange, displayOrder: 4, }) public y = new CurveRange(); + /** + * 定义一条曲线来决定粒子在其生命周期中 Z 轴方向上的大小变化 + */ @property({ type: CurveRange, displayOrder: 5, diff --git a/cocos/3d/framework/particle/animator/texture-animation.ts b/cocos/3d/framework/particle/animator/texture-animation.ts index 5a68e5ff83..1f4df7337a 100644 --- a/cocos/3d/framework/particle/animator/texture-animation.ts +++ b/cocos/3d/framework/particle/animator/texture-animation.ts @@ -9,13 +9,35 @@ import Particle from "../particle"; // tslint:disable: max-line-length const TEXTURE_ANIMATION_RAND_OFFSET = 90794; +/** + * 粒子贴图动画类型 + * @enum textureAnimationModule.Mode + */ const Mode = Enum({ + /** + * 网格类型 + */ Grid: 0, + + /** + * 精灵类型(暂未支持) + */ Sprites: 1, }); +/** + * 贴图动画的播放方式 + * @enum textureAnimationModule.Animation + */ const Animation = Enum({ + /** + * 播放贴图中的所有帧 + */ WholeSheet: 0, + + /** + * 播放贴图中的其中一行动画 + */ SingleRow: 1, }); @@ -25,6 +47,9 @@ export default class TextureAnimationModule { @property private _enable = false; + /** + * 是否启用 + */ @property({ displayOrder: 0, }) @@ -42,6 +67,9 @@ export default class TextureAnimationModule { }) private _mode = Mode.Grid; + /** + * 设定粒子贴图动画的类型(暂只支持 Grid 模式) + */ @property({ type: Mode, displayOrder: 1, @@ -57,34 +85,53 @@ export default class TextureAnimationModule { } } + /** + * X 方向动画帧数 + */ @property({ displayOrder: 2, }) public numTilesX = 0; + /** + * Y 方向动画帧数 + */ @property({ displayOrder: 3, }) public numTilesY = 0; + + /** + * 动画播放方式 + */ @property({ type: Animation, displayOrder: 4, }) public animation = Animation.WholeSheet; + /** + * 一个周期内动画播放的帧与时间变化曲线 + */ @property({ type: CurveRange, displayOrder: 7, }) public frameOverTime = new CurveRange(); + /** + * 从第几帧开始播放,时间为整个粒子系统的生命周期 + */ @property({ type: CurveRange, displayOrder: 8, }) public startFrame = new CurveRange(); + /** + * 一个生命周期内播放循环的次数 + */ @property({ displayOrder: 9, }) @@ -123,11 +170,19 @@ export default class TextureAnimationModule { console.error("particle texture animation's uvChannelMask is not supported!"); } + /** + * 随机从动画贴图中选择一行以生成动画 + * 此选项仅在动画播放方式为 SingleRow 时生效 + */ @property({ displayOrder: 5, }) public randomRow = false; + /** + * 从动画贴图中选择特定行以生成动画 + * 此选项仅在动画播放方式为 SingleRow 时且禁用 randomRow 时可用 + */ @property({ displayOrder: 6, }) diff --git a/cocos/3d/framework/particle/animator/velocity-overtime.ts b/cocos/3d/framework/particle/animator/velocity-overtime.ts index b3f0747af1..4f2f06d823 100644 --- a/cocos/3d/framework/particle/animator/velocity-overtime.ts +++ b/cocos/3d/framework/particle/animator/velocity-overtime.ts @@ -11,35 +11,53 @@ const VELOCITY_OVERTIME_RAND_OFFSET = 197866; @ccclass('cc.VelocityOvertimeModule') export default class VelocityOvertimeModule { + /** + * 是否启用 + */ @property({ displayOrder: 0, }) public enable = false; + /** + * X 轴方向上的速度分量 + */ @property({ type: CurveRange, displayOrder: 2, }) public x = new CurveRange(); + /** + * Y 轴方向上的速度分量 + */ @property({ type: CurveRange, displayOrder: 3, }) public y = new CurveRange(); + /** + * Z 轴方向上的速度分量 + */ @property({ type: CurveRange, displayOrder: 4, }) public z = new CurveRange(); + /** + * 速度修正系数(只支持 CPU 粒子) + */ @property({ type: CurveRange, displayOrder: 5, }) public speedModifier = new CurveRange(); + /** + * 速度计算时采用的坐标系 + */ @property({ type: Space, displayOrder: 1, diff --git a/cocos/3d/framework/particle/burst.ts b/cocos/3d/framework/particle/burst.ts index e0cf1a9198..a401b1c312 100644 --- a/cocos/3d/framework/particle/burst.ts +++ b/cocos/3d/framework/particle/burst.ts @@ -9,6 +9,9 @@ export default class Burst { @property private _time: number = 0; + /** + * 粒子系统开始运行到触发此次 Brust 的时间 + */ @property get time () { return this._time; @@ -19,15 +22,24 @@ export default class Burst { this._curTime = val; } + /** + * 发射粒子的最小数量 + */ @property public minCount: number = 30; + /** + * 发射粒子的最大数量 + */ @property public maxCount: number = 30; @property private _repeatCount: number = 1; + /** + * Burst 的触发次数 + */ @property get repeatCount () { return this._repeatCount; @@ -38,9 +50,15 @@ export default class Burst { this._remainingCount = val; } + /** + * 每次触发的间隔时间 + */ @property public repeatInterval: number = 1; + /** + * 发射的粒子的数量 + */ @property({ type: CurveRange, }) diff --git a/cocos/3d/framework/particle/emitter/shape-module.ts b/cocos/3d/framework/particle/emitter/shape-module.ts index 82025c3e72..52d13fb780 100644 --- a/cocos/3d/framework/particle/emitter/shape-module.ts +++ b/cocos/3d/framework/particle/emitter/shape-module.ts @@ -11,41 +11,119 @@ const _intermediVec = vec3.create(0, 0, 0); const _intermediArr = new Array(); const _unitBoxExtent = vec3.create(0.5, 0.5, 0.5); +/** + * 粒子发射器类型 + * @enum shapeModule.ShapeType + */ const ShapeType = Enum({ + /** + * 立方体类型粒子发射器 + * @property {Number} Box + */ Box: 0, + + /** + * 圆形粒子发射器 + * @property {Number} Circle + */ Circle: 1, + + /** + * 圆锥体粒子发射器 + * @property {Number} Cone + */ Cone: 2, + + /** + * 球体粒子发射器 + * @property {Number} Sphere + */ Sphere: 3, + + /** + * 半球体粒子发射器 + * @property {Number} Hemisphere + */ Hemisphere: 4, }); +/** + * 粒子从发射器的哪个部位发射 + * @enum shapeModule.EmitLocation + */ const EmitLocation = Enum({ + /** + * 基础位置发射(仅对 Circle 类型及 Cone 类型的粒子发射器适用) + * @property {Number} Base + */ Base: 0, + + /** + * 边框位置发射(仅对 Box 类型及 Circle 类型的粒子发射器适用) + * @property {Number} Edge + */ Edge: 1, + + /** + * 表面位置发射(对所有类型的粒子发射器都适用) + * @property {Number} Shell + */ Shell: 2, + + /** + * 内部位置发射(对所有类型的粒子发射器都适用) + * @property {Number} Volume + */ Volume: 3, }); +/** + * 粒子在扇形区域的发射方式 + * @enum shapeModule.ArcMode + */ const ArcMode = Enum({ + /** + * 随机位置发射 + * @property {Number} Random + */ Random: 0, + + /** + * 沿某一方向循环发射,每次循环方向相同 + * @property {Number} Loop + */ Loop: 1, + + /** + * 循环发射,每次循环方向相反 + * @property {Number} PingPong + */ PingPong: 2, }); @ccclass('cc.ShapeModule') export default class ShapeModule { + /** + * 是否启用 + */ @property({ displayOrder: 0, }) public enable = false; + /** + * 粒子发射器类型 + */ @property({ type: ShapeType, displayOrder: 1, }) public shapeType = ShapeType.Box; + /** + * 粒子从发射器哪个部位发射 + */ @property({ type: EmitLocation, displayOrder: 2, @@ -55,6 +133,9 @@ export default class ShapeModule { @property private _position = new Vec3(0, 0, 0); + /** + * 粒子发射器位置 + */ @property({ displayOrder: 12, }) @@ -69,6 +150,9 @@ export default class ShapeModule { @property private _rotation = new Vec3(0, 0, 0); + /** + * 粒子发射器旋转角度 + */ @property({ displayOrder: 13, }) @@ -83,6 +167,9 @@ export default class ShapeModule { @property private _scale = new Vec3(1, 1, 1); + /** + * 粒子发射器缩放比例 + */ @property({ displayOrder: 14, }) @@ -94,31 +181,52 @@ export default class ShapeModule { this.constructMat(); } + /** + * 根据粒子的初始方向决定粒子的移动方向 + */ @property({ displayOrder: 15, }) public alignToDirection = false; + /** + * 粒子生成方向随机设定 + */ @property({ displayOrder: 16, }) public randomDirectionAmount = 0; + /** + * 表示当前发射方向与当前位置到结点中心连线方向的插值 + */ @property({ displayOrder: 17, }) public sphericalDirectionAmount = 0; + /** + * 粒子生成位置随机设定(设定此值为非 0 会使粒子生成位置超出生成器大小范围) + */ @property({ displayOrder: 18, }) public randomPositionAmount = 0; + /** + * 粒子发射器半径 + */ @property({ displayOrder: 3, }) public radius = 1; + /** + * 粒子发射器发射位置(对 Box 类型的发射器无效) + * 0 表示从表面发射 + * 1 表示从中心发射 + * 0 ~ 1 之间表示在中心到表面之间发射 + */ @property({ displayOrder: 4, }) @@ -127,6 +235,9 @@ export default class ShapeModule { @property private _arc = toRadian(360); + /** + * 粒子发射器在一个扇形范围内发射 + */ @property({ displayOrder: 6, }) @@ -138,17 +249,26 @@ export default class ShapeModule { this._arc = toRadian(val); } + /** + * 粒子在扇形范围内的发射方式 + */ @property({ type: ArcMode, displayOrder: 7, }) public arcMode = ArcMode.Random; + /** + * 控制可能产生粒子的弧周围的离散间隔。 + */ @property({ displayOrder: 0, }) public arcSpread = 8; + /** + * 粒子沿圆周发射的速度 + */ @property({ type: CurveRange, displayOrder: 9, @@ -158,6 +278,10 @@ export default class ShapeModule { @property private _angle = toRadian(25); + /** + * 圆锥的轴与母线的夹角 + * 决定圆锥发射器的开合程度 + */ @property({ displayOrder: 5, }) @@ -169,11 +293,18 @@ export default class ShapeModule { this._angle = toRadian(val); } + /** + * 圆锥顶部截面距离底部的轴长 + * 决定圆锥发射器的高度 + */ @property({ displayOrder: 10, }) public length = 0; + /** + * 粒子发射器发射位置(针对 Box 类型的粒子发射器) + */ @property({ displayOrder: 11, }) diff --git a/cocos/3d/framework/particle/particle-system-component.ts b/cocos/3d/framework/particle/particle-system-component.ts index 944c7ece87..1c5473788a 100644 --- a/cocos/3d/framework/particle/particle-system-component.ts +++ b/cocos/3d/framework/particle/particle-system-component.ts @@ -33,6 +33,9 @@ export class ParticleSystemComponent extends Component { @property private _capacity = 100; + /** + * 粒子系统能生成的最大粒子数量 + */ @property({ displayOrder: 1, }) @@ -47,47 +50,71 @@ export class ParticleSystemComponent extends Component { } } + /** + * 粒子初始颜色 + */ @property({ type: GradientRange, displayOrder: 8, }) public startColor = new GradientRange(); + /** + * 粒子初始大小 + */ @property({ type: CurveRange, displayOrder: 9, }) public startSize = new CurveRange(); + /** + * 粒子初始速度 + */ @property({ type: CurveRange, displayOrder: 10, }) public startSpeed = new CurveRange(); + /** + * 粒子初始旋转角度 + */ @property({ type: CurveRange, displayOrder: 11, }) public startRotation = new CurveRange(); + /** + * 粒子系统开始运行后,延迟粒子发射的时间 + */ @property({ type: CurveRange, displayOrder: 6, }) public startDelay = new CurveRange(); + /** + * 粒子生命周期 + */ @property({ type: CurveRange, displayOrder: 7, }) public startLifetime = new CurveRange(); + /** + * 粒子系统运行时间 + */ @property({ displayOrder: 0, }) public duration = 5.0; + /** + * 粒子系统是否循环播放 + */ @property({ displayOrder: 2, }) @@ -96,6 +123,9 @@ export class ParticleSystemComponent extends Component { @property private _prewarm = false; + /** + * 选中之后,粒子系统会以已播放完一轮之后的状态开始播放(仅当循环播放启用时有效) + */ @property({ displayOrder: 3, }) @@ -113,6 +143,12 @@ export class ParticleSystemComponent extends Component { @property private _simulationSpace = Space.Local; + /** + * 选择粒子系统所在的坐标系
+ * 世界坐标(不随其他物体位置改变而变换)
+ * 局部坐标(跟随父节点位置改变而移动)
+ * 自定坐标(跟随自定义节点的位置改变而移动) + */ @property({ type: Space, displayOrder: 4, @@ -128,16 +164,25 @@ export class ParticleSystemComponent extends Component { } } + /** + * 控制整个粒子系统的更新速度 + */ @property({ displayOrder: 5, }) public simulationSpeed = 1.0; + /** + * 粒子系统加载后是否自动开始播放 + */ @property({ displayOrder: 2, }) public playOnAwake = true; + /** + * 粒子受重力影响的重力系数 + */ @property({ type: CurveRange, displayOrder: 12, @@ -145,18 +190,27 @@ export class ParticleSystemComponent extends Component { public gravityModifier = new CurveRange(); // emission module + /** + * 每秒发射的粒子数 + */ @property({ type: CurveRange, displayOrder: 13, }) public rateOverTime = new CurveRange(); + /** + * 每移动单位距离发射的粒子数 + */ @property({ type: CurveRange, displayOrder: 14, }) public rateOverDistance = new CurveRange(); + /** + * 设定在指定时间发射指定数量的粒子的 Brust 的数量 + */ @property({ type: [Burst], displayOrder: 15, @@ -164,48 +218,75 @@ export class ParticleSystemComponent extends Component { public bursts = new Array(); // color over lifetime module + /** + * 颜色控制模块 + */ @property({ type: ColorOverLifetimeModule, }) public colorOverLifetimeModule = new ColorOverLifetimeModule(); // shpae module + /** + * 粒子发射器模块 + */ @property({ type: ShapeModule, }) public shapeModule = new ShapeModule(); // size over lifetime module + /** + * 粒子大小模块 + */ @property({ type: SizeOvertimeModule, }) public sizeOvertimeModule = new SizeOvertimeModule(); + /** + * 粒子速度模块 + */ @property({ type: VelocityOvertimeModule, }) public velocityOvertimeModule = new VelocityOvertimeModule(); + /** + * 粒子加速度模块 + */ @property({ type: ForceOvertimeModule, }) public forceOvertimeModule = new ForceOvertimeModule(); + /** + * 粒子限制速度模块(只支持 CPU 粒子) + */ @property({ type: LimitVelocityOvertimeModule, }) public limitVelocityOvertimeModule = new LimitVelocityOvertimeModule(); + /** + * 粒子旋转模块 + */ @property({ type: RotationOvertimeModule, }) public rotationOvertimeModule = new RotationOvertimeModule(); + /** + * 贴图动画模块 + */ @property({ type: TextureAnimationModule, }) public textureAnimationModule = new TextureAnimationModule(); + /** + * 粒子轨迹模块 + */ @property({ type: TrailModule, }) @@ -291,6 +372,9 @@ export class ParticleSystemComponent extends Component { // } + /** + * 播放粒子效果 + */ public play () { if (this._isPaused) { this._isPaused = false; @@ -307,6 +391,9 @@ export class ParticleSystemComponent extends Component { } } + /** + * 暂停播放粒子效果 + */ public pause () { if (this._isStopped) { console.warn('pause(): particle system is already stopped.'); @@ -319,6 +406,9 @@ export class ParticleSystemComponent extends Component { this._isPaused = true; } + /** + * 停止播放粒子 + */ public stop () { if (this._isPlaying) { this._isPlaying = false; @@ -336,6 +426,9 @@ export class ParticleSystemComponent extends Component { } // remove all particles from current particle system. + /** + * 将所有粒子从粒子系统中清除 + */ public clear () { this.renderer!.clear(); } diff --git a/cocos/3d/framework/particle/renderer/particle-system-renderer.ts b/cocos/3d/framework/particle/renderer/particle-system-renderer.ts index 7ce31d7ed9..994b3886ec 100644 --- a/cocos/3d/framework/particle/renderer/particle-system-renderer.ts +++ b/cocos/3d/framework/particle/renderer/particle-system-renderer.ts @@ -27,11 +27,35 @@ const _uvs = [ 1, 1, // top-right ]; +/** + * 粒子的生成模式 + * @enum ParticleSystemRenderer.RenderMode + */ const RenderMode = Enum({ + + /** + * 粒子始终面向摄像机 + */ Billboard: 0, + + /** + * 粒子始终面向摄像机但会根据参数进行拉伸 + */ StrecthedBillboard: 1, + + /** + * 粒子始终与 XZ 平面平行 + */ HorizontalBillboard: 2, + + /** + * 粒子始终与 Y 轴平行且朝向摄像机 + */ VerticalBillboard: 3, + + /** + * 粒子保持模型本身状态 + */ Mesh: 4, }); @@ -71,6 +95,9 @@ const _vertex_attrs_mesh = [ @executeInEditMode export default class ParticleSystemRenderer extends RenderableComponent { + /** + * 设定粒子生成模式 + */ @property({ type: RenderMode, displayOrder: 0, @@ -89,6 +116,9 @@ export default class ParticleSystemRenderer extends RenderableComponent { this._updateModel(); } + /** + * 在粒子生成方式为 StrecthedBillboard 时,对粒子在运动方向上按速度大小进行拉伸 + */ @property({ displayOrder: 1, }) @@ -102,6 +132,9 @@ export default class ParticleSystemRenderer extends RenderableComponent { // this._updateModel(); } + /** + * 在粒子生成方式为 StrecthedBillboard 时,对粒子在运动方向上按粒子大小进行拉伸 + */ @property({ displayOrder: 2, }) @@ -129,6 +162,9 @@ export default class ParticleSystemRenderer extends RenderableComponent { @property private _mesh: Mesh | null = null; + /** + * 粒子模型 + */ @property({ type: Mesh, }) diff --git a/cocos/3d/framework/particle/renderer/trail.ts b/cocos/3d/framework/particle/renderer/trail.ts index 26291a17db..aca7ba7101 100644 --- a/cocos/3d/framework/particle/renderer/trail.ts +++ b/cocos/3d/framework/particle/renderer/trail.ts @@ -18,13 +18,37 @@ const NEXT_TRIANGLE_INDEX = 1 << 2; const _temp_trailEle = {} as ITrailElement; +/** + * 选择如何为粒子系统生成轨迹 + * @enum trailModule.TrailMode + */ const TrailMode = Enum({ + /** + * 粒子模式 + * 创建一种效果,其中每个粒子在其路径中留下固定的轨迹 + */ Particles: 0, + + /** + * 带模式 + * 根据其生命周期创建连接每个粒子的轨迹带 + */ Ribbon: 1, }); +/** + * 纹理填充模式 + * @enum trailModule.TextureMode + */ const TextureMode = Enum({ + /** + * 拉伸填充纹理 + */ Stretch: 0, + + /** + * 重复填充纹理 + */ Repeat: 1, }); @@ -102,6 +126,9 @@ class TrailSegment { @ccclass('cc.TrailModule') export default class TrailModule { + /** + * 是否启用 + */ @property({ displayOrder: 0, }) @@ -124,23 +151,35 @@ export default class TrailModule { }) public _enable = false; + /** + * 设定粒子生成轨迹的方式 + */ @property({ type: TrailMode, displayOrder: 2, }) public mode = TrailMode.Particles; + /** + * 设定粒子中生成轨迹的比例 + */ @property({ displayOrder: 3, }) public ratio = 1; + /** + * 轨迹存在的生命周期 + */ @property({ type: CurveRange, displayOrder: 4, }) public lifeTime = new CurveRange(); + /** + * 每个轨迹粒子之间的最小间距 + */ public get minParticleDistance () { return this._minParticleDistance; } @@ -155,23 +194,35 @@ export default class TrailModule { }) public _minParticleDistance = 0.1; + /** + * 轨迹设定时的坐标系 + */ @property({ type: Space, displayOrder: 6, }) public space = Space.World; + /** + * 粒子本身是否存在 + */ @property({ displayOrder: 7, }) public existWithParticles = true; + /** + * 设定纹理填充方式 + */ @property({ type: TextureMode, displayOrder: 8, }) public textureMode = TextureMode.Stretch; + /** + * 控制轨迹长度的曲线 + */ @property({ type: CurveRange, displayOrder: 9,