forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShadowMaterial.js
52 lines (41 loc) · 1.1 KB
/
ShadowMaterial.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { ShaderMaterial } from './ShaderMaterial';
import { ShaderChunk } from '../renderers/shaders/ShaderChunk';
import { UniformsLib } from '../renderers/shaders/UniformsLib';
import { UniformsUtils } from '../renderers/shaders/UniformsUtils';
/**
* @author mrdoob / http://mrdoob.com/
*
* parameters = {
* opacity: <float>
* }
*/
function ShadowMaterial( parameters ) {
ShaderMaterial.call( this, {
uniforms: UniformsUtils.merge( [
UniformsLib.lights,
{
opacity: { value: 1.0 }
}
] ),
vertexShader: ShaderChunk[ 'shadow_vert' ],
fragmentShader: ShaderChunk[ 'shadow_frag' ]
} );
this.lights = true;
this.transparent = true;
Object.defineProperties( this, {
opacity: {
enumerable: true,
get: function () {
return this.uniforms.opacity.value;
},
set: function ( value ) {
this.uniforms.opacity.value = value;
}
}
} );
this.setValues( parameters );
}
ShadowMaterial.prototype = Object.create( ShaderMaterial.prototype );
ShadowMaterial.prototype.constructor = ShadowMaterial;
ShadowMaterial.prototype.isShadowMaterial = true;
export { ShadowMaterial };