1 line
3.3 KiB
Plaintext
1 line
3.3 KiB
Plaintext
{"version":3,"file":"LinearDodgeBlend.mjs","sources":["../../src/advanced-blend-modes/LinearDodgeBlend.ts"],"sourcesContent":["/* eslint-disable max-len */\n\nimport { ExtensionType } from '../extensions/Extensions';\nimport { BlendModeFilter } from '../filters/blend-modes/BlendModeFilter';\n\nimport type { ExtensionMetadata } from '../extensions/Extensions';\n\n/**\n * Looks at the color information in each channel and brightens the base color to reflect the blend color by decreasing contrast between the two.\n * Available as `container.blendMode = 'linear-dodge'` after importing `pixi.js/advanced-blend-modes`.\n * @example\n * import 'pixi.js/advanced-blend-modes';\n * import { Sprite } from 'pixi.js';\n *\n * const sprite = Sprite.from('something.png');\n * sprite.blendMode = 'linear-dodge'\n * @memberof filters\n */\nexport class LinearDodgeBlend extends BlendModeFilter\n{\n /** @ignore */\n public static extension: ExtensionMetadata = {\n name: 'linear-dodge',\n type: ExtensionType.BlendMode\n };\n\n constructor()\n {\n super({\n gl: {\n functions: `\n float linearDodge(float base, float blend) {\n return min(1.0, base + blend);\n }\n\n vec3 blendLinearDodge(vec3 base, vec3 blend, float opacity) {\n vec3 blended = vec3(\n linearDodge(base.r, blend.r),\n linearDodge(base.g, blend.g),\n linearDodge(base.b, blend.b)\n );\n return (blended * opacity + base * (1.0 - opacity));\n }\n `,\n main: `\n finalColor = vec4(blendLinearDodge(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n `\n },\n gpu: {\n functions: `\n fn linearDodge(base: f32, blend: f32) -> f32\n {\n return min(1, base + blend);\n }\n\n fn blendLinearDodge(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n let blended = vec3<f32>(\n linearDodge(base.r, blend.r),\n linearDodge(base.g, blend.g),\n linearDodge(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n `,\n main: `\n out = vec4<f32>(blendLinearDodge(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n `\n }\n });\n }\n}\n"],"names":[],"mappings":";;;;AAkBO,MAAM,yBAAyB,eACtC,CAAA;AAAA,EAOI,WACA,GAAA;AACI,IAAM,KAAA,CAAA;AAAA,MACF,EAAI,EAAA;AAAA,QACA,SAAW,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAA,CAAA;AAAA,QAcX,IAAM,EAAA,CAAA;AAAA;AAAA,gBAAA,CAAA;AAAA,OAGV;AAAA,MACA,GAAK,EAAA;AAAA,QACD,SAAW,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAA,CAAA;AAAA,QAiBX,IAAM,EAAA,CAAA;AAAA;AAAA,YAAA,CAAA;AAAA,OAGV;AAAA,KACH,CAAA,CAAA;AAAA,GACL;AACJ,CAAA;AAAA;AAtDa,gBAAA,CAGK,SAA+B,GAAA;AAAA,EACzC,IAAM,EAAA,cAAA;AAAA,EACN,MAAM,aAAc,CAAA,SAAA;AACxB,CAAA;;;;"} |