Files
nothoughts/node_modules/pixi.js/lib/advanced-blend-modes/LinearLightBlend.mjs.map
2025-08-04 18:57:35 +02:00

1 line
4.0 KiB
Plaintext

{"version":3,"file":"LinearLightBlend.mjs","sources":["../../src/advanced-blend-modes/LinearLightBlend.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 * Increase or decrease brightness by burning or dodging color values, based on the blend color\n * Available as `container.blendMode = 'linear-light'` 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-light'\n * @memberof filters\n */\nexport class LinearLightBlend extends BlendModeFilter\n{\n /** @ignore */\n public static extension: ExtensionMetadata = {\n name: 'linear-light',\n type: ExtensionType.BlendMode\n };\n\n constructor()\n {\n super({\n gl: {\n functions: `\n float linearBurn(float base, float blend) {\n return max(0.0, base + blend - 1.0);\n }\n\n float linearDodge(float base, float blend) {\n return min(1.0, base + blend);\n }\n\n float linearLight(float base, float blend) {\n return (blend <= 0.5) ? linearBurn(base,2.0*blend) : linearBurn(base,2.0*(blend-0.5));\n }\n\n vec3 blendLinearLight(vec3 base, vec3 blend, float opacity) {\n vec3 blended = vec3(\n linearLight(base.r, blend.r),\n linearLight(base.g, blend.g),\n linearLight(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n `,\n main: `\n finalColor = vec4(blendLinearLight(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n `\n },\n gpu: {\n functions: `\n fn linearBurn(base: f32, blend: f32) -> f32\n {\n return max(0.0, base + blend - 1.0);\n }\n\n fn linearDodge(base: f32, blend: f32) -> f32\n {\n return min(1.0, base + blend);\n }\n\n fn linearLight(base: f32, blend: f32) -> f32\n {\n return select(linearBurn(base,2.0*(blend-0.5)), linearBurn(base,2.0*blend), blend <= 0.5);\n }\n\n fn blendLinearLightOpacity(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n let blended = vec3<f32>(\n linearLight(base.r, blend.r),\n linearLight(base.g, blend.g),\n linearLight(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n `,\n main: `\n out = vec4<f32>(blendLinearLightOpacity(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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAA,CAAA;AAAA,QAuBX,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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAA,CAAA;AAAA,QA2BX,IAAM,EAAA,CAAA;AAAA;AAAA,YAAA,CAAA;AAAA,OAGV;AAAA,KACH,CAAA,CAAA;AAAA,GACL;AACJ,CAAA;AAAA;AAzEa,gBAAA,CAGK,SAA+B,GAAA;AAAA,EACzC,IAAM,EAAA,cAAA;AAAA,EACN,MAAM,aAAc,CAAA,SAAA;AACxB,CAAA;;;;"}