babylon.sharpenPostProcess.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334
  1. module BABYLON {
  2. /**
  3. * The SharpenPostProcess applies a sharpen kernel to every pixel
  4. * See http://en.wikipedia.org/wiki/Kernel_(image_processing)
  5. */
  6. export class SharpenPostProcess extends PostProcess{
  7. /**
  8. * How much of the original color should be applied. Setting this to 0 will display edge detection. (default: 1)
  9. */
  10. public colorAmount:number = 1.0;
  11. /**
  12. * How much sharpness should be applied (default: 0.3)
  13. */
  14. public edgeAmount:number = 0.3;
  15. /**
  16. * Creates a new instance of @see ConvolutionPostProcess
  17. * @param name The name of the effect.
  18. * @param options The required width/height ratio to downsize to before computing the render pass.
  19. * @param camera The camera to apply the render pass to.
  20. * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)
  21. * @param engine The engine which the post process will be applied. (default: current engine)
  22. * @param reusable If the post process can be reused on the same frame. (default: false)
  23. * @param textureType Type of textures used when performing the post process. (default: 0)
  24. */
  25. constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT) {
  26. super(name, "sharpen", ["sharpnessAmounts", "screenSize"], null, options, camera, samplingMode, engine, reusable, null, textureType);
  27. this.onApply = (effect: Effect) => {
  28. effect.setFloat2("screenSize", this.width, this.height);
  29. effect.setFloat2("sharpnessAmounts", this.edgeAmount, this.colorAmount);
  30. };
  31. }
  32. }
  33. }