refactor: RenderTexture
This commit is contained in:
parent
ead702775f
commit
ff97ff4825
|
@ -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 = {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user