|
@@ -21299,10 +21299,6 @@ class MeshDistanceMaterial extends Material {
|
|
|
|
|
|
this.type = 'MeshDistanceMaterial';
|
|
|
|
|
|
- this.referencePosition = new Vector3();
|
|
|
- this.nearDistance = 1;
|
|
|
- this.farDistance = 1000;
|
|
|
-
|
|
|
this.map = null;
|
|
|
|
|
|
this.alphaMap = null;
|
|
@@ -21319,10 +21315,6 @@ class MeshDistanceMaterial extends Material {
|
|
|
|
|
|
super.copy( source );
|
|
|
|
|
|
- this.referencePosition.copy( source.referencePosition );
|
|
|
- this.nearDistance = source.nearDistance;
|
|
|
- this.farDistance = source.farDistance;
|
|
|
-
|
|
|
this.map = source.map;
|
|
|
|
|
|
this.alphaMap = source.alphaMap;
|
|
@@ -21555,7 +21547,7 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- function getDepthMaterial( object, material, light, shadowCameraNear, shadowCameraFar, type ) {
|
|
|
+ function getDepthMaterial( object, material, light, type ) {
|
|
|
|
|
|
let result = null;
|
|
|
|
|
@@ -21633,9 +21625,8 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
|
|
|
if ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {
|
|
|
|
|
|
- result.referencePosition.setFromMatrixPosition( light.matrixWorld );
|
|
|
- result.nearDistance = shadowCameraNear;
|
|
|
- result.farDistance = shadowCameraFar;
|
|
|
+ const materialProperties = _renderer.properties.get( result );
|
|
|
+ materialProperties.light = light;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -21669,7 +21660,7 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
|
|
|
if ( groupMaterial && groupMaterial.visible ) {
|
|
|
|
|
|
- const depthMaterial = getDepthMaterial( object, groupMaterial, light, shadowCamera.near, shadowCamera.far, type );
|
|
|
+ const depthMaterial = getDepthMaterial( object, groupMaterial, light, type );
|
|
|
|
|
|
_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );
|
|
|
|
|
@@ -21679,7 +21670,7 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
|
|
|
} else if ( material.visible ) {
|
|
|
|
|
|
- const depthMaterial = getDepthMaterial( object, material, light, shadowCamera.near, shadowCamera.far, type );
|
|
|
+ const depthMaterial = getDepthMaterial( object, material, light, type );
|
|
|
|
|
|
_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );
|
|
|
|
|
@@ -27089,9 +27080,11 @@ function WebGLMaterials( renderer, properties ) {
|
|
|
|
|
|
function refreshUniformsDistance( uniforms, material ) {
|
|
|
|
|
|
- uniforms.referencePosition.value.copy( material.referencePosition );
|
|
|
- uniforms.nearDistance.value = material.nearDistance;
|
|
|
- uniforms.farDistance.value = material.farDistance;
|
|
|
+ const light = properties.get( material ).light;
|
|
|
+
|
|
|
+ uniforms.referencePosition.value.setFromMatrixPosition( light.matrixWorld );
|
|
|
+ uniforms.nearDistance.value = light.shadow.camera.near;
|
|
|
+ uniforms.farDistance.value = light.shadow.camera.far;
|
|
|
|
|
|
}
|
|
|
|