|
@@ -179,7 +179,7 @@ Object.assign( EventDispatcher.prototype, {
|
|
|
|
|
|
} );
|
|
} );
|
|
|
|
|
|
-var REVISION = '105';
|
|
|
|
|
|
+var REVISION = '106dev';
|
|
var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
|
|
var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
|
|
var CullFaceNone = 0;
|
|
var CullFaceNone = 0;
|
|
var CullFaceBack = 1;
|
|
var CullFaceBack = 1;
|
|
@@ -6230,9 +6230,9 @@ var meshphysical_frag = "#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 e
|
|
|
|
|
|
var meshphysical_vert = "#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
var meshphysical_vert = "#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
|
|
|
|
|
|
-var normal_frag = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}";
|
|
|
|
|
|
+var normal_frag = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}";
|
|
|
|
|
|
-var normal_vert = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";
|
|
|
|
|
|
+var normal_vert = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";
|
|
|
|
|
|
var points_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}";
|
|
var points_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}";
|
|
|
|
|
|
@@ -16869,56 +16869,37 @@ WebGLUniforms.seqWithValue = function ( seq, values ) {
|
|
* @author mrdoob / http://mrdoob.com/
|
|
* @author mrdoob / http://mrdoob.com/
|
|
*/
|
|
*/
|
|
|
|
|
|
-function addLineNumbers( string ) {
|
|
|
|
-
|
|
|
|
- var lines = string.split( '\n' );
|
|
|
|
-
|
|
|
|
- for ( var i = 0; i < lines.length; i ++ ) {
|
|
|
|
-
|
|
|
|
- lines[ i ] = ( i + 1 ) + ': ' + lines[ i ];
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return lines.join( '\n' );
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-function WebGLShader( gl, type, string, debug ) {
|
|
|
|
|
|
+function WebGLShader( gl, type, string ) {
|
|
|
|
|
|
var shader = gl.createShader( type );
|
|
var shader = gl.createShader( type );
|
|
|
|
|
|
gl.shaderSource( shader, string );
|
|
gl.shaderSource( shader, string );
|
|
gl.compileShader( shader );
|
|
gl.compileShader( shader );
|
|
|
|
|
|
- if ( debug === true ) {
|
|
|
|
|
|
+ return shader;
|
|
|
|
|
|
- if ( gl.getShaderParameter( shader, 35713 ) === false ) {
|
|
|
|
|
|
+}
|
|
|
|
|
|
- console.error( 'THREE.WebGLShader: Shader couldn\'t compile.' );
|
|
|
|
|
|
+/**
|
|
|
|
+ * @author mrdoob / http://mrdoob.com/
|
|
|
|
+ */
|
|
|
|
|
|
- }
|
|
|
|
|
|
+var programIdCount = 0;
|
|
|
|
+
|
|
|
|
+function addLineNumbers( string ) {
|
|
|
|
|
|
- if ( gl.getShaderInfoLog( shader ) !== '' ) {
|
|
|
|
|
|
+ var lines = string.split( '\n' );
|
|
|
|
|
|
- console.warn( 'THREE.WebGLShader: gl.getShaderInfoLog()', type === 35633 ? 'vertex' : 'fragment', gl.getShaderInfoLog( shader ), addLineNumbers( string ) );
|
|
|
|
|
|
+ for ( var i = 0; i < lines.length; i ++ ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ lines[ i ] = ( i + 1 ) + ': ' + lines[ i ];
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- // --enable-privileged-webgl-extension
|
|
|
|
- // console.log( type, gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );
|
|
|
|
-
|
|
|
|
- return shader;
|
|
|
|
|
|
+ return lines.join( '\n' );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-/**
|
|
|
|
- * @author mrdoob / http://mrdoob.com/
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-var programIdCount = 0;
|
|
|
|
-
|
|
|
|
function getEncodingComponents( encoding ) {
|
|
function getEncodingComponents( encoding ) {
|
|
|
|
|
|
switch ( encoding ) {
|
|
switch ( encoding ) {
|
|
@@ -16944,6 +16925,22 @@ function getEncodingComponents( encoding ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function getShaderErrors( gl, shader, type ) {
|
|
|
|
+
|
|
|
|
+ var status = gl.getShaderParameter( shader, 35713 );
|
|
|
|
+ var log = gl.getShaderInfoLog( shader ).trim();
|
|
|
|
+
|
|
|
|
+ if ( status && log === '' ) return '';
|
|
|
|
+
|
|
|
|
+ // --enable-privileged-webgl-extension
|
|
|
|
+ // console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );
|
|
|
|
+
|
|
|
|
+ var source = gl.getShaderSource( shader );
|
|
|
|
+
|
|
|
|
+ return 'THREE.WebGLShader: gl.getShaderInfoLog() ' + type + '\n' + log + addLineNumbers( source );
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
function getTexelDecodingFunction( functionName, encoding ) {
|
|
function getTexelDecodingFunction( functionName, encoding ) {
|
|
|
|
|
|
var components = getEncodingComponents( encoding );
|
|
var components = getEncodingComponents( encoding );
|
|
@@ -17493,8 +17490,8 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
|
|
// console.log( '*VERTEX*', vertexGlsl );
|
|
// console.log( '*VERTEX*', vertexGlsl );
|
|
// console.log( '*FRAGMENT*', fragmentGlsl );
|
|
// console.log( '*FRAGMENT*', fragmentGlsl );
|
|
|
|
|
|
- var glVertexShader = WebGLShader( gl, 35633, vertexGlsl, renderer.debug.checkShaderErrors );
|
|
|
|
- var glFragmentShader = WebGLShader( gl, 35632, fragmentGlsl, renderer.debug.checkShaderErrors );
|
|
|
|
|
|
+ var glVertexShader = WebGLShader( gl, 35633, vertexGlsl );
|
|
|
|
+ var glFragmentShader = WebGLShader( gl, 35632, fragmentGlsl );
|
|
|
|
|
|
gl.attachShader( program, glVertexShader );
|
|
gl.attachShader( program, glVertexShader );
|
|
gl.attachShader( program, glFragmentShader );
|
|
gl.attachShader( program, glFragmentShader );
|
|
@@ -17524,14 +17521,14 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
|
|
var runnable = true;
|
|
var runnable = true;
|
|
var haveDiagnostics = true;
|
|
var haveDiagnostics = true;
|
|
|
|
|
|
- // console.log( '**VERTEX**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( glVertexShader ) );
|
|
|
|
- // console.log( '**FRAGMENT**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( glFragmentShader ) );
|
|
|
|
-
|
|
|
|
if ( gl.getProgramParameter( program, 35714 ) === false ) {
|
|
if ( gl.getProgramParameter( program, 35714 ) === false ) {
|
|
|
|
|
|
runnable = false;
|
|
runnable = false;
|
|
|
|
|
|
- console.error( 'THREE.WebGLProgram: shader error: ', gl.getError(), '35715', gl.getProgramParameter( program, 35715 ), 'gl.getProgramInfoLog', programLog, vertexLog, fragmentLog );
|
|
|
|
|
|
+ var vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );
|
|
|
|
+ var fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );
|
|
|
|
+
|
|
|
|
+ console.error( 'THREE.WebGLProgram: shader error: ', gl.getError(), '35715', gl.getProgramParameter( program, 35715 ), 'gl.getProgramInfoLog', programLog, vertexErrors, fragmentErrors );
|
|
|
|
|
|
} else if ( programLog !== '' ) {
|
|
} else if ( programLog !== '' ) {
|
|
|
|
|
|
@@ -18319,7 +18316,7 @@ function UniformsCache() {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-var count = 0;
|
|
|
|
|
|
+var nextVersion = 0;
|
|
|
|
|
|
function WebGLLights() {
|
|
function WebGLLights() {
|
|
|
|
|
|
@@ -18327,16 +18324,15 @@ function WebGLLights() {
|
|
|
|
|
|
var state = {
|
|
var state = {
|
|
|
|
|
|
- id: count ++,
|
|
|
|
|
|
+ version: 0,
|
|
|
|
|
|
hash: {
|
|
hash: {
|
|
- stateID: - 1,
|
|
|
|
directionalLength: - 1,
|
|
directionalLength: - 1,
|
|
pointLength: - 1,
|
|
pointLength: - 1,
|
|
spotLength: - 1,
|
|
spotLength: - 1,
|
|
rectAreaLength: - 1,
|
|
rectAreaLength: - 1,
|
|
hemiLength: - 1,
|
|
hemiLength: - 1,
|
|
- shadowsLength: - 1
|
|
|
|
|
|
+ shadowsLength: - 1,
|
|
},
|
|
},
|
|
|
|
|
|
ambient: [ 0, 0, 0 ],
|
|
ambient: [ 0, 0, 0 ],
|
|
@@ -18550,19 +18546,31 @@ function WebGLLights() {
|
|
state.ambient[ 1 ] = g;
|
|
state.ambient[ 1 ] = g;
|
|
state.ambient[ 2 ] = b;
|
|
state.ambient[ 2 ] = b;
|
|
|
|
|
|
- state.directional.length = directionalLength;
|
|
|
|
- state.spot.length = spotLength;
|
|
|
|
- state.rectArea.length = rectAreaLength;
|
|
|
|
- state.point.length = pointLength;
|
|
|
|
- state.hemi.length = hemiLength;
|
|
|
|
|
|
+ var hash = state.hash;
|
|
|
|
+
|
|
|
|
+ if ( hash.directionalLength !== directionalLength ||
|
|
|
|
+ hash.pointLength !== pointLength ||
|
|
|
|
+ hash.spotLength !== spotLength ||
|
|
|
|
+ hash.rectAreaLength !== rectAreaLength ||
|
|
|
|
+ hash.hemiLength !== hemiLength ||
|
|
|
|
+ hash.shadowsLength !== shadows.length ) {
|
|
|
|
+
|
|
|
|
+ state.directional.length = directionalLength;
|
|
|
|
+ state.spot.length = spotLength;
|
|
|
|
+ state.rectArea.length = rectAreaLength;
|
|
|
|
+ state.point.length = pointLength;
|
|
|
|
+ state.hemi.length = hemiLength;
|
|
|
|
+
|
|
|
|
+ hash.directionalLength = directionalLength;
|
|
|
|
+ hash.pointLength = pointLength;
|
|
|
|
+ hash.spotLength = spotLength;
|
|
|
|
+ hash.rectAreaLength = rectAreaLength;
|
|
|
|
+ hash.hemiLength = hemiLength;
|
|
|
|
+ hash.shadowsLength = shadows.length;
|
|
|
|
|
|
- state.hash.stateID = state.id;
|
|
|
|
- state.hash.directionalLength = directionalLength;
|
|
|
|
- state.hash.pointLength = pointLength;
|
|
|
|
- state.hash.spotLength = spotLength;
|
|
|
|
- state.hash.rectAreaLength = rectAreaLength;
|
|
|
|
- state.hash.hemiLength = hemiLength;
|
|
|
|
- state.hash.shadowsLength = shadows.length;
|
|
|
|
|
|
+ state.version = nextVersion ++;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -24105,8 +24113,7 @@ function WebGLRenderer( parameters ) {
|
|
var lights = currentRenderState.state.lights;
|
|
var lights = currentRenderState.state.lights;
|
|
var shadowsArray = currentRenderState.state.shadowsArray;
|
|
var shadowsArray = currentRenderState.state.shadowsArray;
|
|
|
|
|
|
- var lightsHash = materialProperties.lightsHash;
|
|
|
|
- var lightsStateHash = lights.state.hash;
|
|
|
|
|
|
+ var lightsStateVersion = lights.state.version;
|
|
|
|
|
|
var parameters = programCache.getParameters(
|
|
var parameters = programCache.getParameters(
|
|
material, lights.state, shadowsArray, fog, _clipping.numPlanes, _clipping.numIntersection, object );
|
|
material, lights.state, shadowsArray, fog, _clipping.numPlanes, _clipping.numIntersection, object );
|
|
@@ -24126,21 +24133,9 @@ function WebGLRenderer( parameters ) {
|
|
// changed glsl or parameters
|
|
// changed glsl or parameters
|
|
releaseMaterialProgramReference( material );
|
|
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;
|
|
programChange = false;
|
|
|
|
|
|
@@ -24241,19 +24236,8 @@ function WebGLRenderer( parameters ) {
|
|
materialProperties.fog = fog;
|
|
materialProperties.fog = fog;
|
|
|
|
|
|
// store the light setup it was created for
|
|
// 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 ) {
|
|
if ( material.lights ) {
|
|
|
|
|
|
@@ -24292,9 +24276,6 @@ function WebGLRenderer( parameters ) {
|
|
var materialProperties = properties.get( material );
|
|
var materialProperties = properties.get( material );
|
|
var lights = currentRenderState.state.lights;
|
|
var lights = currentRenderState.state.lights;
|
|
|
|
|
|
- var lightsHash = materialProperties.lightsHash;
|
|
|
|
- var lightsStateHash = lights.state.hash;
|
|
|
|
-
|
|
|
|
if ( _clippingEnabled ) {
|
|
if ( _clippingEnabled ) {
|
|
|
|
|
|
if ( _localClippingEnabled || camera !== _currentCamera ) {
|
|
if ( _localClippingEnabled || camera !== _currentCamera ) {
|
|
@@ -24324,13 +24305,7 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
material.needsUpdate = true;
|
|
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;
|
|
material.needsUpdate = true;
|
|
|
|
|