Skip to content

Commit 1454ebf

Browse files
committed
RenderOutputNode: Add setToneMapping() and getToneMapping()
1 parent c1fca90 commit 1454ebf

File tree

2 files changed

+57
-5
lines changed

2 files changed

+57
-5
lines changed

src/nodes/display/RenderOutputNode.js

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ class RenderOutputNode extends TempNode {
5656
/**
5757
* The tone mapping type.
5858
*
59+
* @private
5960
* @type {?number}
6061
*/
61-
this.toneMapping = toneMapping;
62+
this._toneMapping = toneMapping;
6263

6364
/**
6465
* The output color space.
@@ -76,6 +77,31 @@ class RenderOutputNode extends TempNode {
7677
*/
7778
this.isRenderOutputNode = true;
7879

80+
}
81+
82+
/**
83+
* Sets the tone mapping type.
84+
*
85+
* @param {number} value - The tone mapping type.
86+
* @return {ToneMappingNode} A reference to this node.
87+
*/
88+
setToneMapping( value ) {
89+
90+
this._toneMapping = value;
91+
92+
return this;
93+
94+
}
95+
96+
/**
97+
* Gets the tone mapping type.
98+
*
99+
* @returns {number} The tone mapping type.
100+
*/
101+
getToneMapping() {
102+
103+
return this._toneMapping;
104+
79105
}
80106

81107
setup( { context } ) {
@@ -84,7 +110,7 @@ class RenderOutputNode extends TempNode {
84110

85111
// tone mapping
86112

87-
const toneMapping = ( this.toneMapping !== null ? this.toneMapping : context.toneMapping ) || NoToneMapping;
113+
const toneMapping = ( this._toneMapping !== null ? this._toneMapping : context.toneMapping ) || NoToneMapping;
88114
const outputColorSpace = ( this.outputColorSpace !== null ? this.outputColorSpace : context.outputColorSpace ) || NoColorSpace;
89115

90116
if ( toneMapping !== NoToneMapping ) {

src/nodes/display/ToneMappingNode.js

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ class ToneMappingNode extends TempNode {
3333
/**
3434
* The tone mapping type.
3535
*
36+
* @private
3637
* @type {number}
3738
*/
38-
this.toneMapping = toneMapping;
39+
this._toneMapping = toneMapping;
3940

4041
/**
4142
* The tone mapping exposure.
@@ -63,14 +64,39 @@ class ToneMappingNode extends TempNode {
6364
*/
6465
customCacheKey() {
6566

66-
return hash( this.toneMapping );
67+
return hash( this._toneMapping );
68+
69+
}
70+
71+
/**
72+
* Sets the tone mapping type.
73+
*
74+
* @param {number} value - The tone mapping type.
75+
* @return {ToneMappingNode} A reference to this node.
76+
*/
77+
setToneMapping( value ) {
78+
79+
this._toneMapping = value;
80+
81+
return this;
82+
83+
}
84+
85+
/**
86+
* Gets the tone mapping type.
87+
*
88+
* @returns {number} The tone mapping type.
89+
*/
90+
getToneMapping() {
91+
92+
return this._toneMapping;
6793

6894
}
6995

7096
setup( builder ) {
7197

7298
const colorNode = this.colorNode || builder.context.color;
73-
const toneMapping = this.toneMapping;
99+
const toneMapping = this._toneMapping;
74100

75101
if ( toneMapping === NoToneMapping ) return colorNode;
76102

0 commit comments

Comments
 (0)