|
@@ -33,7 +33,7 @@ StandardNode.prototype.build = function ( builder ) {
|
|
|
|
|
|
if ( builder.isShader( 'vertex' ) ) {
|
|
|
|
|
|
- var position = this.position ? this.position.parseAndBuildCode( builder, 'v3', { cache: 'position' } ) : undefined;
|
|
|
+ var position = this.position ? this.position.analyzeAndFlow( builder, 'v3', { cache: 'position' } ) : undefined;
|
|
|
|
|
|
builder.mergeUniform( THREE.UniformsUtils.merge( [
|
|
|
|
|
@@ -115,59 +115,59 @@ StandardNode.prototype.build = function ( builder ) {
|
|
|
|
|
|
var useClearCoat = ! builder.isDefined( 'STANDARD' );
|
|
|
|
|
|
- // parse all nodes to reuse generate codes
|
|
|
+ // analyze all nodes to reuse generate codes
|
|
|
|
|
|
- if ( this.mask ) this.mask.parse( builder );
|
|
|
+ if ( this.mask ) this.mask.analyze( builder );
|
|
|
|
|
|
- this.color.parse( builder, { slot: 'color', context: contextGammaOnly } );
|
|
|
- this.roughness.parse( builder );
|
|
|
- this.metalness.parse( builder );
|
|
|
+ this.color.analyze( builder, { slot: 'color', context: contextGammaOnly } );
|
|
|
+ this.roughness.analyze( builder );
|
|
|
+ this.metalness.analyze( builder );
|
|
|
|
|
|
- if ( this.alpha ) this.alpha.parse( builder );
|
|
|
+ if ( this.alpha ) this.alpha.analyze( builder );
|
|
|
|
|
|
- if ( this.normal ) this.normal.parse( builder );
|
|
|
+ if ( this.normal ) this.normal.analyze( builder );
|
|
|
|
|
|
- if ( this.clearCoat ) this.clearCoat.parse( builder );
|
|
|
- if ( this.clearCoatRoughness ) this.clearCoatRoughness.parse( builder );
|
|
|
+ if ( this.clearCoat ) this.clearCoat.analyze( builder );
|
|
|
+ if ( this.clearCoatRoughness ) this.clearCoatRoughness.analyze( builder );
|
|
|
|
|
|
- if ( this.reflectivity ) this.reflectivity.parse( builder );
|
|
|
+ if ( this.reflectivity ) this.reflectivity.analyze( builder );
|
|
|
|
|
|
- if ( this.light ) this.light.parse( builder, { cache: 'light' } );
|
|
|
+ if ( this.light ) this.light.analyze( builder, { cache: 'light' } );
|
|
|
|
|
|
- if ( this.ao ) this.ao.parse( builder );
|
|
|
- if ( this.ambient ) this.ambient.parse( builder );
|
|
|
- if ( this.shadow ) this.shadow.parse( builder );
|
|
|
- if ( this.emissive ) this.emissive.parse( builder, { slot: 'emissive' } );
|
|
|
+ if ( this.ao ) this.ao.analyze( builder );
|
|
|
+ if ( this.ambient ) this.ambient.analyze( builder );
|
|
|
+ if ( this.shadow ) this.shadow.analyze( builder );
|
|
|
+ if ( this.emissive ) this.emissive.analyze( builder, { slot: 'emissive' } );
|
|
|
|
|
|
- if ( this.environment ) this.environment.parse( builder, { cache: 'env', context: contextEnvironment, slot: 'environment' } ); // isolate environment from others inputs ( see TextureNode, CubeTextureNode )
|
|
|
+ if ( this.environment ) this.environment.analyze( builder, { cache: 'env', context: contextEnvironment, slot: 'environment' } ); // isolate environment from others inputs ( see TextureNode, CubeTextureNode )
|
|
|
|
|
|
// build code
|
|
|
|
|
|
- var mask = this.mask ? this.mask.buildCode( builder, 'b' ) : undefined;
|
|
|
+ var mask = this.mask ? this.mask.flow( builder, 'b' ) : undefined;
|
|
|
|
|
|
- var color = this.color.buildCode( builder, 'c', { slot: 'color', context: contextGammaOnly } );
|
|
|
- var roughness = this.roughness.buildCode( builder, 'f' );
|
|
|
- var metalness = this.metalness.buildCode( builder, 'f' );
|
|
|
+ var color = this.color.flow( builder, 'c', { slot: 'color', context: contextGammaOnly } );
|
|
|
+ var roughness = this.roughness.flow( builder, 'f' );
|
|
|
+ var metalness = this.metalness.flow( builder, 'f' );
|
|
|
|
|
|
- var alpha = this.alpha ? this.alpha.buildCode( builder, 'f' ) : undefined;
|
|
|
+ var alpha = this.alpha ? this.alpha.flow( builder, 'f' ) : undefined;
|
|
|
|
|
|
- var normal = this.normal ? this.normal.buildCode( builder, 'v3' ) : undefined;
|
|
|
+ var normal = this.normal ? this.normal.flow( builder, 'v3' ) : undefined;
|
|
|
|
|
|
- var clearCoat = this.clearCoat ? this.clearCoat.buildCode( builder, 'f' ) : undefined;
|
|
|
- var clearCoatRoughness = this.clearCoatRoughness ? this.clearCoatRoughness.buildCode( builder, 'f' ) : undefined;
|
|
|
+ var clearCoat = this.clearCoat ? this.clearCoat.flow( builder, 'f' ) : undefined;
|
|
|
+ var clearCoatRoughness = this.clearCoatRoughness ? this.clearCoatRoughness.flow( builder, 'f' ) : undefined;
|
|
|
|
|
|
- var reflectivity = this.reflectivity ? this.reflectivity.buildCode( builder, 'f' ) : undefined;
|
|
|
+ var reflectivity = this.reflectivity ? this.reflectivity.flow( builder, 'f' ) : undefined;
|
|
|
|
|
|
- var light = this.light ? this.light.buildCode( builder, 'v3', { cache: 'light' } ) : undefined;
|
|
|
+ var light = this.light ? this.light.flow( builder, 'v3', { cache: 'light' } ) : undefined;
|
|
|
|
|
|
- var ao = this.ao ? this.ao.buildCode( builder, 'f' ) : undefined;
|
|
|
- var ambient = this.ambient ? this.ambient.buildCode( builder, 'c' ) : undefined;
|
|
|
- var shadow = this.shadow ? this.shadow.buildCode( builder, 'c' ) : undefined;
|
|
|
- var emissive = this.emissive ? this.emissive.buildCode( builder, 'c', { slot: 'emissive' } ) : undefined;
|
|
|
+ var ao = this.ao ? this.ao.flow( builder, 'f' ) : undefined;
|
|
|
+ var ambient = this.ambient ? this.ambient.flow( builder, 'c' ) : undefined;
|
|
|
+ var shadow = this.shadow ? this.shadow.flow( builder, 'c' ) : undefined;
|
|
|
+ var emissive = this.emissive ? this.emissive.flow( builder, 'c', { slot: 'emissive' } ) : undefined;
|
|
|
|
|
|
- var environment = this.environment ? this.environment.buildCode( builder, 'c', { cache: 'env', context: contextEnvironment, slot: 'environment' } ) : undefined;
|
|
|
+ var environment = this.environment ? this.environment.flow( builder, 'c', { cache: 'env', context: contextEnvironment, slot: 'environment' } ) : undefined;
|
|
|
|
|
|
- var clearCoatEnv = useClearCoat && environment ? this.environment.buildCode( builder, 'c', { cache: 'clearCoat', context: contextEnvironment, slot: 'environment' } ) : undefined;
|
|
|
+ var clearCoatEnv = useClearCoat && environment ? this.environment.flow( builder, 'c', { cache: 'clearCoat', context: contextEnvironment, slot: 'environment' } ) : undefined;
|
|
|
|
|
|
builder.requires.transparent = alpha !== undefined;
|
|
|
|