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">
63 lines (59 loc) • 2.1 kB
JavaScript
;
var TextureSource = require('../rendering/renderers/shared/texture/sources/TextureSource.js');
var GraphicsContext = require('../scene/graphics/shared/GraphicsContext.js');
var Text = require('../scene/text/Text.js');
var BitmapText = require('../scene/text-bitmap/BitmapText.js');
var HTMLText = require('../scene/text-html/HTMLText.js');
var PrepareQueue = require('./PrepareQueue.js');
;
class PrepareUpload extends PrepareQueue.PrepareQueue {
/**
* Upload the given queue item
* @param item
*/
uploadQueueItem(item) {
if (item instanceof TextureSource.TextureSource) {
this.uploadTextureSource(item);
} else if (item instanceof Text.Text) {
this.uploadText(item);
} else if (item instanceof HTMLText.HTMLText) {
this.uploadHTMLText(item);
} else if (item instanceof BitmapText.BitmapText) {
this.uploadBitmapText(item);
} else if (item instanceof GraphicsContext.GraphicsContext) {
this.uploadGraphicsContext(item);
}
}
uploadTextureSource(textureSource) {
this.renderer.texture.initSource(textureSource);
}
uploadText(_text) {
this.renderer.renderPipes.text.initGpuText(_text);
}
uploadBitmapText(_text) {
this.renderer.renderPipes.bitmapText.initGpuText(_text);
}
uploadHTMLText(_text) {
this.renderer.renderPipes.htmlText.initGpuText(_text);
}
/**
* Resolve the given graphics context and return an item for the queue
* @param graphicsContext
*/
uploadGraphicsContext(graphicsContext) {
this.renderer.graphicsContext.getGpuContext(graphicsContext);
const { instructions } = graphicsContext;
for (const instruction of instructions) {
if (instruction.action === "texture") {
const { image } = instruction.data;
this.uploadTextureSource(image.source);
} else if (instruction.action === "fill") {
const { texture } = instruction.data.style;
this.uploadTextureSource(texture.source);
}
}
return null;
}
}
exports.PrepareUpload = PrepareUpload;
//# sourceMappingURL=PrepareUpload.js.map