3.6.1 trail buffer insufficient space fix (#12567)

* enlarge trail buffer

* add warning information

* use warn id instead
This commit is contained in:
zxx43
2022-09-01 23:49:17 +08:00
committed by GitHub
parent c52128b5fb
commit d8f09ea57d
2 changed files with 9 additions and 1 deletions
+4
View File
@@ -2471,6 +2471,10 @@ cc.ParticleSystem: shouldn't be initialized repetitively, otherwise there will b
cc.ParticleSystem: change material failed, please use proper particle material
### 6036
cc.ParticleSystem: life time should bigger than 1 or buffer will be insufficient
### 6100
<!-- DEPRECATED -->
+5 -1
View File
@@ -38,6 +38,7 @@ import { Space, TextureMode, TrailMode } from '../enum';
import { Particle } from '../particle';
import { legacyCC } from '../../core/global-exports';
import { TransformBit } from '../../core/scene-graph/node-enum';
import { warnID } from '../../core';
const PRE_TRIANGLE_INDEX = 1;
const NEXT_TRIANGLE_INDEX = 1 << 2;
@@ -368,7 +369,10 @@ export default class TrailModule {
const b = ps.bursts[i];
burstCount += b.getMaxCount(ps) * Math.ceil(psTime / duration);
}
this._trailNum = Math.ceil(psTime * this.lifeTime.getMax() * 60 * (psRate * duration + burstCount));
if (this.lifeTime.getMax() < 1.0) {
warnID(6036);
}
this._trailNum = Math.ceil(psTime * Math.ceil(this.lifeTime.getMax()) * 60 * (psRate * duration + burstCount));
this._trailSegments = new Pool(() => new TrailSegment(10), Math.ceil(psRate * duration), (obj: TrailSegment) => obj.trailElements.length = 0);
if (this._enable) {
this.enable = this._enable;