ivan.popelyshev

Members
  • Content Count

    4674
  • Joined

  • Last visited

  • Days Won

    217

Everything posted by ivan.popelyshev

  1. You can specify "texture.baseTexture.pmaMode = PIXI.PMA_MODES.NPM;" and get not-premultiplied texture data in "texture2D". However its possible only with Mesh-shaders and not filters. All results of rendering in the middle are in PMA. Btw, if you want to just tint everything the same color, you can use pixi-heaven double-tint stuff. Better to learn how to do your stuff with PMA Also, you can just use tricks like in https://github.com/pixijs/pixi-picture/blob/master/src/ShaderParts.ts#L8 (its my NPM filter blending)
  2. because its premultiplied in most cases in pixi. Its not (R,G,B,A), its (Ra, Ga, Ba, a)
  3. btw, there's "renderable=false" / "renderable=true" switch, alternative to "alpha=0". ITs checked in all "render()" methods in Container .
  4. Did you actually look at signature of original method in d.ts file? PixiJS handles cases when several children are mentioned in the method.
  5. Whats stopping you? Except that there might be several children passed there
  6. > Any scale applied to the item minus perspective (camera) scale. more like "take the scale from camera before perspective", but yeah, good explanation!
  7. Oh wait, you want just stage scale, i've got it :)) Yeah, its better to copy it. I just dont have behaviour for that yet, sorry But i'll think about it. Its an interesting case, I didnt think about it
  8. It seems to me that 123 works like you described. Can you please elaborate what is wrong with 123?
  9. If you draw only rects, then you can try to use pixi-candles thingy. If you make extra step, you can modify its buffer to hold different rects. Are your rects rotated relatively to each other?
  10. @ShukantPal explain what we have for instanced batchers please?
  11. As a reference, here is what i do when i need to draw many bars: https://github.com/gameofbombs/pixi-candles/blob/master/src/Bars.ts .
  12. GraphicsGeometry adds its attributes in constructor. Later, you can set "instanced" of those attributes. That leaves only one problem: which algorithm will fill extra attribute with translationMatrix, and other stuff that is usually an uniform. You have to make your own shader and batcher for graphics in that case. I can help you next weekend if you start this thing.
  13. Here we go, 75 lines total: https://jsfiddle.net/Hackerham/cke3gasx/27/ 1. mesh geometry 200x200 size with center (0,0) 2. mesh material (shader, basically) specifying program for it. Same program can be used for many shader instances, just specify different uniform objects for them 3. texture, when loaded, changes size of mesh. Calculated size is 200,200 based on points in buffer, so, for 800x600 scale of element becomes 4,3
  14. If it works for you, i'll add it to pixi-projection myself, something as "POINT_X"
  15. For example, I took https://pixijs.io/examples/#/plugin-projection/quad-homo.js and added this. Now flowerTop guy scales with quad but doesnt actually rotate or move. You have to do the same with Matrix3d, just copy source from it and add extra "if". Dont use the source for my Matirx2d because it has different indices of matrix! const AFFINE = PIXI.projection.AFFINE; bunny.proj.affine = 123; PIXI.projection.Matrix2d.prototype.copyTo = function(matrix, affine, preserveOrientation) { const mat3 = this.mat3; const d = 1.0 / mat3[8]; const tx = mat3[6] * d, ty = mat3[7] * d; matrix.a = (mat3[0] - mat3[2] * tx) * d; matrix.b = (mat3[1] - mat3[2] * ty) * d; matrix.c = (mat3[3] - mat3[5] * tx) * d; matrix.d = (mat3[4] - mat3[5] * ty) * d; matrix.tx = tx; matrix.ty = ty; if (affine >= 2) { let D = matrix.a * matrix.d - matrix.b * matrix.c; if (!preserveOrientation) { D = Math.abs(D); } if (affine === AFFINE.POINT) { if (D > 0) { D = 1; } else D = -1; matrix.a = D; matrix.b = 0; matrix.c = 0; matrix.d = D; } else if (affine === AFFINE.AXIS_X) { D /= Math.sqrt(matrix.b * matrix.b + matrix.d * matrix.d); matrix.c = 0; matrix.d = D; } else if (affine === AFFINE.AXIS_Y) { D /= Math.sqrt(matrix.a * matrix.a + matrix.c * matrix.c); matrix.a = D; matrix.c = 0; } else if (affine === AFFINE.AXIS_XR) { matrix.a = matrix.d * D; matrix.c = -matrix.b * D; } else if (affine === 123) { let dist = Math.sqrt(matrix.a * matrix.a + matrix.c * matrix.c); matrix.a = dist; matrix.b = 0; matrix.c = 0; matrix.d = dist; } } return matrix; }
  16. Its not always, its just right now i have many problems and making from scratch takes extra brain power that i need
  17. PIXI.projection.Matrix3d.prototype.copyTo = function(matrix, affine, preserveOrientation) { // copy from original source else if (affine === 123) { let dist = Math.sqrt(matrix.a * matrix.a + matrix.c * matrix.c); matrix.a = dist; matrix.b = 0; matrix.c = 0; matrix.d = dist; } } // ... container.affine = 123; I didnt test it, i just show how you can hack anything in pixi and its plugins. Again, I wont do anything without demo that i can just open, edit and see if it works. I have very huge backlog, i just cant spend time on both writing and testing demos at the moment.
  18. pixi projection has some special hacks that allow it to copy its matrices to usual 3x2 format, which is not good in your case instead "copyTo" you can use "copyTo2dOr3d" IF that's not enough, please make minimal demo for me at codepen, jsfiddle or somewhere else, i'll help you to find what works there (i didnt have that task before). You can reference "pixijs.io/examples/pixi-plugins/pixi-projection.js" in those demos.
  19. > I can make colors buffer and use it to create texture > Thank you, that's helpful i will use renderTexture! 🙂 Oh, so it was about "Texture.from(canvas)" and "texture.update()" , right?
  20. then.. draw it once to renderTexture and use renderTexture in a sprite later? That works for heavy shaders & filters, but if you want pixi automatically determine whether something was changed - nope, not happenning, i have the fork that does it but its just not possible to open-source, the code is completely bonkers.
  21. @Shukant Pal its your stuff. btw, @eXponeta added ASTC in pixi-compressed-textures long time ago At my work, we are going to use ASTC as main format
  22. Oh, do you want even more complicated? OK here it is. I have preloader, then there is a level select https://codesandbox.io/s/sad-forest-1m4r5
  23. Nothing can stop you! I dont see a problem. Give me an example.
  24. Just make a preloading Graphics object. Add it to stage, remove when its done. As for what to use for animation - you can just draw a bar, a circle, or maybe base64 simple image somewhere for that bar and use "beginTextureFill" in graphics to show part of that bar corresponding to progress.