粒子为什么不能合批?


如图,可以渲染3Dmesh,图中是一个锥体

这东西要一整个加进uiRendererManager,肯定拖垮性能,也就用一下2D

ParticleSystem2D本来就是继承UIRenderer的,UIRendererManager.updateAllDirtyRendderer()会用到Batcher2D类的一个commitComp方法,里面

if (this._currHash !== dataHash || dataHash === 0 || this._currMaterial !== mat
|| this._currDepthStencilStateStage !== depthStencilStateStage) {

是来检测是否支持批的,然后2d粒子系统和Sprite组件的tiled填充模式,我试了都是不支持 :upside_down_face:

image
particleSystem继承的是renderer,刚搜了一下,它本身就是一个component,可以直接挂载,所以Particle类是有其他用处。

image
image

我研究的是ParticleSystem2D :thinking:

image
忽略了,还有个2D,这个可以直接加进uiRendererManager

到底怎么加呀,你给我加加看 :upside_down_face:

:thinking:

可能是要取消粒子的自动模拟,改为手动模拟,并且把所有粒子当作同一个粒子进行计算和渲染。

源码中一个particlesystem一个pool,把多个pool合并,就可以合批了

继承particlesystem,开放simulator的获取,然后对pool进行合并

image
这个接口预留了,应该是为了实现合批

这必须仿照物理系统的写法,写一个实例系统,还得自动运行。