ivan.popelyshev

Members
  • Content Count

    4527
  • Joined

  • Last visited

  • Days Won

    197

Everything posted by ivan.popelyshev

  1. ok, so we have to rename it "hackTextureAttachment" and put into Spine.ts, right?
  2. oh, wait, pure canvas? why dont you use just node-canvas or one of its analogues then? thumbnails is easier to generate without pixi in pixi new BaseTexture(canvas) should work, where canvas is where you made putImageData thingy
  3. > : I read every pixel of the texture one by one, and using a graphics object, and small 1x1 rectangles of the correct color, I draw my texture to a render target You know you can just pass RGBA buffer to pixi , right? The only thing you do that thing without biug performance and memory hit is if you know how webgl works with textures. Also it would be nice if you read in source code what is pixi texture resource.
  4. use Text as a mask. IUf you need more than text - that border for example - you should draw it in renderTexture together with text, and use sprite with this texture as a mask
  5. pixi.js-legacy is a bundle of pixijs that supports CanvasRenderer. It was moved from default package because some people apparantly want as minimal build as possible and comparing weight of libs, measuring who's cooler. Canvas2d in pixi-v5 is supported better than in v4. It is not possible to do certain things easily without canvas2d and we will not remove it. Look in the assets: https://github.com/pixijs/pixi.js/releases/tag/v5.3.3
  6. Its possible with modifying "graphics.geometry.graphicsData" and calling "graphics.geometry.invalidate()" after that. Or you can do something like "drawPolygon(myPolygon)", then modify polygon, then call "graphics.geometry.invalidate()". It triggers triangulation and full rebuild of vertex buffer.
  7. Usually people just added extra attachments in spine and hacked them in pixi. Unfortunately, I, as pixi-spine author, cant support this feature without input from community. I mean, someone have to solve it, and i'll put it in https://github.com/pixijs/pixi-spine/tree/master/examples My estimation - probability that someone will answer you is low. You have to do it yourself and share with community
  8. well, there's diagonal "texture.rotate" options but its experimental, no one use it https://pixijs.io/examples/#/textures/texture-rotate.js Honestly, in your case its better to make everything manually. Isometry to world is just "y_screen = y_world * 2" , simple equation, just move sprites accordingly and it'll be fine.
  9. You mixed everything and expect it to work. Please debug this thing and remove the unnecessary code. You dont need "prepare" because you are using renderTextures and when you form them - uploading happens automatically.
  10. because you have to use toGlobal(new PIXI.Point(0,0)) - point 0 om sp2 translates to "sp2.position" in container, and you want global value.
  11. use pixi-legacy build, `graphics.generateCanvasTexture()`
  12. you have to destroy each original texture. "texture.destroy(true)"
  13. > I upload my sprites not textures prepare recursively looks everywhere and searches for textures. Sprite resize wont affect anything, you have to create a renderTexture of appropriate size, render your sprite there, and then use this new texture, and destroy old one. Alternatively: do it manually on canvas2d, and give this canvas to pixi. You can also set width=height=1 for canvas after its uploaded to save the regular memory, but turn off pixi gc so it wont release the texture from videomemory. Both images are in this case are RGBA, 4 bytes per pixel. You can use compressed textures to get 1 byte per pixel but that's special kind of compression, it has downsides that you have to be aware of.
  14. When its time to render stuff, texImage2D 1. uncompresses PNG to RGBA, 4 bytes per pixel 2. uploads the result to GPU Sometime later when RGBA on js side is not needed, browser removes it. When - we dont know. In certain moment ( look up PixiJS TextureGC sources), pixi can decide that texture was used too long ago and remove it from GPU mem. For compressed texture formats the density is different - 1 or sometimes (rare) 0.5 byte per pixel. Its better to zip them server-side (static-gzip), and browser will unzip it.
  15. if you use tiles, you can use pixi-tilemap as low-level solution - it doesnt store objects at all, only an array of numbers. When you need to draw more, or remove old ones - just clear() it and refill, easy to use with high-level your algorithms
  16. There were several atttempts to move pixi-spine to es6 modules. I couldnt merge them because it made the build unusable for old users. Before one of webpack lovers solves that problem the proper way - I cant do anything
  17. You want to sort stuff from different containers, right? If layer itself is under the filter - it will work, otherwise - I just dont know the order of operations that you want Just imagine how do you want pixi to push/pop filter and when to draw elements, in which buffers - and then you'll be able to make a scheme that'll work. Also if your sorted elements are all in same container - you can just use pixi-v5 zIndex + "container.sortChildren=true" (https://github.com/pixijs/pixi.js/blob/dev/packages/display/src/Container.ts#L421) instead of pixi-layers
  18. In pixi, you have to use renderer.resize() and there are two ways: 1. you can assign your preferred width/height in resize, and manually do it in CSS like in your example. 2. you can use innerWidth/innerHeight in resize, but assign scale to STAGE container or container that you use as a camera.
  19. and pixi-batch-renderer plugin might help you. Anyway, count those calls, SpectorJS allows that. How many bindTexture and bindShader?
  20. > Could you elaborate on this? Not too well versed with the graphics back-end so I'm attempting my proposed solution first. that means you have a model from somewhere, probably multiplayer server, and you want to show it with commands without actually caching anything. I recommend to try simple canvas2d first instead of pixi, you might actually save time with it. In 2013 i made a game with full-HD 60FPS only on 2d without webgl, so it should work. When you get the feel of API then pixi will become more sensible for you If you want to actually understand something, look in the source code, documentation is never enough in that case. Open it in separate IDE window (whether its vscode or intellij), search classes with shortcut, classes that you are using. The problem is that explaining this all stuff in a few sentences on forums is very hard, and we dont have free books, especially for your case. I told you that Text creates Canvas - well, look in the source, find "document.createElement("canvas")", of certain size, its at least 4 * width * height bytes array in both CPU and maybe GPU sync because we dont really know what will browser do with it.
  21. Yes, you can. https://pixijs.io/examples/#/demos-advanced/mouse-trail.js
  22. Well, optimal way is to make your own stage tree because i see that Sprites/Texts of pixi are not enough for you. You surely store something between frames, right? Those things exist with a reason, they cache some info that has to be calculated. If you cant maintain it with pixiJS API, you have to do it on your own. Look at https://github.com/pixijs/pixi-batch-renderer/ how to make your own sprites and stuff If its less than 50 objects your way may work actually. But texts - they are big problem, they hold CANVAS'es. You have to deal with that somehow.
  23. Its possible to hittest return everything. If it doesnt, check if you can change search algorithm (TreeSearch). Copy it and put your own search in "renderer.plugins.interaction.search"
  24. Did you use SpectorJS to see how many different webgl commands are there with your text plugin?
  25. > I let the initial local coordinates now be 0, and then change the position of the graphic once it is drawn. Yep, that's how its usually done in all Flash-2d engines