Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/materials/nodes/NodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ class NodeMaterial extends Material {

const outgoingLightNode = this.setupLighting( builder );

if ( clippingNode !== null ) builder.stack.add( clippingNode );
if ( clippingNode !== null ) builder.stack.addToStack( clippingNode );

// force unsigned floats - useful for RenderTargets

Expand Down Expand Up @@ -599,7 +599,7 @@ class NodeMaterial extends Material {

} else {

builder.stack.add( clipping() );
builder.stack.addToStack( clipping() );

}

Expand All @@ -626,7 +626,7 @@ class NodeMaterial extends Material {

if ( candidateCount > 0 && candidateCount <= 8 && builder.isAvailable( 'clipDistance' ) ) {

builder.stack.add( hardwareClipping() );
builder.stack.addToStack( hardwareClipping() );

this.hardwareClipping = true;

Expand Down
6 changes: 3 additions & 3 deletions src/nodes/core/StackNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class StackNode extends Node {
* @param {Node} node - The node to add.
* @return {StackNode} A reference to this stack node.
*/
add( node ) {
addToStack( node ) {

if ( node.isNode !== true ) {

Expand All @@ -124,7 +124,7 @@ class StackNode extends Node {
const methodNode = new ShaderNode( method );
this._currentCond = select( boolNode, methodNode );

return this.add( this._currentCond );
return this.addToStack( this._currentCond );

}

Expand Down Expand Up @@ -226,7 +226,7 @@ class StackNode extends Node {

this._currentCond = condNode;

return this.add( this._currentCond );
return this.addToStack( this._currentCond );

} else {

Expand Down
30 changes: 28 additions & 2 deletions src/nodes/display/RenderOutputNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ class RenderOutputNode extends TempNode {
/**
* The tone mapping type.
*
* @private
* @type {?number}
*/
this.toneMapping = toneMapping;
this._toneMapping = toneMapping;

/**
* The output color space.
Expand All @@ -78,13 +79,38 @@ class RenderOutputNode extends TempNode {

}

/**
* Sets the tone mapping type.
*
* @param {number} value - The tone mapping type.
* @return {ToneMappingNode} A reference to this node.
*/
setToneMapping( value ) {

this._toneMapping = value;

return this;

}

/**
* Gets the tone mapping type.
*
* @returns {number} The tone mapping type.
*/
getToneMapping() {

return this._toneMapping;

}

setup( { context } ) {

let outputNode = this.colorNode || context.color;

// tone mapping

const toneMapping = ( this.toneMapping !== null ? this.toneMapping : context.toneMapping ) || NoToneMapping;
const toneMapping = ( this._toneMapping !== null ? this._toneMapping : context.toneMapping ) || NoToneMapping;
const outputColorSpace = ( this.outputColorSpace !== null ? this.outputColorSpace : context.outputColorSpace ) || NoColorSpace;

if ( toneMapping !== NoToneMapping ) {
Expand Down
32 changes: 29 additions & 3 deletions src/nodes/display/ToneMappingNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ class ToneMappingNode extends TempNode {
/**
* The tone mapping type.
*
* @private
* @type {number}
*/
this.toneMapping = toneMapping;
this._toneMapping = toneMapping;

/**
* The tone mapping exposure.
Expand Down Expand Up @@ -63,14 +64,39 @@ class ToneMappingNode extends TempNode {
*/
customCacheKey() {

return hash( this.toneMapping );
return hash( this._toneMapping );

}

/**
* Sets the tone mapping type.
*
* @param {number} value - The tone mapping type.
* @return {ToneMappingNode} A reference to this node.
*/
setToneMapping( value ) {

this._toneMapping = value;

return this;

}

/**
* Gets the tone mapping type.
*
* @returns {number} The tone mapping type.
*/
getToneMapping() {

return this._toneMapping;

}

setup( builder ) {

const colorNode = this.colorNode || builder.context.color;
const toneMapping = this.toneMapping;
const toneMapping = this._toneMapping;

if ( toneMapping === NoToneMapping ) return colorNode;

Expand Down
7 changes: 3 additions & 4 deletions src/nodes/tsl/TSLCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function addMethodChaining( name, nodeElement ) {

//if ( name === 'toVarIntent' ) return this;

return this.isStackNode ? this.add( nodeElement( ...params ) ) : nodeElement( this, ...params );
return this.isStackNode ? this.addToStack( nodeElement( ...params ) ) : nodeElement( this, ...params );

};

Expand Down Expand Up @@ -76,7 +76,7 @@ Node.prototype.assign = function ( ...params ) {

const nodeElement = NodeElements.get( 'assign' );

return this.add( nodeElement( ...params ) );
return this.addToStack( nodeElement( ...params ) );

}

Expand Down Expand Up @@ -1129,7 +1129,7 @@ export const Switch = ( ...params ) => currentStack.Switch( ...params );
*/
export function Stack( node ) {

if ( currentStack ) currentStack.add( node );
if ( currentStack ) currentStack.addToStack( node );

return node;

Expand Down Expand Up @@ -1221,4 +1221,3 @@ addMethodChaining( 'append', ( node ) => { // @deprecated, r176
return Stack( node );

} );