Browse Source

ShaderMaterial: Added uniformsNeedUpdate flag.

Mr.doob 7 năm trước cách đây
mục cha
commit
d4b3dabe14

+ 1 - 0
src/materials/ShaderMaterial.js

@@ -63,6 +63,7 @@ function ShaderMaterial( parameters ) {
 	};
 	};
 
 
 	this.index0AttributeName = undefined;
 	this.index0AttributeName = undefined;
+	this.uniformsNeedUpdate = false;
 
 
 	if ( parameters !== undefined ) {
 	if ( parameters !== undefined ) {
 
 

+ 6 - 0
src/renderers/WebGLRenderer.js

@@ -1931,6 +1931,12 @@ function WebGLRenderer( parameters ) {
 
 
 		}
 		}
 
 
+		if ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {
+
+			WebGLUniforms.upload( _gl, materialProperties.uniformsList, m_uniforms, _this );
+			material.uniformsNeedUpdate = false;
+
+		}
 
 
 		// common matrices
 		// common matrices