refactor: RenderTexture

This commit is contained in:
cha0s 2021-03-28 13:42:15 -05:00
parent ead702775f
commit ff97ff4825
2 changed files with 3 additions and 3 deletions

View File

@ -15,8 +15,9 @@ export default class Canvas extends decorate(Class) {
super();
if ('client' === process.env.SIDE) {
// eslint-disable-next-line global-require
const {RenderTexture} = require('@pixi/core');
const {RenderTexture, Texture} = require('@pixi/core');
this.renderTexture = RenderTexture.create();
this.texture = new Texture(this.renderTexture.baseTexture);
}
else {
this.renderTexture = {

View File

@ -156,7 +156,7 @@ export default class TilesView extends Container {
}
const canvas = new Canvas([rw, (ch + 2) * th]);
canvas.render(renderable, this.renderer);
const sprite = new Sprite(canvas.toImage());
const sprite = new Sprite(canvas);
sprite.anchor = [0, 0];
sprite.position = [cux * cw * tw, cuy * ch * th];
this.rendered[this.constructor.hashChunk([cux, cuy])] = sprite;
@ -166,7 +166,6 @@ export default class TilesView extends Container {
if (mask) {
mask.destroy();
}
canvas.destroy();
}
// eslint-disable-next-line class-methods-use-this