Example #1
0
 public void Initialize(Texture2D texture, Vector2i num_tiles, TRS source_area)
 {
     this.Texture      = texture;
     this.TileSizeInUV = source_area.S / num_tiles.Vector2();
     this.NumTiles     = num_tiles;
     this.m_tiles_uvs  = new TextureInfo.CachedTileData[num_tiles.Product()];
     for (int i = 0; i < this.NumTiles.Y; i++)
     {
         for (int j = 0; j < this.NumTiles.X; j++)
         {
             Vector2i tile_index = new Vector2i(j, i);
             TRS      tRS        = TRS.Tile(this.NumTiles, tile_index, source_area);
             int      num        = tile_index.X + tile_index.Y * this.NumTiles.X;
             this.m_tiles_uvs[num] = new TextureInfo.CachedTileData
             {
                 UV_00 = tRS.Point00,
                 UV_10 = tRS.Point10,
                 UV_01 = tRS.Point01,
                 UV_11 = tRS.Point11
             };
         }
     }
 }