Skip to content

Commit de14746

Browse files
committed
Replace methods with accessors
Addresses #349
1 parent 276ee71 commit de14746

17 files changed

Lines changed: 1498 additions & 452 deletions

‎src/materials/AdaptiveLuminanceMaterial.js‎

Lines changed: 96 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,21 @@ export class AdaptiveLuminanceMaterial extends ShaderMaterial {
4343
}
4444

4545
/**
46-
* Sets the primary luminance buffer which contains the downsampled average luminance.
46+
* The primary luminance buffer that contains the downsampled average luminance.
4747
*
48+
* @type {Texture}
49+
*/
50+
51+
set luminanceBuffer0() {
52+
53+
this.uniforms.luminanceBuffer0.value = value;
54+
55+
}
56+
57+
/**
58+
* Sets the primary luminance buffer that contains the downsampled average luminance.
59+
*
60+
* @deprecated Use luminanceBuffer0 instead.
4861
* @param {Texture} value - The buffer.
4962
*/
5063

@@ -54,9 +67,22 @@ export class AdaptiveLuminanceMaterial extends ShaderMaterial {
5467

5568
}
5669

70+
/**
71+
* The secondary luminance buffer.
72+
*
73+
* @type {Texture}
74+
*/
75+
76+
set luminanceBuffer1() {
77+
78+
this.uniforms.luminanceBuffer1.value = value;
79+
80+
}
81+
5782
/**
5883
* Sets the secondary luminance buffer.
5984
*
85+
* @deprecated Use luminanceBuffer1 instead.
6086
* @param {Texture} value - The buffer.
6187
*/
6288

@@ -67,23 +93,49 @@ export class AdaptiveLuminanceMaterial extends ShaderMaterial {
6793
}
6894

6995
/**
70-
* Sets the 1x1 mipmap level.
96+
* The 1x1 mipmap level.
7197
*
7298
* This level is used to identify the smallest mipmap of the primary luminance buffer.
7399
*
74-
* @param {Number} value - The level.
100+
* @type {Number}
75101
*/
76102

