-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Feu-Secret/tokenmagic-dev
Update v0.2.0-alpha
- Loading branch information
Showing
23 changed files
with
1,215 additions
and
169 deletions.
There are no files selected for viewing
Binary file not shown.
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
Binary file not shown.
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
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import { magicGlow } from '../glsl/fragmentshaders/magicglow.js'; | ||
import { customVertex2D } from '../glsl/vertexshaders/customvertex2D.js'; | ||
import { Anime } from "../Anime.js"; | ||
import "./proto/FilterProto.js"; | ||
|
||
export class FilterGleamingGlow extends PIXI.Filter { | ||
|
||
constructor(params) { | ||
|
||
let { | ||
time, | ||
color, | ||
thickness, | ||
scale, | ||
auraIntensity, | ||
subAuraIntensity, | ||
discard, | ||
threshold, | ||
auraType | ||
} = Object.assign({}, FilterGleamingGlow.defaults, params); | ||
|
||
// using specific vertex shader and fragment shader | ||
super(customVertex2D, magicGlow); | ||
|
||
this.uniforms.color = new Float32Array([1.0, 0.4, 0.1, 1.0]); | ||
this.uniforms.thickness = new Float32Array([0.01, 0.01]); | ||
|
||
Object.assign(this, { | ||
time, color, thickness, scale, auraIntensity, subAuraIntensity, discard, threshold, auraType | ||
}); | ||
|
||
this.animated = {}; | ||
this.setTMParams(params); | ||
this.anime = new Anime(this); | ||
this.normalizeTMParams(); | ||
} | ||
|
||
get time() { | ||
return this.uniforms.time; | ||
} | ||
|
||
set time(value) { | ||
this.uniforms.time = value; | ||
} | ||
|
||
get scale() { | ||
return this.uniforms.scale; | ||
} | ||
|
||
set scale(value) { | ||
this.uniforms.scale = value; | ||
} | ||
|
||
get auraIntensity() { | ||
return this.uniforms.auraIntensity; | ||
} | ||
|
||
set auraIntensity(value) { | ||
this.uniforms.auraIntensity = value; | ||
} | ||
|
||
get subAuraIntensity() { | ||
return this.uniforms.subAuraIntensity; | ||
} | ||
|
||
set subAuraIntensity(value) { | ||
this.uniforms.subAuraIntensity = value; | ||
} | ||
|
||
get threshold() { | ||
return this.uniforms.threshold; | ||
} | ||
|
||
set threshold(value) { | ||
this.uniforms.threshold = value; | ||
} | ||
|
||
get color() { | ||
return PIXI.utils.rgb2hex(this.uniforms.color); | ||
} | ||
|
||
set color(value) { | ||
PIXI.utils.hex2rgb(value, this.uniforms.color); | ||
} | ||
|
||
get discard() { | ||
return this.uniforms.holes; | ||
} | ||
|
||
set discard(value) { | ||
if (!(value == null) && typeof value === "boolean") { | ||
this.uniforms.holes = value; | ||
} | ||
} | ||
|
||
get auraType() { | ||
return this.uniforms.auraType; | ||
} | ||
|
||
set auraType(value) { | ||
this.uniforms.auraType = Math.floor(value); | ||
} | ||
|
||
apply(filterManager, input, output, clear) { | ||
this.uniforms.thickness[0] = (this.thickness * this.placeableImg.parent.worldTransform.a) / input._frame.width; | ||
this.uniforms.thickness[1] = (this.thickness * this.placeableImg.parent.worldTransform.a) / input._frame.height; | ||
filterManager.applyFilter(this, input, output, clear); | ||
} | ||
} | ||
|
||
FilterGleamingGlow.defaults = { | ||
time: 0, | ||
color: 0xFF8010, | ||
thickness: 5, | ||
scale: 1, | ||
auraIntensity: 1, | ||
subAuraIntensity: 1, | ||
discard: false, | ||
threshold: 0.5, | ||
auraType: 1, | ||
}; | ||
|
||
|
||
|
||
|
Oops, something went wrong.