sdfsdfs
This commit is contained in:
80
node_modules/pixi.js/lib/advanced-blend-modes/LinearLightBlend.js
generated
vendored
Normal file
80
node_modules/pixi.js/lib/advanced-blend-modes/LinearLightBlend.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../extensions/Extensions.js');
|
||||
var BlendModeFilter = require('../filters/blend-modes/BlendModeFilter.js');
|
||||
|
||||
"use strict";
|
||||
class LinearLightBlend extends BlendModeFilter.BlendModeFilter {
|
||||
constructor() {
|
||||
super({
|
||||
gl: {
|
||||
functions: `
|
||||
float linearBurn(float base, float blend) {
|
||||
return max(0.0, base + blend - 1.0);
|
||||
}
|
||||
|
||||
float linearDodge(float base, float blend) {
|
||||
return min(1.0, base + blend);
|
||||
}
|
||||
|
||||
float linearLight(float base, float blend) {
|
||||
return (blend <= 0.5) ? linearBurn(base,2.0*blend) : linearBurn(base,2.0*(blend-0.5));
|
||||
}
|
||||
|
||||
vec3 blendLinearLight(vec3 base, vec3 blend, float opacity) {
|
||||
vec3 blended = vec3(
|
||||
linearLight(base.r, blend.r),
|
||||
linearLight(base.g, blend.g),
|
||||
linearLight(base.b, blend.b)
|
||||
);
|
||||
|
||||
return (blended * opacity + base * (1.0 - opacity));
|
||||
}
|
||||
`,
|
||||
main: `
|
||||
finalColor = vec4(blendLinearLight(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;
|
||||
`
|
||||
},
|
||||
gpu: {
|
||||
functions: `
|
||||
fn linearBurn(base: f32, blend: f32) -> f32
|
||||
{
|
||||
return max(0.0, base + blend - 1.0);
|
||||
}
|
||||
|
||||
fn linearDodge(base: f32, blend: f32) -> f32
|
||||
{
|
||||
return min(1.0, base + blend);
|
||||
}
|
||||
|
||||
fn linearLight(base: f32, blend: f32) -> f32
|
||||
{
|
||||
return select(linearBurn(base,2.0*(blend-0.5)), linearBurn(base,2.0*blend), blend <= 0.5);
|
||||
}
|
||||
|
||||
fn blendLinearLightOpacity(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>
|
||||
{
|
||||
let blended = vec3<f32>(
|
||||
linearLight(base.r, blend.r),
|
||||
linearLight(base.g, blend.g),
|
||||
linearLight(base.b, blend.b)
|
||||
);
|
||||
|
||||
return (blended * opacity + base * (1.0 - opacity));
|
||||
}
|
||||
`,
|
||||
main: `
|
||||
out = vec4<f32>(blendLinearLightOpacity(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;
|
||||
`
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/** @ignore */
|
||||
LinearLightBlend.extension = {
|
||||
name: "linear-light",
|
||||
type: Extensions.ExtensionType.BlendMode
|
||||
};
|
||||
|
||||
exports.LinearLightBlend = LinearLightBlend;
|
||||
//# sourceMappingURL=LinearLightBlend.js.map
|
Reference in New Issue
Block a user