|
@@ -11,11 +11,21 @@ function NodeMaterial( vertex, fragment ) {
|
|
|
|
|
|
THREE.ShaderMaterial.call( this );
|
|
|
|
|
|
+ var self = this;
|
|
|
+
|
|
|
this.vertex = vertex || new RawNode( new PositionNode( PositionNode.PROJECTION ) );
|
|
|
this.fragment = fragment || new RawNode( new ColorNode( 0xFF0000 ) );
|
|
|
|
|
|
this.updaters = [];
|
|
|
|
|
|
+ // it fix the programCache and share the code with others materials
|
|
|
+
|
|
|
+ this.onBeforeCompile.toString = function() {
|
|
|
+
|
|
|
+ return self.needsCompile;
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
}
|
|
|
|
|
|
NodeMaterial.prototype = Object.create( THREE.ShaderMaterial.prototype );
|
|
@@ -34,6 +44,22 @@ Object.defineProperties( NodeMaterial.prototype, {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ },
|
|
|
+
|
|
|
+ needsUpdate: {
|
|
|
+
|
|
|
+ set: function ( value ) {
|
|
|
+
|
|
|
+ this.needsCompile = value;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ get: function () {
|
|
|
+
|
|
|
+ return this.needsCompile;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
} );
|