Skip to content
Erik edited this page Oct 28, 2019 · 10 revisions

Purpose:

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.

Requirements/Restrictions:

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.

Example Usage:

Texture2D texStamp, texImage;
//Assign texStamp/texImage here
//...
List<Pieces> pieces = Stamp(texStamp, texImage);

Data Dictionary:

Piece

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

Clone this wiki locally