PointCloudMaterial.js 1.7 KB
Newer Older
N
Nicolas Garcia Belmonte 已提交
1
/**
M
Mr.doob 已提交
2
 * @author mrdoob / http://mrdoob.com/
3
 * @author alteredq / http://alteredqualia.com/
4 5 6 7
 *
 * parameters = {
 *  color: <hex>,
 *  opacity: <float>,
8
 *  map: new THREE.Texture( <Image> ),
9
 *
10
 *  size: <float>,
G
Gibran Garcia 已提交
11
 *  sizeAttenuation: <bool>,
12
 *
13
 *  blending: THREE.NormalBlending,
14
 *  depthTest: <bool>,
15
 *  depthWrite: <bool>,
16 17 18 19
 *
 *  vertexColors: <bool>,
 *
 *  fog: <bool>
20
 * }
N
Nicolas Garcia Belmonte 已提交
21 22
 */

23
THREE.PointCloudMaterial = function ( parameters ) {
N
Nicolas Garcia Belmonte 已提交
24

M
Mr.doob 已提交
25
	THREE.Material.call( this );
26

27 28
	this.type = 'PointCloudMaterial';

M
Mr.doob 已提交
29
	this.color = new THREE.Color( 0xffffff );
30

M
Mr.doob 已提交
31
	this.map = null;
32

M
Mr.doob 已提交
33 34
	this.size = 1;
	this.sizeAttenuation = true;
35

36
	this.vertexColors = THREE.NoColors;
37

M
Mr.doob 已提交
38
	this.fog = true;
N
Nicolas Garcia Belmonte 已提交
39

M
Mr.doob 已提交
40
	this.setValues( parameters );
41

N
Nicolas Garcia Belmonte 已提交
42
};
43

44
THREE.PointCloudMaterial.prototype = Object.create( THREE.Material.prototype );
45
THREE.PointCloudMaterial.prototype.constructor = THREE.PointCloudMaterial;
L
libra guest 已提交
46

47
THREE.PointCloudMaterial.prototype.clone = function () {
M
Mr.doob 已提交
48

49
	var material = new THREE.PointCloudMaterial();
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

	THREE.Material.prototype.clone.call( this, material );

	material.color.copy( this.color );

	material.map = this.map;

	material.size = this.size;
	material.sizeAttenuation = this.sizeAttenuation;

	material.vertexColors = this.vertexColors;

	material.fog = this.fog;

	return material;
M
Mr.doob 已提交
65 66

};
67 68 69

// backwards compatibility

70 71 72 73 74 75 76
THREE.ParticleBasicMaterial = function ( parameters ) {

	console.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial.' );
	return new THREE.PointCloudMaterial( parameters );

};

77 78
THREE.ParticleSystemMaterial = function ( parameters ) {

79
	console.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial.' );
80
	return new THREE.PointCloudMaterial( parameters );
81

82
};