模块化粒子系统:点/圆/矩形发射形状、重力、阻力、初速度,以及生命周期/大小/颜色/旋转修改器。
仓库:github.com/dekiengine/deki-particles · 最新版本:0.19.0 · 需要引擎 0.19.0 或更高版本 · 依赖:deki-nodegraph, deki-rendering, deki-2d
使用 DekiEditor --packages-add deki-particles <project> 或通过包管理器安装。引擎自身的组件和 C++ API 见 Deki 文档。
在编辑器中显示为 **Particles**。
组件
功能开关
可以从构建中去掉的部分。带有 define 的功能通过该 define 开关,其余的随其组件一起被剥离。
| 功能 | define | 默认值 |
| Particle Emitter | DEKI_FEATURE_PARTICLE_EMITTER | 开 |
组件参考
ParticleEmitterComponent
按照粒子图资源生成并绘制粒子。
检视器中的名称:粒子发射器组件 · 类别:粒子 · 类型:DekiParticles::ParticleEmitterComponent
| 属性 | 类型 | 默认值 | 约束 | 说明 |
| sprite | AssetRef (Sprite) | "" | | 为每个粒子绘制的图像。小而柔和的精灵可以掩盖设备所能承受的较少粒子数。 |
| graph | AssetRef (ParticleGraph) | "" | | 粒子图资源,用于编写发射、速度以及随生命周期变化的大小和颜色。 |
| maxParticles | int32 | 64 | 0 到 4096 | 同时存活的粒子数上限。粒子池按此大小一次性分配,因此它既关乎视觉效果,也关乎内存。 |
| playOnAwake | bool | true | | 对象一激活就开始发射。关闭时需要由其他东西来启动它。 |
| looping | bool | true | | 效果结束时重新开始而不是停止。关闭时只播放一次便停止。 |
| worldSpace | bool | true | | 发射器移动时,粒子留在其生成的位置。关闭时粒子随发射器一起移动,适合角色手持的火焰,而不适合角色身后留下的烟雾。 |
| seed | int32 | 0 | 0 到 2.14748e+09 | 随机种子。0 表示每次运行图案都不同;其他任何值每次都播放相同的图案,便于渲染测试进行比较。 |
从 RendererComponent 继承 sortingOrder, ignoreClip, pixelSnap, alphaMode。
更新日志
更新日志为英文。
0.19.0
Changed
- minEngine 0.19.0: built against engine 0.19.0, whose component metadata records the package each class is in. A build of this package from before does not load and is rebuilt.
Added
- Japanese, Simplified Chinese and Korean: editor/lang/ja.json, zh.json and ko.json translate the names, tooltips and enum values this package's components show in the Inspector.
- The package's editor text goes through the editor's translation (Tr), so it shows in the editor's language. Needs the editor release that adds Localization.h; raise minEngine to it when releasing.
0.18.2
Added
- seed on the Particle Emitter. 0 gives a different pattern each run, as before; any other value plays the same pattern every time, so renders of the effect can be compared.
Fixed
- Effects play on a device. The effect asset's loader and the built-in modifiers registered themselves from static objects in files nothing else referenced, and a firmware links the game from an archive, so the linker dropped them: every emitter had no effect to play and drew nothing, with no error. They are registered by DekiParticlesInitSystem() now (PACKAGE_HAS_SYSTEM_INIT), as deki-fsm does.
- Particles are drawn the right way up. A particle that moved up in the world was drawn moving down, so a fountain sprayed toward the ground.
更早的版本:CHANGELOG.md
由包的反射数据生成(引擎 0.19.0)。属性名就是场景文件中使用的键。重命名后会保留别名(兼容性)。