77-
setMipLevel1x1(value) {
103+
set mipLevel1x1() {
78104

79105
this.defines.MIP_LEVEL_1X1 = value.toFixed(1);
80106
this.needsUpdate = true;
81107

82108
}
83109

110+
/**
111+
* Sets the 1x1 mipmap level.
112+
*
113+
* @deprecated Use mipLevel1x1 instead.
114+
* @param {Number} value - The level.
115+
*/
116+
117+
setMipLevel1x1(value) {
118+
119+
this.mipLevel1x1 = value;
120+
121+
}
122+
123+
/**
124+
* The delta time.
125+
*
126+
* @type {Number}
127+
*/
128+
129+
set deltaTime(value) {
130+
131+
this.uniforms.deltaTime.value = value;
132+
133+
}
134+
84135
/**
85136
* Sets the delta time.
86137
*
138+
* @deprecated Use deltaTime instead.
87139
* @param {Number} value - The delta time.
88140
*/
89141

@@ -93,9 +145,28 @@ export class AdaptiveLuminanceMaterial extends ShaderMaterial {
93145

94146
}
95147

148+
/**
149+
* The lowest possible luminance value.
150+
*
151+
* @type {Number}
152+
*/
153+
154+
get minLuminance() {
155+
156+
return this.uniforms.minLuminance.value;
157+
158+
}
159+
160+
set minLuminance(value) {
161+
162+
this.uniforms.minLuminance.value = value;
163+
164+
}
165+
96166
/**
97167
* Returns the lowest possible luminance value.
98168
*
169+
* @deprecated Use minLuminance instead.
99170
* @return {Number} The minimum luminance.
100171
*/
101172

@@ -108,6 +179,7 @@ export class AdaptiveLuminanceMaterial extends ShaderMaterial {
108179
/**
109180
* Sets the minimum luminance.
110181
*
182+
* @deprecated Use minLuminance instead.
111183
* @param {Number} value - The minimum luminance.
112184
*/
113185

@@ -117,9 +189,28 @@ export class AdaptiveLuminanceMaterial extends ShaderMaterial {
117189

118190
}
119191

192+
/**
193+
* The luminance adaptation rate.
194+
*
195+
* @type {Number}
196+
*/
197+
198+
get adaptationRate() {
199+
200+
return this.uniforms.tau.value;
201+
202+
}
203+
204+
set adaptationRate(value) {
205+
206+
this.uniforms.tau.value = value;
207+
208+
}
209+
120210
/**
121211
* Returns the luminance adaptation rate.
122212
*
213+
* @deprecated Use adaptationRate instead.
123214
* @return {Number} The adaptation rate.
124215
*/
125216

@@ -132,6 +223,7 @@ export class AdaptiveLuminanceMaterial extends ShaderMaterial {
132223
/**
133224
* Sets the luminance adaptation rate.
134225
*
226+
* @deprecated Use adaptationRate instead.
135227
* @param {Number} value - The adaptation rate.
136228
*/
137229

‎src/materials/BokehMaterial.js‎

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,23 @@ export class BokehMaterial extends ShaderMaterial {
5656

5757
}
5858

59+
/**
60+
* The input buffer.
61+
*
62+
* @type {Texture}
63+
*/
64+
65+
set inputBuffer(value) {
66+
67+
this.uniforms.inputBuffer.value = value;
68+
69+
}
70+
5971
/**
6072
* Sets the input buffer.
6173
*
62-
* @param {Number} value - The buffer.
74+
* @deprecated Use inputBuffer instead.
75+
* @param {Texture} value - The buffer.
6376
*/
6477

6578
setInputBuffer(value) {
@@ -68,10 +81,23 @@ export class BokehMaterial extends ShaderMaterial {
6881

6982
}
7083

84+
/**
85+
* The circle of confusion buffer.
86+
*
87+
* @type {Texture}
88+
*/
89+
90+
set cocBuffer(value) {
91+
92+
this.uniforms.cocBuffer.value = value;
93+
94+
}
95+
7196
/**
7297
* Sets the circle of confusion buffer.
7398
*
74-
* @param {Number} value - The buffer.
99+
* @deprecated Use cocBuffer instead.
100+
* @param {Texture} value - The buffer.
75101
*/
76102

77103
setCoCBuffer(value) {
@@ -80,9 +106,28 @@ export class BokehMaterial extends ShaderMaterial {
80106

81107
}
82108

109+
/**
110+
* The blur scale.
111+
*
112+
* @type {Number}
113+
*/
114+
115+
get scale() {
116+
117+
return this.uniforms.scale.value;
118+
119+
}
120+
121+
set scale(value) {
122+
123+
this.uniforms.scale.value = value;
124+
125+
}
126+
83127
/**
84128
* Returns the blur scale.
85129
*
130+
* @deprecated Use scale instead.
86131
* @return {Number} The scale.
87132
*/
88133

@@ -95,6 +140,7 @@ export class BokehMaterial extends ShaderMaterial {
95140
/**
96141
* Sets the blur scale.
97142
*
143+
* @deprecated Use scale instead.
98144
* @param {Number} value - The scale.
99145
*/
100146

‎src/materials/CircleOfConfusionMaterial.js‎

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,50 +44,67 @@ export class CircleOfConfusionMaterial extends ShaderMaterial {
4444
}
4545

4646
/**
47-
* Sets the depth buffer.
47+
* The depth buffer.
4848
*
49-
* @param {Texture} buffer - The depth texture.
50-
* @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy.
49+
* @type {Texture}
5150
*/
5251

53-
setDepthBuffer(buffer, depthPacking = BasicDepthPacking) {
52+
set depthBuffer(value) {
5453

55-
this.uniforms.depthBuffer.value = buffer;
56-
this.defines.DEPTH_PACKING = depthPacking.toFixed(0);
57-
this.needsUpdate = true;
54+
this.uniforms.depthBuffer.value = value;
5855

5956
}
6057

6158
/**
62-
* The current depth packing.
59+
* The depth packing strategy.
6360
*
6461
* @type {DepthPackingStrategies}
65-
* @deprecated Removed without replacement.
6662
*/
6763

68-
get depthPacking() {
64+
set depthPacking(value) {
6965

70-
return Number(this.defines.DEPTH_PACKING);
66+
this.defines.DEPTH_PACKING = value.toFixed(0);
67+
this.needsUpdate = true;
7168

7269
}
7370

7471
/**
75-
* Sets the depth packing.
72+
* Sets the depth buffer.
7673
*
77-
* @type {DepthPackingStrategies}
78-
* @deprecated Use setDepthBuffer() instead.
74+
* @deprecated Use depthBuffer and depthPacking instead.
75+
* @param {Texture} buffer - The depth texture.
76+
* @param {DepthPackingStrategies} [depthPacking=BasicDepthPacking] - The depth packing strategy.
7977
*/
8078

81-
set depthPacking(value) {
79+
setDepthBuffer(buffer, depthPacking = BasicDepthPacking) {
8280

83-
this.defines.DEPTH_PACKING = value.toFixed(0);
84-
this.needsUpdate = true;
81+
this.depthBuffer = buffer;
82+
this.depthPacking = depthPacking;
83+
84+
}
85+
86+
/**
87+
* The focus distance.
88+
*
89+
* @type {Number}
90+
*/
91+
92+
get focusDistance() {
93+
94+
return this.uniforms.focusDistance.value;
95+
96+
}
97+
98+
set focusDistance(value) {
99+
100+
this.uniforms.focusDistance.value = value;
85101

86102
}
87103

88104
/**
89105
* Returns the focus distance.
90106
*
107+
* @deprecated Use focusDistance instead.
91108
* @return {Number} The focus distance.
92109
*/
93110

@@ -100,6 +117,7 @@ export class CircleOfConfusionMaterial extends ShaderMaterial {
100117
/**
101118
* Sets the focus distance.
102119
*
120+
* @deprecated Use focusDistance instead.
103121
* @param {Number} value - The focus distance.
104122
*/
105123

@@ -109,9 +127,28 @@ export class CircleOfConfusionMaterial extends ShaderMaterial {
109127

110128
}
111129

130+
/**
131+
* The focal length.
132+
*
133+
* @type {Number}
134+
*/
135+
136+
get focalLength() {
137+
138+
return this.uniforms.focalLength.value;
139+
140+
}
141+
142+
set focalLength(value) {
143+
144+
this.uniforms.focalLength.value = value;
145+
146+
}
147+
112148
/**
113149
* Returns the focal length.
114150
*
151+
* @deprecated Use focalLength instead.
115152
* @return {Number} The focal length.
116153
*/
117154

@@ -124,6 +161,7 @@ export class CircleOfConfusionMaterial extends ShaderMaterial {
124161
/**
125162
* Sets the focal length.
126163
*
164+
* @deprecated Use focalLength instead.
127165
* @param {Number} value - The focal length.
128166
*/
129167

0 commit comments

Comments
 (0)