1 line
1.8 KiB
Plaintext
1 line
1.8 KiB
Plaintext
{"version":3,"file":"logDebugTexture.mjs","sources":["../../../src/utils/logging/logDebugTexture.ts"],"sourcesContent":["import type { Texture } from '../../rendering/renderers/shared/texture/Texture';\nimport type { Renderer } from '../../rendering/renderers/types';\n\n/**\n * Logs a texture to the console as a base64 image.\n * This can be very useful for debugging issues with rendering.\n * @param texture - The texture to log\n * @param renderer - The renderer to use\n * @param size - The size of the texture to log in the console\n * @ignore\n */\nexport async function logDebugTexture(texture: Texture, renderer: Renderer, size = 200)\n{\n const base64 = await renderer.extract.base64(texture);\n\n await renderer.encoder.commandFinished;\n\n const width = size;\n\n // eslint-disable-next-line no-console\n console.log(`logging texture ${texture.source.width}px ${texture.source.height}px`);\n\n const style = [\n 'font-size: 1px;',\n `padding: ${width}px ${300}px;`,\n `background: url(${base64}) no-repeat;`,\n 'background-size: contain;',\n ].join(' ');\n\n // eslint-disable-next-line no-console\n console.log('%c ', style);\n}\n"],"names":[],"mappings":";AAWA,eAAsB,eAAgB,CAAA,OAAA,EAAkB,QAAoB,EAAA,IAAA,GAAO,GACnF,EAAA;AACI,EAAA,MAAM,MAAS,GAAA,MAAM,QAAS,CAAA,OAAA,CAAQ,OAAO,OAAO,CAAA,CAAA;AAEpD,EAAA,MAAM,SAAS,OAAQ,CAAA,eAAA,CAAA;AAEvB,EAAA,MAAM,KAAQ,GAAA,IAAA,CAAA;AAGd,EAAQ,OAAA,CAAA,GAAA,CAAI,mBAAmB,OAAQ,CAAA,MAAA,CAAO,KAAK,CAAM,GAAA,EAAA,OAAA,CAAQ,MAAO,CAAA,MAAM,CAAI,EAAA,CAAA,CAAA,CAAA;AAElF,EAAA,MAAM,KAAQ,GAAA;AAAA,IACV,iBAAA;AAAA,IACA,CAAA,SAAA,EAAY,KAAK,CAAA,GAAA,EAAM,GAAG,CAAA,GAAA,CAAA;AAAA,IAC1B,mBAAmB,MAAM,CAAA,YAAA,CAAA;AAAA,IACzB,2BAAA;AAAA,GACJ,CAAE,KAAK,GAAG,CAAA,CAAA;AAGV,EAAQ,OAAA,CAAA,GAAA,CAAI,OAAO,KAAK,CAAA,CAAA;AAC5B;;;;"} |