|
@@ -1444,8 +1444,7 @@ function WebGLRenderer( parameters ) {
|
|
|
var lights = currentRenderState.state.lights;
|
|
|
var shadowsArray = currentRenderState.state.shadowsArray;
|
|
|
|
|
|
- var lightsHash = materialProperties.lightsHash;
|
|
|
- var lightsStateHash = lights.state.hash;
|
|
|
+ var lightsStateVersion = lights.state.version;
|
|
|
|
|
|
var parameters = programCache.getParameters(
|
|
|
material, lights.state, shadowsArray, fog, _clipping.numPlanes, _clipping.numIntersection, object );
|
|
@@ -1465,21 +1464,9 @@ function WebGLRenderer( parameters ) {
|
|
|
// changed glsl or parameters
|
|
|
releaseMaterialProgramReference( material );
|
|
|
|
|
|
- } else if ( lightsHash.stateID !== lightsStateHash.stateID ||
|
|
|
- lightsHash.directionalLength !== lightsStateHash.directionalLength ||
|
|
|
- lightsHash.pointLength !== lightsStateHash.pointLength ||
|
|
|
- lightsHash.spotLength !== lightsStateHash.spotLength ||
|
|
|
- lightsHash.rectAreaLength !== lightsStateHash.rectAreaLength ||
|
|
|
- lightsHash.hemiLength !== lightsStateHash.hemiLength ||
|
|
|
- lightsHash.shadowsLength !== lightsStateHash.shadowsLength ) {
|
|
|
-
|
|
|
- lightsHash.stateID = lightsStateHash.stateID;
|
|
|
- lightsHash.directionalLength = lightsStateHash.directionalLength;
|
|
|
- lightsHash.pointLength = lightsStateHash.pointLength;
|
|
|
- lightsHash.spotLength = lightsStateHash.spotLength;
|
|
|
- lightsHash.rectAreaLength = lightsStateHash.rectAreaLength;
|
|
|
- lightsHash.hemiLength = lightsStateHash.hemiLength;
|
|
|
- lightsHash.shadowsLength = lightsStateHash.shadowsLength;
|
|
|
+ } else if ( materialProperties.lightsStateVersion !== lightsStateVersion ) {
|
|
|
+
|
|
|
+ materialProperties.lightsStateVersion = lightsStateVersion;
|
|
|
|
|
|
programChange = false;
|
|
|
|
|
@@ -1580,19 +1567,8 @@ function WebGLRenderer( parameters ) {
|
|
|
materialProperties.fog = fog;
|
|
|
|
|
|
// store the light setup it was created for
|
|
|
- if ( lightsHash === undefined ) {
|
|
|
-
|
|
|
- materialProperties.lightsHash = lightsHash = {};
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
- lightsHash.stateID = lightsStateHash.stateID;
|
|
|
- lightsHash.directionalLength = lightsStateHash.directionalLength;
|
|
|
- lightsHash.pointLength = lightsStateHash.pointLength;
|
|
|
- lightsHash.spotLength = lightsStateHash.spotLength;
|
|
|
- lightsHash.rectAreaLength = lightsStateHash.rectAreaLength;
|
|
|
- lightsHash.hemiLength = lightsStateHash.hemiLength;
|
|
|
- lightsHash.shadowsLength = lightsStateHash.shadowsLength;
|
|
|
+ materialProperties.lightsStateVersion = lightsStateVersion;
|
|
|
|
|
|
if ( material.lights ) {
|
|
|
|
|
@@ -1631,9 +1607,6 @@ function WebGLRenderer( parameters ) {
|
|
|
var materialProperties = properties.get( material );
|
|
|
var lights = currentRenderState.state.lights;
|
|
|
|
|
|
- var lightsHash = materialProperties.lightsHash;
|
|
|
- var lightsStateHash = lights.state.hash;
|
|
|
-
|
|
|
if ( _clippingEnabled ) {
|
|
|
|
|
|
if ( _localClippingEnabled || camera !== _currentCamera ) {
|
|
@@ -1663,13 +1636,7 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
material.needsUpdate = true;
|
|
|
|
|
|
- } else if ( material.lights && ( lightsHash.stateID !== lightsStateHash.stateID ||
|
|
|
- lightsHash.directionalLength !== lightsStateHash.directionalLength ||
|
|
|
- lightsHash.pointLength !== lightsStateHash.pointLength ||
|
|
|
- lightsHash.spotLength !== lightsStateHash.spotLength ||
|
|
|
- lightsHash.rectAreaLength !== lightsStateHash.rectAreaLength ||
|
|
|
- lightsHash.hemiLength !== lightsStateHash.hemiLength ||
|
|
|
- lightsHash.shadowsLength !== lightsStateHash.shadowsLength ) ) {
|
|
|
+ } else if ( material.lights && materialProperties.lightsStateVersion !== lights.state.version ) {
|
|
|
|
|
|
material.needsUpdate = true;
|
|
|
|