-
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
88a08c2
commit 6c52b5f
Showing
41 changed files
with
1,684 additions
and
1,480 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,44 @@ | ||
import { vertex } from '@tools/fragments'; | ||
import fragment from './extract-brightness.frag'; | ||
import { Filter } from '@pixi/core'; | ||
import { Filter, GlProgram } from 'pixi.js'; | ||
|
||
/** | ||
* Internal filter for AdvancedBloomFilter to get brightness. | ||
* @class | ||
* @private | ||
*/ | ||
class ExtractBrightnessFilter extends Filter | ||
export class ExtractBrightnessFilter extends Filter | ||
{ | ||
/** | ||
* @param {number} [threshold] - Defines how bright a color needs to be extracted. | ||
*/ | ||
constructor(threshold = 0.5) | ||
{ | ||
super(vertex, fragment); | ||
const glProgram = new GlProgram({ | ||
vertex, | ||
fragment, | ||
name: 'extract-brightness-filter', | ||
}); | ||
|
||
this.threshold = threshold; | ||
super({ | ||
glProgram, | ||
resources: {}, | ||
}); | ||
|
||
// 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; | ||
} | ||
// get threshold(): number | ||
// { | ||
// return this.uniforms.threshold; | ||
// } | ||
// set threshold(value: number) | ||
// { | ||
// this.uniforms.threshold = value; | ||
// } | ||
} | ||
|
||
export { ExtractBrightnessFilter }; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.