|
@@ -149,7 +149,6 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
// clipping
|
|
|
|
|
|
- const _clipping = new WebGLClipping();
|
|
|
let _clippingEnabled = false;
|
|
|
let _localClippingEnabled = false;
|
|
|
|
|
@@ -252,7 +251,7 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
let extensions, capabilities, state, info;
|
|
|
let properties, textures, cubemaps, attributes, geometries, objects;
|
|
|
- let programCache, materials, renderLists, renderStates;
|
|
|
+ let programCache, materials, renderLists, renderStates, clipping;
|
|
|
|
|
|
let background, morphtargets, bufferRenderer, indexedBufferRenderer;
|
|
|
|
|
@@ -294,11 +293,11 @@ function WebGLRenderer( parameters ) {
|
|
|
geometries = new WebGLGeometries( _gl, attributes, info, bindingStates );
|
|
|
objects = new WebGLObjects( _gl, geometries, attributes, info );
|
|
|
morphtargets = new WebGLMorphtargets( _gl );
|
|
|
- programCache = new WebGLPrograms( _this, cubemaps, extensions, capabilities, bindingStates );
|
|
|
+ clipping = new WebGLClipping( properties );
|
|
|
+ programCache = new WebGLPrograms( _this, cubemaps, extensions, capabilities, bindingStates, clipping );
|
|
|
materials = new WebGLMaterials( properties );
|
|
|
renderLists = new WebGLRenderLists( properties );
|
|
|
renderStates = new WebGLRenderStates();
|
|
|
-
|
|
|
background = new WebGLBackground( _this, cubemaps, state, objects, _premultipliedAlpha );
|
|
|
|
|
|
bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );
|
|
@@ -1012,7 +1011,7 @@ function WebGLRenderer( parameters ) {
|
|
|
_frustum.setFromProjectionMatrix( _projScreenMatrix );
|
|
|
|
|
|
_localClippingEnabled = this.localClippingEnabled;
|
|
|
- _clippingEnabled = _clipping.init( this.clippingPlanes, _localClippingEnabled, camera );
|
|
|
+ _clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled, camera );
|
|
|
|
|
|
currentRenderList = renderLists.get( scene, camera );
|
|
|
currentRenderList.init();
|
|
@@ -1029,7 +1028,7 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
//
|
|
|
|
|
|
- if ( _clippingEnabled === true ) _clipping.beginShadows();
|
|
|
+ if ( _clippingEnabled === true ) clipping.beginShadows();
|
|
|
|
|
|
const shadowsArray = currentRenderState.state.shadowsArray;
|
|
|
|
|
@@ -1037,7 +1036,7 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
currentRenderState.setupLights( camera );
|
|
|
|
|
|
- if ( _clippingEnabled === true ) _clipping.endShadows();
|
|
|
+ if ( _clippingEnabled === true ) clipping.endShadows();
|
|
|
|
|
|
//
|
|
|
|
|
@@ -1306,7 +1305,7 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
const lightsStateVersion = lights.state.version;
|
|
|
|
|
|
- const parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, _clipping.numPlanes, _clipping.numIntersection, object );
|
|
|
+ const parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object );
|
|
|
const programCacheKey = programCache.getProgramCacheKey( parameters );
|
|
|
|
|
|
let program = materialProperties.program;
|
|
@@ -1394,9 +1393,9 @@ function WebGLRenderer( parameters ) {
|
|
|
! material.isRawShaderMaterial ||
|
|
|
material.clipping === true ) {
|
|
|
|
|
|
- materialProperties.numClippingPlanes = _clipping.numPlanes;
|
|
|
- materialProperties.numIntersection = _clipping.numIntersection;
|
|
|
- uniforms.clippingPlanes = _clipping.uniform;
|
|
|
+ materialProperties.numClippingPlanes = clipping.numPlanes;
|
|
|
+ materialProperties.numIntersection = clipping.numIntersection;
|
|
|
+ uniforms.clippingPlanes = clipping.uniform;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1468,9 +1467,7 @@ function WebGLRenderer( parameters ) {
|
|
|
// we might want to call this function with some ClippingGroup
|
|
|
// object instead of the material, once it becomes feasible
|
|
|
// (#8465, #8379)
|
|
|
- _clipping.setState(
|
|
|
- material.clippingPlanes, material.clipIntersection, material.clipShadows,
|
|
|
- camera, materialProperties, useCache );
|
|
|
+ clipping.setState( material, camera, useCache );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1495,8 +1492,8 @@ function WebGLRenderer( parameters ) {
|
|
|
initMaterial( material, scene, object );
|
|
|
|
|
|
} else if ( materialProperties.numClippingPlanes !== undefined &&
|
|
|
- ( materialProperties.numClippingPlanes !== _clipping.numPlanes ||
|
|
|
- materialProperties.numIntersection !== _clipping.numIntersection ) ) {
|
|
|
+ ( materialProperties.numClippingPlanes !== clipping.numPlanes ||
|
|
|
+ materialProperties.numIntersection !== clipping.numIntersection ) ) {
|
|
|
|
|
|
initMaterial( material, scene, object );
|
|
|
|