|
@@ -18,6 +18,22 @@ function NodeMaterial( vertex, fragment ) {
|
|
|
|
|
|
this.updaters = [];
|
|
|
|
|
|
+ // onBeforeCompile can't be in the prototype because onBeforeCompile.toString varies per material
|
|
|
+
|
|
|
+ this.onBeforeCompile = function ( shader, renderer ) {
|
|
|
+
|
|
|
+ if ( this.needsUpdate ) {
|
|
|
+
|
|
|
+ this.build( { renderer: renderer } );
|
|
|
+
|
|
|
+ shader.uniforms = this.uniforms;
|
|
|
+ shader.vertexShader = this.vertexShader;
|
|
|
+ shader.fragmentShader = this.fragmentShader;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
// it fix the programCache and share the code with others materials
|
|
|
|
|
|
this.onBeforeCompile.toString = function() {
|
|
@@ -74,20 +90,6 @@ NodeMaterial.prototype.updateFrame = function ( frame ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
-NodeMaterial.prototype.onBeforeCompile = function ( shader, renderer ) {
|
|
|
-
|
|
|
- if ( this.needsUpdate ) {
|
|
|
-
|
|
|
- this.build( { renderer: renderer } );
|
|
|
-
|
|
|
- shader.uniforms = this.uniforms;
|
|
|
- shader.vertexShader = this.vertexShader;
|
|
|
- shader.fragmentShader = this.fragmentShader;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
NodeMaterial.prototype.build = function ( params ) {
|
|
|
|
|
|
params = params || {};
|