我觉得是提示错了,拖尾声明周期越长,self._trailNum 越大,buffer 才会不够。
const indexBuffer = device.createBuffer(new BufferInfo(
BufferUsageBit.INDEX | BufferUsageBit.TRANSFER_DST,
MemoryUsageBit.HOST | MemoryUsageBit.DEVICE,
Math.max(1, self._trailNum) * 6 * Uint16Array.BYTES_PER_ELEMENT,
Uint16Array.BYTES_PER_ELEMENT,
));
self._iBuffer = new Uint16Array(Math.max(1, self._trailNum) * 6);
indexBuffer.update(self._iBuffer);
trail.ts 的update:
public update (): void {
//evaluate 传的要求是归一化的时间,而this._particleSystem!.time 根本没归一化
this._trailLifetime = this.lifeTime.evaluate(this._particleSystem!.time, 1)!;
if (this.space === ParticleSpace.World && this._particleSystem!.simulationSpace === ParticleSpace.Local) {
this._needTransform = true;
this._particleSystem!.node.getWorldMatrix(this._psTransform);
this._particleSystem!.node.getWorldRotation(_temp_quat);
} else {
this._needTransform = false;
}
}