Skip to content

Commit

Permalink
Replace methods with accessors
Browse files Browse the repository at this point in the history
Addresses #349
  • Loading branch information
vanruesc committed Mar 8, 2022
1 parent 4738cc9 commit d5c91e2
Show file tree
Hide file tree
Showing 28 changed files with 1,244 additions and 480 deletions.
2 changes: 1 addition & 1 deletion manual/content/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ WIP

## Output Encoding

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.
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.

## Performance

Expand Down
25 changes: 13 additions & 12 deletions src/effects/BloomEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export class BloomEffect extends Effect {
* This pass can be disabled to skip luminance filtering.
*
* @type {LuminancePass}
* @deprecated Use getLuminancePass() instead.
*/

this.luminancePass = new LuminancePass({
Expand All @@ -84,7 +83,6 @@ export class BloomEffect extends Effect {
* A blur pass.
*
* @type {KawaseBlurPass}
* @deprecated Use getBlurPass() instead.
*/

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

get texture() {
Expand All @@ -110,6 +107,7 @@ export class BloomEffect extends Effect {
/**
* Returns the generated bloom texture.
*
* @deprecated Use texture instead.
* @return {Texture} The texture.
*/

Expand All @@ -123,7 +121,6 @@ export class BloomEffect extends Effect {
* The resolution of this effect.
*
* @type {Resolution}
* @deprecated Use getResolution() instead.
*/

get resolution() {
Expand All @@ -135,6 +132,7 @@ export class BloomEffect extends Effect {
/**
* Returns the resolution settings.
*
* @deprecated Use resolution instead.
* @return {Resolution} The resolution.
*/

Expand All @@ -147,6 +145,7 @@ export class BloomEffect extends Effect {
/**
* Returns the blur pass.
*
* @deprecated Use blurPass instead.
* @return {KawaseBlurPass} The blur pass.
*/

Expand All @@ -159,6 +158,7 @@ export class BloomEffect extends Effect {
/**
* Returns the luminance pass.
*
* @deprecated Use luminancePass instead.
* @return {LuminancePass} The luminance pass.
*/

Expand All @@ -172,7 +172,6 @@ export class BloomEffect extends Effect {
* The luminance material.
*
* @type {LuminanceMaterial}
* @deprecated Use getLuminanceMaterial() instead.
*/

get luminanceMaterial() {
Expand All @@ -184,6 +183,7 @@ export class BloomEffect extends Effect {
/**
* Returns the luminance material.
*
* @deprecated Use luminanceMaterial instead.
* @return {LuminanceMaterial} The material.
*/

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

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

get height() {
Expand Down Expand Up @@ -254,7 +254,7 @@ export class BloomEffect extends Effect {
* The blur kernel size.
*
* @type {KernelSize}
* @deprecated Use getBlurPass().getKernelSize() instead.
* @deprecated Use blurPass.kernelSize instead.
*/

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

/**
* @type {Number}
* @deprecated Use getLuminanceMaterial().getThreshold() and ...getSmoothingFactor() instead.
* @deprecated Use luminanceMaterial instead.
*/

get distinction() {
Expand All @@ -291,7 +291,6 @@ export class BloomEffect extends Effect {
* The bloom intensity.
*
* @type {Number}
* @deprecated Use getIntensity() instead.
*/

get intensity() {
Expand All @@ -309,6 +308,7 @@ export class BloomEffect extends Effect {
/**
* The bloom intensity.
*
* @deprecated Use intensity instead.
* @return {Number} The intensity.
*/

Expand All @@ -321,6 +321,7 @@ export class BloomEffect extends Effect {
/**
* Sets the bloom intensity.
*
* @deprecated Use intensity instead.
* @param {Number} value - The intensity.
*/

Expand All @@ -334,7 +335,7 @@ export class BloomEffect extends Effect {
* Returns the current resolution scale.
*
* @return {Number} The resolution scale.
* @deprecated Use getResolution().setPreferredWidth() or getResolution().setPreferredHeight() instead.
* @deprecated Use resolution instead.
*/

getResolutionScale() {
Expand All @@ -347,7 +348,7 @@ export class BloomEffect extends Effect {
* Sets the resolution scale.
*
* @param {Number} scale - The new resolution scale.
* @deprecated Use getResolution().setPreferredWidth() or getResolution().setPreferredHeight() instead.
* @deprecated Use resolution instead.
*/

setResolutionScale(scale) {
Expand Down
48 changes: 44 additions & 4 deletions src/effects/BrightnessContrastEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,51 +33,91 @@ export class BrightnessContrastEffect extends Effect {

}

/**
* The brightness.
*
* @type {Number}
*/

get brightness() {

return this.uniforms.get("brightness").value;

}

set brightness(value) {

this.uniforms.get("brightness").value = value;

}

/**
* Returns the brightness.
*
* @deprecated Use brightness instead.
* @return {Number} The brightness.
*/

getBrightness(value) {

return this.uniforms.get("brightness").value;
return this.brightness;

}

/**
* Sets the brightness.
*
* @deprecated Use brightness instead.
* @param {Number} value - The brightness.
*/

setBrightness(value) {

this.uniforms.get("brightness").value = value;
this.brightness = value;

}

/**
* The contrast.
*
* @type {Number}
*/

get contrast() {

return this.uniforms.get("contrast").value;

}

set contrast(value) {

this.uniforms.get("contrast").value = value;

}

/**
* Returns the contrast.
*
* @deprecated Use contrast instead.
* @return {Number} The contrast.
*/

getContrast(value) {

return this.uniforms.get("contrast").value;
return this.contrast;

}

/**
* Sets the contrast.
*
* @deprecated Use contrast instead.
* @param {Number} value - The contrast.
*/

setContrast(value) {

this.uniforms.get("contrast").value = value;
this.contrast = value;

}

Expand Down
3 changes: 2 additions & 1 deletion src/effects/ChromaticAberrationEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class ChromaticAberrationEffect extends Effect {
* The color offset.
*
* @type {Vector2}
* @deprecated Use getOffset() instead.
*/

get offset() {
Expand All @@ -54,6 +53,7 @@ export class ChromaticAberrationEffect extends Effect {
/**
* Returns the color offset vector.
*
* @deprecated Use offset instead.
* @return {Vector2} The offset.
*/

Expand All @@ -66,6 +66,7 @@ export class ChromaticAberrationEffect extends Effect {
/**
* Sets the color offset vector.
*
* @deprecated Use offset instead.
* @param {Vector2} value - The offset.
*/

Expand Down
28 changes: 24 additions & 4 deletions src/effects/ColorDepthEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,28 @@ export class ColorDepthEffect extends Effect {
*/

this.bits = 0;
this.setBitDepth(bits);
this.bitDepth = bits;

}

/**
* The virtual amount of color bits.
*
* Each color channel effectively uses a fourth of the total amount of bits. Alpha remains unaffected.
*
* @type {Number}
*/

get bitDepth() {

return this.bits;

}

set bitDepth(value) {

this.bits = value;
this.uniforms.get("factor").value = Math.pow(2.0, value / 3.0);

}

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

getBitDepth() {

return this.bits;
return this.bitDepth;

}

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

setBitDepth(value) {

this.bits = value;
this.uniforms.get("factor").value = Math.pow(2.0, value / 3.0);
this.bitDepth = value;

}

Expand Down
3 changes: 2 additions & 1 deletion src/effects/DepthEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export class DepthEffect extends Effect {
* Indicates whether depth should be inverted.
*
* @type {Boolean}
* @deprecated Use isInverted() instead.
*/

get inverted() {
Expand Down Expand Up @@ -66,6 +65,7 @@ export class DepthEffect extends Effect {
/**
* Indicates whether the rendered depth is inverted.
*
* @deprecated Use inverted instead.
* @return {Boolean} Whether the rendered depth is inverted.
*/

Expand All @@ -78,6 +78,7 @@ export class DepthEffect extends Effect {
/**
* Enables or disables depth inversion.
*
* @deprecated Use inverted instead.
* @param {Boolean} value - Whether depth should be inverted.
*/

Expand Down
Loading

0 comments on commit d5c91e2

Please sign in to comment.