|
@@ -65,17 +65,17 @@ class NodeMaterial extends ShaderMaterial {
|
|
|
|
|
|
build( builder ) {
|
|
build( builder ) {
|
|
|
|
|
|
- this.construct( builder );
|
|
|
|
|
|
+ this.setup( builder );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- construct( builder ) {
|
|
|
|
|
|
+ setup( builder ) {
|
|
|
|
|
|
// < VERTEX STAGE >
|
|
// < VERTEX STAGE >
|
|
|
|
|
|
builder.addStack();
|
|
builder.addStack();
|
|
|
|
|
|
- builder.stack.outputNode = this.constructPosition( builder );
|
|
|
|
|
|
+ builder.stack.outputNode = this.setupPosition( builder );
|
|
|
|
|
|
builder.addFlow( 'vertex', builder.removeStack() );
|
|
builder.addFlow( 'vertex', builder.removeStack() );
|
|
|
|
|
|
@@ -87,14 +87,14 @@ class NodeMaterial extends ShaderMaterial {
|
|
|
|
|
|
if ( this.unlit === false ) {
|
|
if ( this.unlit === false ) {
|
|
|
|
|
|
- if ( this.normals === true ) this.constructNormal( builder );
|
|
|
|
|
|
+ if ( this.normals === true ) this.setupNormal( builder );
|
|
|
|
|
|
- this.constructDiffuseColor( builder );
|
|
|
|
- this.constructVariants( builder );
|
|
|
|
|
|
+ this.setupDiffuseColor( builder );
|
|
|
|
+ this.setupVariants( builder );
|
|
|
|
|
|
- const outgoingLightNode = this.constructLighting( builder );
|
|
|
|
|
|
+ const outgoingLightNode = this.setupLighting( builder );
|
|
|
|
|
|
- outputNode = this.constructOutput( builder, vec4( outgoingLightNode, diffuseColor.a ) );
|
|
|
|
|
|
+ outputNode = this.setupOutput( builder, vec4( outgoingLightNode, diffuseColor.a ) );
|
|
|
|
|
|
// OUTPUT NODE
|
|
// OUTPUT NODE
|
|
|
|
|
|
@@ -106,7 +106,7 @@ class NodeMaterial extends ShaderMaterial {
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
- outputNode = this.constructOutput( builder, this.outputNode || vec4( 0, 0, 0, 1 ) );
|
|
|
|
|
|
+ outputNode = this.setupOutput( builder, this.outputNode || vec4( 0, 0, 0, 1 ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -116,7 +116,7 @@ class NodeMaterial extends ShaderMaterial {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- constructPosition( builder ) {
|
|
|
|
|
|
+ setupPosition( builder ) {
|
|
|
|
|
|
const object = builder.object;
|
|
const object = builder.object;
|
|
const geometry = object.geometry;
|
|
const geometry = object.geometry;
|
|
@@ -153,7 +153,7 @@ class NodeMaterial extends ShaderMaterial {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- constructDiffuseColor( { stack, geometry } ) {
|
|
|
|
|
|
+ setupDiffuseColor( { stack, geometry } ) {
|
|
|
|
|
|
let colorNode = this.colorNode ? vec4( this.colorNode ) : materialColor;
|
|
let colorNode = this.colorNode ? vec4( this.colorNode ) : materialColor;
|
|
|
|
|
|
@@ -186,13 +186,13 @@ class NodeMaterial extends ShaderMaterial {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- constructVariants( /*builder*/ ) {
|
|
|
|
|
|
+ setupVariants( /*builder*/ ) {
|
|
|
|
|
|
// Interface function.
|
|
// Interface function.
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- constructNormal( { stack } ) {
|
|
|
|
|
|
+ setupNormal( { stack } ) {
|
|
|
|
|
|
// NORMAL VIEW
|
|
// NORMAL VIEW
|
|
|
|
|
|
@@ -236,7 +236,7 @@ class NodeMaterial extends ShaderMaterial {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- constructLights( builder ) {
|
|
|
|
|
|
+ setupLights( builder ) {
|
|
|
|
|
|
const envNode = this.getEnvNode( builder );
|
|
const envNode = this.getEnvNode( builder );
|
|
|
|
|
|
@@ -268,13 +268,13 @@ class NodeMaterial extends ShaderMaterial {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- constructLightingModel( /*builder*/ ) {
|
|
|
|
|
|
+ setupLightingModel( /*builder*/ ) {
|
|
|
|
|
|
// Interface function.
|
|
// Interface function.
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- constructLighting( builder ) {
|
|
|
|
|
|
+ setupLighting( builder ) {
|
|
|
|
|
|
const { material } = builder;
|
|
const { material } = builder;
|
|
const { backdropNode, backdropAlphaNode, emissiveNode } = this;
|
|
const { backdropNode, backdropAlphaNode, emissiveNode } = this;
|
|
@@ -283,13 +283,13 @@ class NodeMaterial extends ShaderMaterial {
|
|
|
|
|
|
const lights = this.lights === true || this.lightsNode !== null;
|
|
const lights = this.lights === true || this.lightsNode !== null;
|
|
|
|
|
|
- const lightsNode = lights ? this.constructLights( builder ) : null;
|
|
|
|
|
|
+ const lightsNode = lights ? this.setupLights( builder ) : null;
|
|
|
|
|
|
let outgoingLightNode = diffuseColor.rgb;
|
|
let outgoingLightNode = diffuseColor.rgb;
|
|
|
|
|
|
if ( lightsNode && lightsNode.hasLight !== false ) {
|
|
if ( lightsNode && lightsNode.hasLight !== false ) {
|
|
|
|
|
|
- const lightingModelNode = this.constructLightingModel( builder );
|
|
|
|
|
|
+ const lightingModelNode = this.setupLightingModel( builder );
|
|
|
|
|
|
outgoingLightNode = lightingContext( lightsNode, lightingModelNode, backdropNode, backdropAlphaNode );
|
|
outgoingLightNode = lightingContext( lightsNode, lightingModelNode, backdropNode, backdropAlphaNode );
|
|
|
|
|
|
@@ -311,7 +311,7 @@ class NodeMaterial extends ShaderMaterial {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- constructOutput( builder, outputNode ) {
|
|
|
|
|
|
+ setupOutput( builder, outputNode ) {
|
|
|
|
|
|
const renderer = builder.renderer;
|
|
const renderer = builder.renderer;
|
|
|
|
|