2019-01-28 19:39:59 +08:00

42 lines
857 B
JavaScript

/**
* 火焰
*/
function Fire(camera, options = {}) {
THREE.Object3D.call(this);
VolumetricFire.texturePath = 'assets/textures/VolumetricFire/';
var width = options.width || 2;
var height = options.height || 4;
var depth = options.depth || 2;
var sliceSpacing = options.sliceSpacing || 0.5;
var fire = new VolumetricFire(
width,
height,
depth,
sliceSpacing,
camera
);
this.add(fire.mesh);
fire.mesh.name = L_FIRE;
this.name = L_FIRE;
this.position.y = 2;
Object.assign(this.userData, {
type: 'Fire',
fire: fire,
width: width,
height: height,
depth: depth,
sliceSpacing: sliceSpacing
});
}
Fire.prototype = Object.create(THREE.Object3D.prototype);
Fire.prototype.constructor = Fire;
export default Fire;