Skip to content

Commit d5c91e2

Browse files
committed
Replace methods with accessors
Addresses #349
1 parent 4738cc9 commit d5c91e2

28 files changed

Lines changed: 1244 additions & 480 deletions

‎manual/content/_index.en.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ WIP
2828

2929
## Output Encoding
3030

31-
It's recommended to follow a [linear workflow](https://docs.unity3d.com/Manual/LinearRendering-LinearOrGammaWorkflow.html) for color management and `postprocessing` supports this automatically. Simply set `WebGLRenderer.outputEncoding` to `sRGBEncoding` and `postprocessing` will follow suit. Built-in passes automatically encode colors when they render to screen and internal render operations are always performed in linear color space.
31+
New applications should follow a [linear workflow](https://docs.unity3d.com/Manual/LinearRendering-LinearOrGammaWorkflow.html) for color management and `postprocessing` supports this automatically. Simply set `WebGLRenderer.outputEncoding` to `sRGBEncoding` and `postprocessing` will follow suit. Built-in passes automatically encode colors when they render to screen and internal render operations are always performed in linear color space.
3232

3333
## Performance
3434

‎src/effects/BloomEffect.js‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ export class BloomEffect extends Effect {
6969
* This pass can be disabled to skip luminance filtering.
7070
*
7171
* @type {LuminancePass}
72-
* @deprecated Use getLuminancePass() instead.
7372
*/
7473

7574
this.luminancePass = new LuminancePass({
@@ -84,7 +83,6 @@ export class BloomEffect extends Effect {
8483
* A blur pass.
8584
*
8685
* @type {KawaseBlurPass}
87-
* @deprecated Use getBlurPass() instead.
8886
*/
8987

9088
this.blurPass = new KawaseBlurPass({ resolutionScale, width, height, kernelSize });
@@ -98,7 +96,6 @@ export class BloomEffect extends Effect {
9896
* A texture that contains the intermediate result of this effect.
9997
*
10098
* @type {Texture}
101-
* @deprecated Use getTexture() instead.
10299
*/
103100

104101
get texture() {
@@ -110,6 +107,7 @@ export class BloomEffect extends Effect {
110107
/**
111108
* Returns the generated bloom texture.
112109
*
110+
* @deprecated Use texture instead.
113111
* @return {Texture} The texture.
114112
*/
115113

@@ -123,7 +121,6 @@ export class BloomEffect extends Effect {
123121
* The resolution of this effect.
124122
*
125123
* @type {Resolution}
126-
* @deprecated Use getResolution() instead.
127124
*/
128125

129126
get resolution() {
@@ -135,6 +132,7 @@ export class BloomEffect extends Effect {
135132
/**
136133
* Returns the resolution settings.
137134
*
135+
* @deprecated Use resolution instead.
138136
* @return {Resolution} The resolution.
139137
*/
140138

@@ -147,6 +145,7 @@ export class BloomEffect extends Effect {
147145
/**
148146
* Returns the blur pass.
149147
*
148+
* @deprecated Use blurPass instead.
150149
* @return {KawaseBlurPass} The blur pass.
151150
*/
152151

@@ -159,6 +158,7 @@ export class BloomEffect extends Effect {
159158
/**
160159
* Returns the luminance pass.
161160
*
161+
* @deprecated Use luminancePass instead.
162162
* @return {LuminancePass} The luminance pass.
163163
*/
164164

@@ -172,7 +172,6 @@ export class BloomEffect extends Effect {
172172
* The luminance material.
173173
*
174174
* @type {LuminanceMaterial}
175-
* @deprecated Use getLuminanceMaterial() instead.
176175
*/
177176

178177
get luminanceMaterial() {
@@ -184,6 +183,7 @@ export class BloomEffect extends Effect {
184183
/**
185184
* Returns the luminance material.
186185
*
186+
* @deprecated Use luminanceMaterial instead.
187187
* @return {LuminanceMaterial} The material.
188188
*/
189189

@@ -197,7 +197,7 @@ export class BloomEffect extends Effect {
197197
* The current width of the internal render targets.
198198
*
199199
* @type {Number}
200-
* @deprecated Use getResolution().getWidth() instead.
200+
* @deprecated Use resolution.width instead.
201201
*/
202202

203203
get width() {
@@ -216,7 +216,7 @@ export class BloomEffect extends Effect {
216216
* The current height of the internal render targets.
217217
*
218218
* @type {Number}
219-
* @deprecated Use getResolution().getHeight() instead.
219+
* @deprecated Use resolution.height instead.
220220
*/
221221

222222
get height() {
@@ -254,7 +254,7 @@ export class BloomEffect extends Effect {
254254
* The blur kernel size.
255255
*
256256
* @type {KernelSize}
257-
* @deprecated Use getBlurPass().getKernelSize() instead.
257+
* @deprecated Use blurPass.kernelSize instead.
258258
*/
259259

260260
get kernelSize() {
@@ -271,7 +271,7 @@ export class BloomEffect extends Effect {
271271

272272
/**
273273
* @type {Number}
274-
* @deprecated Use getLuminanceMaterial().getThreshold() and ...getSmoothingFactor() instead.
274+
* @deprecated Use luminanceMaterial instead.
275275
*/
276276

277277
get distinction() {
@@ -291,7 +291,6 @@ export class BloomEffect extends Effect {
291291
* The bloom intensity.
292292
*
293293
* @type {Number}
294-
* @deprecated Use getIntensity() instead.
295294
*/
296295

297296
get intensity() {
@@ -309,6 +308,7 @@ export class BloomEffect extends Effect {
309308
/**
310309
* The bloom intensity.
311310
*
311+
* @deprecated Use intensity instead.
312312
* @return {Number} The intensity.
313313
*/
314314

@@ -321,6 +321,7 @@ export class BloomEffect extends Effect {
321321
/**
322322
* Sets the bloom intensity.
323323
*
324+
* @deprecated Use intensity instead.
324325
* @param {Number} value - The intensity.
325326
*/
326327

@@ -334,7 +335,7 @@ export class BloomEffect extends Effect {
334335
* Returns the current resolution scale.
335336
*
336337
* @return {Number} The resolution scale.
337-
* @deprecated Use getResolution().setPreferredWidth() or getResolution().setPreferredHeight() instead.
338+
* @deprecated Use resolution instead.
338339
*/
339340

340341
getResolutionScale() {
@@ -347,7 +348,7 @@ export class BloomEffect extends Effect {
347348
* Sets the resolution scale.
348349
*
349350
* @param {Number} scale - The new resolution scale.
350-
* @deprecated Use getResolution().setPreferredWidth() or getResolution().setPreferredHeight() instead.
351+
* @deprecated Use resolution instead.
351352
*/
352353

353354
setResolutionScale(scale) {

‎src/effects/BrightnessContrastEffect.js‎

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,51 +33,91 @@ export class BrightnessContrastEffect extends Effect {
3333

3434
}
3535

36+
/**
37+
* The brightness.
38+
*
39+
* @type {Number}
40+
*/
41+
42+
get brightness() {
43+
44+
return this.uniforms.get("brightness").value;
45+
46+
}
47+
48+
set brightness(value) {
49+
50+
this.uniforms.get("brightness").value = value;
51+
52+
}
53+
3654
/**
3755
* Returns the brightness.
3856
*
57+
* @deprecated Use brightness instead.
3958
* @return {Number} The brightness.
4059
*/
4160

4261
getBrightness(value) {
4362

44-
return this.uniforms.get("brightness").value;
63+
return this.brightness;
4564

4665
}
4766

4867
/**
4968
* Sets the brightness.
5069
*
70+
* @deprecated Use brightness instead.
5171
* @param {Number} value - The brightness.
5272
*/
5373

5474
setBrightness(value) {
5575

56-
this.uniforms.get("brightness").value = value;
76+
this.brightness = value;
77+
78+
}
79+
80+
/**
81+
* The contrast.
82+
*
83+
* @type {Number}
84+
*/
85+
86+
get contrast() {
87+
88+
return this.uniforms.get("contrast").value;
89+
90+
}
91+
92+
set contrast(value) {
93+
94+
this.uniforms.get("contrast").value = value;
5795

5896
}
5997

6098
/**
6199
* Returns the contrast.
62100
*
101+
* @deprecated Use contrast instead.
63102
* @return {Number} The contrast.
64103
*/
65104

66105
getContrast(value) {
67106

68-
return this.uniforms.get("contrast").value;
107+
return this.contrast;
69108

70109
}
71110

72111
/**
73112
* Sets the contrast.
74113
*
114+
* @deprecated Use contrast instead.
75115
* @param {Number} value - The contrast.
76116
*/
77117

78118
setContrast(value) {
79119

80-
this.uniforms.get("contrast").value = value;
120+
this.contrast = value;
81121

82122
}
83123

‎src/effects/ChromaticAberrationEffect.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export class ChromaticAberrationEffect extends Effect {
3636
* The color offset.
3737
*
3838
* @type {Vector2}
39-
* @deprecated Use getOffset() instead.
4039
*/
4140

4241
get offset() {
@@ -54,6 +53,7 @@ export class ChromaticAberrationEffect extends Effect {
5453
/**
5554
* Returns the color offset vector.
5655
*
56+
* @deprecated Use offset instead.
5757
* @return {Vector2} The offset.
5858
*/
5959

@@ -66,6 +66,7 @@ export class ChromaticAberrationEffect extends Effect {
6666
/**
6767
* Sets the color offset vector.
6868
*
69+
* @deprecated Use offset instead.
6970
* @param {Vector2} value - The offset.
7071
*/
7172

‎src/effects/ColorDepthEffect.js‎

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,28 @@ export class ColorDepthEffect extends Effect {
3737
*/
3838

3939
this.bits = 0;
40-
this.setBitDepth(bits);
40+
this.bitDepth = bits;
41+
42+
}
43+
44+
/**
45+
* The virtual amount of color bits.
46+
*
47+
* Each color channel effectively uses a fourth of the total amount of bits. Alpha remains unaffected.
48+
*
49+
* @type {Number}
50+
*/
51+
52+
get bitDepth() {
53+
54+
return this.bits;
55+
56+
}
57+
58+
set bitDepth(value) {
59+
60+
this.bits = value;
61+
this.uniforms.get("factor").value = Math.pow(2.0, value / 3.0);
4162

4263
}
4364

@@ -49,7 +70,7 @@ export class ColorDepthEffect extends Effect {
4970

5071
getBitDepth() {
5172

52-
return this.bits;
73+
return this.bitDepth;
5374

5475
}
5576

@@ -61,8 +82,7 @@ export class ColorDepthEffect extends Effect {
6182

6283
setBitDepth(value) {
6384

64-
this.bits = value;
65-
this.uniforms.get("factor").value = Math.pow(2.0, value / 3.0);
85+
this.bitDepth = value;
6686

6787
}
6888

‎src/effects/DepthEffect.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export class DepthEffect extends Effect {
3434
* Indicates whether depth should be inverted.
3535
*
3636
* @type {Boolean}
37-
* @deprecated Use isInverted() instead.
3837
*/
3938

4039
get inverted() {
@@ -66,6 +65,7 @@ export class DepthEffect extends Effect {
6665
/**
6766
* Indicates whether the rendered depth is inverted.
6867
*
68+
* @deprecated Use inverted instead.
6969
* @return {Boolean} Whether the rendered depth is inverted.
7070
*/
7171

@@ -78,6 +78,7 @@ export class DepthEffect extends Effect {
7878
/**
7979
* Enables or disables depth inversion.
8080
*
81+
* @deprecated Use inverted instead.
8182
* @param {Boolean} value - Whether depth should be inverted.
8283
*/
8384

0 commit comments

Comments
 (0)