-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Erik edited this page Oct 28, 2019
·
10 revisions
This serves as a tool for efficiently slicing any image into smaller images by overlapping 2 textures. This will function identically to a "puzzle stamp" that cuts a carboard template into individual puzzle pieces.
This code functions optimally under the following conditions:
- 2 textures are provided (A "Stamp" and an "Image")
- Textures are 2 dimensional in nature. (3D textures should work in theory, but this will not slice 3D models)
- Textures are the same size.
Texture2D texStamp, texImage;
//Assign texStamp/texImage here
//...
List<Pieces> pieces = Stamp(texStamp, texImage);
| Property | Datatype | Usage |
|---|---|---|
| sourcePosition | Vector2 | The anchor point where this piece aligns with the source image |
| bounds | Bounds | The bounding box surrounding all pixels of the piece |
| image | Sprite | Unique stamped sprite for this piece |