1
- import { Color , Vector2 , Vector3 , type Texture } from 'three'
1
+ import { Color , Vector2 , Vector3 , type Texture , UniformsLib , UniformsUtils } from 'three'
2
2
import { shaderMaterial } from '../core/shaderMaterial'
3
3
import { version } from '../helpers/constants'
4
4
@@ -37,10 +37,15 @@ export const SpotLightMaterial = shaderMaterial<SpotLightMaterialProps>(
37
37
uniform vec3 spotPosition;
38
38
uniform float attenuation;
39
39
40
+ #include <fog_pars_vertex>
40
41
#include <common>
41
42
#include <logdepthbuf_pars_vertex>
42
-
43
+
43
44
void main() {
45
+ #include <begin_vertex>
46
+ #include <project_vertex>
47
+ #include <fog_vertex>
48
+
44
49
// compute intensity
45
50
vNormal = normalize(normalMatrix * normal);
46
51
vec4 worldPosition = modelMatrix * vec4(position, 1);
@@ -66,6 +71,7 @@ export const SpotLightMaterial = shaderMaterial<SpotLightMaterialProps>(
66
71
uniform float cameraFar;
67
72
uniform float opacity;
68
73
74
+ #include <fog_pars_fragment>
69
75
#include <packing>
70
76
#include <logdepthbuf_pars_fragment>
71
77
@@ -100,5 +106,9 @@ export const SpotLightMaterial = shaderMaterial<SpotLightMaterialProps>(
100
106
101
107
#include <tonemapping_fragment>
102
108
#include <${ version >= 154 ? 'colorspace_fragment' : 'encodings_fragment' } >
103
- }`
109
+ #include <fog_fragment>
110
+ }` ,
111
+ ( material ) => {
112
+ Object . assign ( material . uniforms , UniformsUtils . merge ( [ UniformsLib [ 'fog' ] ] ) )
113
+ }
104
114
)
0 commit comments