pixi.js
Version:
<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">
1 lines • 4.54 kB
Source Map (JSON)
{"version":3,"file":"PrepareUpload.mjs","sources":["../../src/prepare/PrepareUpload.ts"],"sourcesContent":["import { TextureSource } from '../rendering/renderers/shared/texture/sources/TextureSource';\nimport { GraphicsContext } from '../scene/graphics/shared/GraphicsContext';\nimport { Text } from '../scene/text/Text';\nimport { BitmapText } from '../scene/text-bitmap/BitmapText';\nimport { HTMLText } from '../scene/text-html/HTMLText';\nimport { PrepareQueue } from './PrepareQueue';\n\nimport type { FillInstruction, TextureInstruction } from '../scene/graphics/shared/GraphicsContext';\nimport type { PrepareQueueItem } from './PrepareBase';\n\n/**\n * @advanced\n * Part of the prepare system. Responsible for uploading all the items to the GPU.\n * This class extends the resolver functionality and uploads the given queue items.\n * @category rendering\n */\nexport abstract class PrepareUpload extends PrepareQueue\n{\n /**\n * Upload the given queue item\n * @param item\n */\n protected uploadQueueItem(item: PrepareQueueItem): void\n {\n if (item instanceof TextureSource)\n {\n this.uploadTextureSource(item);\n }\n else if (item instanceof Text)\n {\n this.uploadText(item);\n }\n else if (item instanceof HTMLText)\n {\n this.uploadHTMLText(item);\n }\n else if (item instanceof BitmapText)\n {\n this.uploadBitmapText(item);\n }\n else if (item instanceof GraphicsContext)\n {\n this.uploadGraphicsContext(item);\n }\n }\n\n protected uploadTextureSource(textureSource: TextureSource): void\n {\n this.renderer.texture.initSource(textureSource);\n }\n\n protected uploadText(_text: Text): void\n {\n this.renderer.renderPipes.text.initGpuText(_text);\n }\n\n protected uploadBitmapText(_text: BitmapText): void\n {\n this.renderer.renderPipes.bitmapText.initGpuText(_text);\n }\n\n protected uploadHTMLText(_text: HTMLText): void\n {\n this.renderer.renderPipes.htmlText.initGpuText(_text);\n }\n\n /**\n * Resolve the given graphics context and return an item for the queue\n * @param graphicsContext\n */\n protected uploadGraphicsContext(graphicsContext: GraphicsContext): void\n {\n this.renderer.graphicsContext.getGpuContext(graphicsContext);\n\n const { instructions } = graphicsContext;\n\n for (const instruction of instructions)\n {\n if (instruction.action === 'texture')\n {\n const { image } = (instruction as TextureInstruction).data;\n\n this.uploadTextureSource(image.source);\n }\n else if (instruction.action === 'fill')\n {\n const { texture } = (instruction as FillInstruction).data.style;\n\n this.uploadTextureSource(texture.source);\n }\n }\n\n return null;\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAgBO,MAAe,sBAAsB,YAAA,CAC5C;AAAA;AAAA;AAAA;AAAA;AAAA,EAKc,gBAAgB,IAAA,EAC1B;AACI,IAAA,IAAI,gBAAgB,aAAA,EACpB;AACI,MAAA,IAAA,CAAK,oBAAoB,IAAI,CAAA;AAAA,IACjC,CAAA,MAAA,IACS,gBAAgB,IAAA,EACzB;AACI,MAAA,IAAA,CAAK,WAAW,IAAI,CAAA;AAAA,IACxB,CAAA,MAAA,IACS,gBAAgB,QAAA,EACzB;AACI,MAAA,IAAA,CAAK,eAAe,IAAI,CAAA;AAAA,IAC5B,CAAA,MAAA,IACS,gBAAgB,UAAA,EACzB;AACI,MAAA,IAAA,CAAK,iBAAiB,IAAI,CAAA;AAAA,IAC9B,CAAA,MAAA,IACS,gBAAgB,eAAA,EACzB;AACI,MAAA,IAAA,CAAK,sBAAsB,IAAI,CAAA;AAAA,IACnC;AAAA,EACJ;AAAA,EAEU,oBAAoB,aAAA,EAC9B;AACI,IAAA,IAAA,CAAK,QAAA,CAAS,OAAA,CAAQ,UAAA,CAAW,aAAa,CAAA;AAAA,EAClD;AAAA,EAEU,WAAW,KAAA,EACrB;AACI,IAAA,IAAA,CAAK,QAAA,CAAS,WAAA,CAAY,IAAA,CAAK,WAAA,CAAY,KAAK,CAAA;AAAA,EACpD;AAAA,EAEU,iBAAiB,KAAA,EAC3B;AACI,IAAA,IAAA,CAAK,QAAA,CAAS,WAAA,CAAY,UAAA,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