UNPKG

1.78 kBJavaScriptView Raw
1import { Material } from './Material.js';
2import { Vector3 } from '../math/Vector3.js';
3
4/**
5 * @author WestLangley / http://github.com/WestLangley
6 *
7 * parameters = {
8 *
9 * referencePosition: <float>,
10 * nearDistance: <float>,
11 * farDistance: <float>,
12 *
13 * skinning: <bool>,
14 * morphTargets: <bool>,
15 *
16 * map: new THREE.Texture( <Image> ),
17 *
18 * alphaMap: new THREE.Texture( <Image> ),
19 *
20 * displacementMap: new THREE.Texture( <Image> ),
21 * displacementScale: <float>,
22 * displacementBias: <float>
23 *
24 * }
25 */
26
27function MeshDistanceMaterial( parameters ) {
28
29 Material.call( this );
30
31 this.type = 'MeshDistanceMaterial';
32
33 this.referencePosition = new Vector3();
34 this.nearDistance = 1;
35 this.farDistance = 1000;
36
37 this.skinning = false;
38 this.morphTargets = false;
39
40 this.map = null;
41
42 this.alphaMap = null;
43
44 this.displacementMap = null;
45 this.displacementScale = 1;
46 this.displacementBias = 0;
47
48 this.fog = false;
49 this.lights = false;
50
51 this.setValues( parameters );
52
53}
54
55MeshDistanceMaterial.prototype = Object.create( Material.prototype );
56MeshDistanceMaterial.prototype.constructor = MeshDistanceMaterial;
57
58MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true;
59
60MeshDistanceMaterial.prototype.copy = function ( source ) {
61
62 Material.prototype.copy.call( this, source );
63
64 this.referencePosition.copy( source.referencePosition );
65 this.nearDistance = source.nearDistance;
66 this.farDistance = source.farDistance;
67
68 this.skinning = source.skinning;
69 this.morphTargets = source.morphTargets;
70
71 this.map = source.map;
72
73 this.alphaMap = source.alphaMap;
74
75 this.displacementMap = source.displacementMap;
76 this.displacementScale = source.displacementScale;
77 this.displacementBias = source.displacementBias;
78
79 return this;
80
81};
82
83
84export { MeshDistanceMaterial };