@realsee/five
Version:
Realsee Renderer SDK
74 lines (73 loc) • 2.63 kB
TypeScript
import * as THREE from 'three';
import { FivePass } from './pass';
import { type Camera } from '../../../core/camera';
export type FlowingFireworks3DPassLine = {
id?: string;
points: THREE.Vector3[];
totalLength: number;
color: THREE.Color;
opacity?: number;
tailLengthRatio?: number;
duration?: number;
startTime?: number;
particleCount?: number;
emissionRate?: number;
spread?: number;
particleSize?: number;
particleLife?: number;
gravity?: THREE.Vector3;
leadRatio?: number;
};
/**
* FlowingFireworks3DPass
*
* 与 FlowingLight3DPass 配套使用:在每条流光线条的「尾部位置」持续喷射出
* 烟花状向四周发散的粒子。粒子的运动周期、尾部位置计算与 FlowingLight3DPass
* 完全一致(共用 points / totalLength / duration / startTime / tailLengthRatio),
* 因此把本 Pass 与 FlowingLight3DPass 配置同样的线条数据即可获得「流光拖尾烟花」效果。
*/
export declare class FlowingFireworks3DPass extends FivePass {
private camera;
private points;
private material;
private uTime;
private lines;
private blocks;
private geometry;
private arrPosition;
private arrVelocity;
private arrAccel;
private arrColor;
private arrBirthTime;
private arrMaxLife;
private arrSeed;
private arrSize;
private particleScene;
private orthoCamera;
private particleRenderTarget;
private blendMaterial;
private blendQuad;
private _tmpTail;
constructor(camera: Camera);
/** 批量设置线条(替换现有全部线条) */
setLines(lines: FlowingFireworks3DPassLine[]): void;
/** 追加一条或多条线,返回生成的 id 数组 */
addLine(...lines: FlowingFireworks3DPassLine[]): string[];
/** 按 id 移除一条或多条线,返回实际移除的数量 */
removeLine(...ids: string[]): number;
/**
* 通过 id 修改单条线的参数(部分更新)。
* 大多数字段(points、color、totalLength、duration 等)会在下一帧发射时即时生效,
* 无需重建;仅当 particleCount 改变时才会重建粒子缓冲。
*/
setLine(params: {
id: string;
} & Partial<Omit<FlowingFireworks3DPassLine, 'id'>>): void;
private _rebuild;
private _samplePointAtLength;
private _emitParticle;
private _emit;
render(renderer: THREE.WebGLRenderer, writeBuffer: THREE.WebGLRenderTarget, readBuffer: THREE.WebGLRenderTarget, deltaTime: number, _maskActive?: boolean): void;
dispose(): void;
private _disposeParticles;
}