|
@@ -34,12 +34,12 @@ BasicNode.prototype.generate = function ( builder ) {
|
|
|
|
|
|
output.push(
|
|
output.push(
|
|
position.code,
|
|
position.code,
|
|
- position.result ? "gl_Position = " + position.result + ";" : ''
|
|
|
|
|
|
+ position.result ? "gl_Position = projectionMatrix * modelViewMatrix * vec4(" + position.result + ", 1.0);" : ''
|
|
);
|
|
);
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
- output.push( "gl_Position = projectionMatrix * modelViewMatrix * vec4(transformed, 1.0)" );
|
|
|
|
|
|
+ output.push( "gl_Position = projectionMatrix * modelViewMatrix * vec4(transformed, 1.0);" );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -51,10 +51,12 @@ BasicNode.prototype.generate = function ( builder ) {
|
|
this.color.analyze( builder, { slot: 'color' } );
|
|
this.color.analyze( builder, { slot: 'color' } );
|
|
|
|
|
|
if ( this.alpha ) this.alpha.analyze( builder );
|
|
if ( this.alpha ) this.alpha.analyze( builder );
|
|
|
|
+ if ( this.mask ) this.mask.analyze( builder );
|
|
|
|
|
|
// Build code
|
|
// Build code
|
|
var color = this.color.flow( builder, 'c', { slot: 'color' } );
|
|
var color = this.color.flow( builder, 'c', { slot: 'color' } );
|
|
var alpha = this.alpha ? this.alpha.flow( builder, 'f' ) : undefined;
|
|
var alpha = this.alpha ? this.alpha.flow( builder, 'f' ) : undefined;
|
|
|
|
+ var mask = this.mask ? this.mask.flow( builder, 'b' ) : undefined;
|
|
|
|
|
|
builder.requires.transparent = alpha !== undefined;
|
|
builder.requires.transparent = alpha !== undefined;
|
|
|
|
|
|
@@ -62,6 +64,15 @@ BasicNode.prototype.generate = function ( builder ) {
|
|
color.code,
|
|
color.code,
|
|
];
|
|
];
|
|
|
|
|
|
|
|
+ if ( mask ) {
|
|
|
|
+
|
|
|
|
+ output.push(
|
|
|
|
+ mask.code,
|
|
|
|
+ 'if ( ! ' + mask.result + ' ) discard;'
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
if ( alpha ) {
|
|
if ( alpha ) {
|
|
|
|
|
|
output.push(
|
|
output.push(
|
|
@@ -97,9 +108,11 @@ BasicNode.prototype.copy = function ( source ) {
|
|
|
|
|
|
Node.prototype.copy.call( this, source );
|
|
Node.prototype.copy.call( this, source );
|
|
|
|
|
|
- this.position = source.position;
|
|
|
|
this.color = source.color;
|
|
this.color = source.color;
|
|
- this.alpha = source.alpha;
|
|
|
|
|
|
+
|
|
|
|
+ if ( source.position ) this.position = source.position;
|
|
|
|
+ if ( source.alpha ) this.alpha = source.alpha;
|
|
|
|
+ if ( source.mask ) this.mask = source.mask;
|
|
|
|
|
|
return this;
|
|
return this;
|
|
|
|
|
|
@@ -113,9 +126,11 @@ BasicNode.prototype.toJSON = function ( meta ) {
|
|
|
|
|
|
data = this.createJSONNode( meta );
|
|
data = this.createJSONNode( meta );
|
|
|
|
|
|
- data.position = this.position.toJSON( meta ).uuid;
|
|
|
|
data.color = this.color.toJSON( meta ).uuid;
|
|
data.color = this.color.toJSON( meta ).uuid;
|
|
- data.alpha = this.alpha.toJSON( meta ).uuid;
|
|
|
|
|
|
+
|
|
|
|
+ if ( this.position ) data.position = this.position.toJSON( meta ).uuid;
|
|
|
|
+ if ( this.alpha ) data.alpha = this.alpha.toJSON( meta ).uuid;
|
|
|
|
+ if ( this.mask ) data.mask = this.mask.toJSON( meta ).uuid;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|