Created
December 25, 2018 08:41
-
-
Save acidleaf/d0d7dec1d008b8c3f7d4330271c9a3d9 to your computer and use it in GitHub Desktop.
Lookup table for tilemap tile connectivity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This LUT follows the following tile code: | |
// 1 2 4 | |
// 8 X 16 | |
// 32 64 128 | |
static const int NUM_DIR = 8; | |
static const glm::ivec2 dir[NUM_DIR] = { | |
{ -1, -1 }, | |
{ 0, -1 }, | |
{ 1, -1 }, | |
{ -1, 0 }, | |
{ 1, 0 }, | |
{ -1, 1 }, | |
{ 0, 1 }, | |
{ 1, 1 } | |
}; | |
static const uint8_t tileIndex_LUT[] = { | |
0, 1, 2, 2, 3, 4, 2, 2, 5, 5, 6, 6, 7, 7, 6, 6, | |
8, 9, 10, 10, 8, 9, 10, 10, 11, 11, 12, 12, 11, 11, 12, 12, | |
13, 14, 15, 15, 16, 17, 15, 15, 5, 5, 6, 6, 7, 7, 6, 6, | |
18, 19, 20, 20, 18, 19, 20, 20, 11, 11, 12, 12, 11, 11, 12, 12, | |
21, 22, 23, 23, 24, 25, 23, 23, 26, 26, 27, 27, 28, 28, 27, 27, | |
29, 30, 31, 31, 29, 30, 31, 31, 32, 32, 33, 33, 32, 32, 33, 33, | |
21, 22, 23, 23, 24, 25, 23, 23, 26, 26, 27, 27, 28, 28, 27, 27, | |
29, 30, 31, 31, 29, 30, 31, 31, 32, 32, 33, 33, 32, 32, 33, 33, | |
34, 35, 36, 36, 37, 38, 36, 36, 39, 39, 40, 40, 41, 41, 40, 40, | |
8, 9, 10, 10, 8, 9, 10, 10, 11, 11, 12, 12, 11, 11, 12, 12, | |
42, 43, 44, 44, 45, 46, 44, 44, 39, 39, 40, 40, 41, 41, 40, 40, | |
18, 19, 20, 20, 18, 19, 20, 20, 11, 11, 12, 12, 11, 11, 12, 12, | |
21, 22, 23, 23, 24, 25, 23, 23, 26, 26, 27, 27, 28, 28, 27, 27, | |
29, 30, 31, 31, 29, 30, 31, 31, 32, 32, 33, 33, 32, 32, 33, 33, | |
21, 22, 23, 23, 24, 25, 23, 23, 26, 26, 27, 27, 28, 28, 27, 27, | |
29, 30, 31, 31, 29, 30, 31, 31, 32, 32, 33, 33, 32, 32, 33, 33 | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment