fireball/lib/materials/SpriteMaterial.js

56 lines
1.0 KiB
JavaScript
Raw Normal View History

2018-12-25 13:59:22 +00:00
import { Material } from './Material.js';
import { Color } from '../math/Color.js';
/**
* @author alteredq / http://alteredqualia.com/
*
* parameters = {
* color: <hex>,
* map: new THREE.Texture( <Image> ),
* rotation: <float>,
* sizeAttenuation: <bool>
* }
*/
function SpriteMaterial( parameters ) {
Material.call( this );
this.type = 'SpriteMaterial';
this.color = new Color( 0xffffff );
this.map = null;
this.rotation = 0;
this.sizeAttenuation = true;
this.lights = false;
this.transparent = true;
this.setValues( parameters );
}
SpriteMaterial.prototype = Object.create( Material.prototype );
SpriteMaterial.prototype.constructor = SpriteMaterial;
SpriteMaterial.prototype.isSpriteMaterial = true;
SpriteMaterial.prototype.copy = function ( source ) {
Material.prototype.copy.call( this, source );
this.color.copy( source.color );
this.map = source.map;
this.rotation = source.rotation;
this.sizeAttenuation = source.sizeAttenuation;
return this;
};
export { SpriteMaterial };