Browse Source

Fix uniforms to support fog

Fixed uniforms of conditionalEdgeMaterial to support fog.
I think this is a bug, because its VertShader and FragShader are already support fog.
lk-lkaz 4 years ago
parent
commit
10710ebf2c
1 changed files with 13 additions and 7 deletions
  1. 13 7
      examples/jsm/loaders/LDrawLoader.js

+ 13 - 7
examples/jsm/loaders/LDrawLoader.js

@@ -13,6 +13,8 @@ import {
 	MeshPhongMaterial,
 	MeshPhongMaterial,
 	MeshStandardMaterial,
 	MeshStandardMaterial,
 	ShaderMaterial,
 	ShaderMaterial,
+	UniformsLib,
+	UniformsUtils,
 	Vector3
 	Vector3
 } from '../../../build/three.module.js';
 } from '../../../build/three.module.js';
 
 
@@ -1016,14 +1018,18 @@ var LDrawLoader = ( function () {
 				edgeMaterial.userData.conditionalEdgeMaterial = new ShaderMaterial( {
 				edgeMaterial.userData.conditionalEdgeMaterial = new ShaderMaterial( {
 					vertexShader: conditionalLineVertShader,
 					vertexShader: conditionalLineVertShader,
 					fragmentShader: conditionalLineFragShader,
 					fragmentShader: conditionalLineFragShader,
-					uniforms: {
-						diffuse: {
-							value: new Color( edgeColour )
-						},
-						opacity: {
-							value: alpha
+					uniforms: UniformsUtils.merge( [
+						UniformsLib.fog,
+						{
+							diffuse: {
+								value: new Color( edgeColour )
+							},
+							opacity: {
+								value: alpha
+							}
 						}
 						}
-					},
+					] ),
+					fog: true,
 					transparent: isTransparent,
 					transparent: isTransparent,
 					depthWrite: ! isTransparent
 					depthWrite: ! isTransparent
 				} );
 				} );