当前位置:   article > 正文

Laya 2.5引擎循环播放的粒子特效闪烁问题解决方案_laya粒子持续发射

laya粒子持续发射

临时解决方案: 替换 laya.d3.js 库中刷新粒子的两个方法

_retireActiveParticles() {
const epsilon = 0.0001;
while (this._firstActiveElement != this._firstNewElement) {
var m = this.maxParticles == 1 ? 4 : 1;
var index = this._firstActiveElement * this._floatCountPerVertex * this._vertexStride * m;
var timeIndex = index + this._timeIndex;
var particleAge = this._currentTime - this._vertices[timeIndex];
if (particleAge + epsilon < this._vertices[index + this._startLifeTimeIndex])
break;
this._vertices[timeIndex] = this._drawCounter;
this._firstActiveElement++;
if (this._firstActiveElement >= this._bufferMaxParticles)
this._firstActiveElement = 0;
if(this.maxParticles == 1){
this._firstNewElement = 0;
this._firstFreeElement = 0;
}
}
}
_freeRetiredParticles() {
while (this._firstRetiredElement != this._firstActiveElement) {
var m = this.maxParticles == 1 ? 4 : 1;
var age = this._drawCounter - this._vertices[this._firstRetiredElement * this._floatCountPerVertex * this._vertexStride * m + this._timeIndex];
if (this.isPerformanceMode)
if (age < 3)
break;
this._firstRetiredElement++;
if (this._firstRetiredElement >= this._bufferMaxParticles)
this._firstRetiredElement = 0;
}
}

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/喵喵爱编程/article/detail/881953
推荐阅读
相关标签
  

闽ICP备14008679号