Skip to content

Commit

Permalink
use EXT_frag_depth for depth sensing
Browse files Browse the repository at this point in the history
  • Loading branch information
cabanier committed Jan 18, 2024
1 parent 7be54b5 commit fad7c39
Show file tree
Hide file tree
Showing 28 changed files with 80 additions and 255 deletions.
4 changes: 0 additions & 4 deletions src/materials/LineBasicMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ class LineBasicMaterial extends Material {

this.fog = true;

this.occlusion = true;

this.setValues( parameters );

}
Expand All @@ -42,8 +40,6 @@ class LineBasicMaterial extends Material {

this.fog = source.fog;

this.occlusion = source.occlusion;

return this;

}
Expand Down
4 changes: 0 additions & 4 deletions src/materials/MeshBasicMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class MeshBasicMaterial extends Material {

this.fog = true;

this.occlusion = true;

this.setValues( parameters );

}
Expand Down Expand Up @@ -74,8 +72,6 @@ class MeshBasicMaterial extends Material {

this.fog = source.fog;

this.occlusion = source.occlusion;

return this;

}
Expand Down
4 changes: 0 additions & 4 deletions src/materials/MeshLambertMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ class MeshLambertMaterial extends Material {

this.fog = true;

this.occlusion = true;

this.setValues( parameters );

}
Expand Down Expand Up @@ -109,8 +107,6 @@ class MeshLambertMaterial extends Material {

this.fog = source.fog;

this.occlusion = source.occlusion;

return this;

}
Expand Down
4 changes: 0 additions & 4 deletions src/materials/MeshMatcapMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class MeshMatcapMaterial extends Material {

this.fog = true;

this.occlusion = true;

this.setValues( parameters );

}
Expand Down Expand Up @@ -74,8 +72,6 @@ class MeshMatcapMaterial extends Material {

this.fog = source.fog;

this.occlusion = source.occlusion;

return this;

}
Expand Down
4 changes: 0 additions & 4 deletions src/materials/MeshPhongMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ class MeshPhongMaterial extends Material {

this.fog = true;

this.occlusion = true;

this.setValues( parameters );

}
Expand Down Expand Up @@ -113,8 +111,6 @@ class MeshPhongMaterial extends Material {

this.fog = source.fog;

this.occlusion = source.occlusion;

return this;

}
Expand Down
4 changes: 0 additions & 4 deletions src/materials/MeshStandardMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ class MeshStandardMaterial extends Material {

this.fog = true;

this.occlusion = true;

this.setValues( parameters );

}
Expand Down Expand Up @@ -117,8 +115,6 @@ class MeshStandardMaterial extends Material {

this.fog = source.fog;

this.occlusion = source.occlusion;

return this;

}
Expand Down
4 changes: 0 additions & 4 deletions src/materials/MeshToonMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ class MeshToonMaterial extends Material {

this.fog = true;

this.occlusion = true;

this.setValues( parameters );

}
Expand Down Expand Up @@ -95,8 +93,6 @@ class MeshToonMaterial extends Material {

this.fog = source.fog;

this.occlusion = source.occlusion;

return this;

}
Expand Down
4 changes: 0 additions & 4 deletions src/materials/PointsMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class PointsMaterial extends Material {

this.fog = true;

this.occlusion = true;

this.setValues( parameters );

}
Expand All @@ -43,8 +41,6 @@ class PointsMaterial extends Material {

this.fog = source.fog;

this.occlusion = source.occlusion;

return this;

}
Expand Down
2 changes: 0 additions & 2 deletions src/materials/ShaderMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ class ShaderMaterial extends Material {
this.lights = source.lights;
this.clipping = source.clipping;

this.occlusion = source.occlusion;

this.extensions = Object.assign( {}, source.extensions );

this.glslVersion = source.glslVersion;
Expand Down
33 changes: 6 additions & 27 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ class WebGLRenderer {
const _vector3 = new Vector3();

const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
let _occlusion = null;

function getTargetPixelRatio() {

Expand Down Expand Up @@ -416,20 +415,6 @@ class WebGLRenderer {

};

this.setOcclusion = function ( value ) {

if ( value === undefined ) return;

_occlusion = value;

};

this.clearOcclusion = function () {

_occlusion = null;

};

this.getSize = function ( target ) {

return target.set( _width, _height );
Expand Down Expand Up @@ -1224,7 +1209,11 @@ class WebGLRenderer {

//

background.render( currentRenderList, scene );
if ( xr.enabled === false || xr.isPresenting === false || xr.hasOcclusion() === false ) {

background.render( currentRenderList, scene );

}

// render scene

Expand Down Expand Up @@ -1615,7 +1604,7 @@ class WebGLRenderer {

const lightsStateVersion = lights.state.version;

const parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object, _occlusion );
const parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object );
const programCacheKey = programCache.getProgramCacheKey( parameters );

let programs = materialProperties.programs;
Expand Down Expand Up @@ -1855,10 +1844,6 @@ class WebGLRenderer {

needsProgramChange = true;

} else if ( material.occlusion === true ) {

needsProgramChange = true;

} else if ( materialProperties.numClippingPlanes !== undefined &&
( materialProperties.numClippingPlanes !== clipping.numPlanes ||
materialProperties.numIntersection !== clipping.numIntersection ) ) {
Expand Down Expand Up @@ -2073,12 +2058,6 @@ class WebGLRenderer {

}

if ( _occlusion && material.occlusion === true ) {

materials.refreshOcclusionUniforms( m_uniforms, _occlusion );

}

materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget );

WebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );
Expand Down
4 changes: 0 additions & 4 deletions src/renderers/shaders/ShaderChunk.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ import normal_pars_fragment from './ShaderChunk/normal_pars_fragment.glsl.js';
import normal_pars_vertex from './ShaderChunk/normal_pars_vertex.glsl.js';
import normal_vertex from './ShaderChunk/normal_vertex.glsl.js';
import normalmap_pars_fragment from './ShaderChunk/normalmap_pars_fragment.glsl.js';
import occlusion_fragment from './ShaderChunk/occlusion_fragment.glsl.js';
import occlusion_pars_fragment from './ShaderChunk/occlusion_pars_fragment.glsl.js';
import clearcoat_normal_fragment_begin from './ShaderChunk/clearcoat_normal_fragment_begin.glsl.js';
import clearcoat_normal_fragment_maps from './ShaderChunk/clearcoat_normal_fragment_maps.glsl.js';
import clearcoat_pars_fragment from './ShaderChunk/clearcoat_pars_fragment.glsl.js';
Expand Down Expand Up @@ -204,8 +202,6 @@ export const ShaderChunk = {
normal_pars_vertex: normal_pars_vertex,
normal_vertex: normal_vertex,
normalmap_pars_fragment: normalmap_pars_fragment,
occlusion_fragment: occlusion_fragment,
occlusion_pars_fragment: occlusion_pars_fragment,
clearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,
clearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,
clearcoat_pars_fragment: clearcoat_pars_fragment,
Expand Down
20 changes: 0 additions & 20 deletions src/renderers/shaders/ShaderChunk/occlusion_fragment.glsl.js

This file was deleted.

97 changes: 0 additions & 97 deletions src/renderers/shaders/ShaderChunk/occlusion_pars_fragment.glsl.js

This file was deleted.

Loading

0 comments on commit fad7c39

Please sign in to comment.