texture: an already initialized RenderTexture, which must be the size of cutzone * MULTI_SAMPLING Go check the ClippingNode summon so many “troops” at once, while waiting for a complete tutorial, here is my method to generate pieces using mask like the image above: /* Arguments: Then you can randomise generate a grid mask in a loop.Īlthough, you may try using clipping node but not sure about the performance on having too many clipping node. I can’t give you much idea on the masking as i’m not good on it.īut if you want randomise puzzle pieces, you can label each unique pieces and pair them.įor each unique piece, you can define what piece can match it in an array. Your mask should cut into each unique pieces. I have the images which will serve as mask for the different pieces, but I have no idea how to do it. I have a single image, which serve as puzzles, and I need to load them as whole images, and then cut them into different pieces, the “puzzle pieces”. Here is what your mask generator should generate (only the alpha channel is relevant, the color is not):Ĭreate Puzzle pieces from a single image C++ Then your mask generator must be able to handle alpha You need to generate a better anti-aliased image. It is far from impossible, but still a fair amount of work.Īnother caveat: how are you going to handle anti-aliasing? Your image is very aliased, it won’t look good. The thing is, to be able to cut pieces from this image, first you will need to detect the contour of each piece, to be able to generate a mask. Using your image is going to make some things easier (no need to know in advance what’s the position of each piece, since this information is on the image), but I doubt it will be more performant. No matter what, to be able to move each piece independantly, your are going to need a separate Node per piece. I think the easiest way to cut pieces is to have a mask for each piece, and use a RenderTexture to take only a part of the original image (with the appropriate blendFunc).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |