- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
import { vertex } from '@tools/fragments';
import fragment from './extract-brightness.frag';
import { Filter } from '@pixi/core';
/**
* Internal filter for AdvancedBloomFilter to get brightness.
* @class
* @private
*/
class ExtractBrightnessFilter extends Filter
{
/**
* @param {number} [threshold] - Defines how bright a color needs to be extracted.
*/
constructor(threshold = 0.5)
{
super(vertex, fragment);
this.threshold = threshold;
}
/**
* Defines how bright a color needs to be extracted.
*
* @default 0.5
*/
get threshold(): number
{
return this.uniforms.threshold;
}
set threshold(value: number)
{
this.uniforms.threshold = value;
}
}
export { ExtractBrightnessFilter };