These are chat archives for pixijs/pixi.js

19th
Sep 2017
Jos
@Rojoss
Sep 19 2017 09:49
Hey, I have some memory issues with graphics. Basically a game I'm working on consists of multiple rounds, after each round the server sends the collision to the client and I create circles for each collision body for 3 seconds. However, after many rounds the memort increases a lot and it keeps on creating textures. I also create labels for some of them. I've tried several options for destroying them but I can't get the memory leak fixed.
Could someone look at this code and see how it could be fixed?
https://gist.github.com/Rojoss/9826d7ae53c2a9620c81fc89c32a74c9
ShashankChaurasia
@shashankAce_twitter
Sep 19 2017 12:27
how to remove texture cache of spriteFrame json only
ShashankChaurasia
@shashankAce_twitter
Sep 19 2017 12:32

I have loaded spriteSheetFrame using json.

const loader = new PIXI.loaders.Loader();
loader.add('bunny', 'data/bunny.png')
      .add('spaceship', 'assets/spritesheet.json');
loader.load((loader, resources) => {

});

I want to remove all the TextureCache which was loaded using this spritesheet.json only.

I have tried.

PIXI.Texture.removeFromCache("spaceship");
PIXI.Texture.removeTextureFromCache("spaceship");

But in PIXI.TextureCache names of all the spriteFrame were included there. And still i am able to use image form frame. Using this.

var bgSprite2 = PIXI.Sprite.fromFrame("ship1");
bgSprite2.anchor.set(0.5, 0.5);
var pos = {x: 300, y: 200};
bgSprite2.position.set(pos.x, pos.y);
stage.addChild(bgSprite2);

I want to remove all the entries of spriteFrame in TextureCache and i want to load new set of spriteFrame.

I am doing this because i have spritesheet animations of two diffrent spaceship but the individual symbol name of both spaceship are same.

Ruben
@RoobScoobs
Sep 19 2017 13:52
hey everyone! I'm extremely new to using pixi. I was hoping to migrate this version (https://codepen.io/alaingalvan/pen/ICasz) of perlin light rays to v4. I feel like I'm almost there but I think I'm running into trouble with the godRayChunk, specifically converting the vTextureCoord. The migration guide says you have to "use mappedMatrix to convert textureCoord to mapCoord, all because of paddings and pow2."