1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/small3dlib.git synced 2024-11-24 21:09:57 +01:00

Update comments

This commit is contained in:
Miloslav Číž 2019-06-25 19:03:09 +02:00
parent bb3d1fa5d6
commit 6374862bd8
5 changed files with 103 additions and 677 deletions

View file

@ -11,10 +11,10 @@ const S3L_Unit carVertices[CAR_VERTEX_COUNT * 3] = {
31, 103, -3, // 15 31, 103, -3, // 15
-48, 59, 31, // 18 -48, 59, 31, // 18
48, 59, 31, // 21 48, 59, 31, // 21
-51, 52, 86, // 24 -40, 52, 86, // 24
-44, 14, 86, // 27 -44, 14, 86, // 27
44, 14, 86, // 30 44, 14, 86, // 30
51, 52, 86 // 33 40, 52, 86 // 33
}; // carVertices }; // carVertices
#define CAR_TRIANGLE_COUNT 18 #define CAR_TRIANGLE_COUNT 18
@ -28,7 +28,7 @@ const S3L_Index carTriangleIndices[CAR_TRIANGLE_COUNT * 3] = {
9, 6, 8, // 18 9, 6, 8, // 18
7, 8, 6, // 21 7, 8, 6, // 21
3, 4, 0, // 24 3, 4, 0, // 24
8, 10, 9, // 27 9, 11, 10, // 27
7, 3, 10, // 30 7, 3, 10, // 30
0, 6, 9, // 33 0, 6, 9, // 33
6, 0, 2, // 36 6, 0, 2, // 36
@ -36,7 +36,7 @@ const S3L_Index carTriangleIndices[CAR_TRIANGLE_COUNT * 3] = {
2, 5, 7, // 42 2, 5, 7, // 42
2, 1, 4, // 45 2, 1, 4, // 45
7, 11, 8, // 48 7, 11, 8, // 48
8, 11, 10 // 51 9, 8, 11 // 51
}; // carTriangleIndices }; // carTriangleIndices
#define CAR_UV_COUNT 24 #define CAR_UV_COUNT 24
@ -60,11 +60,11 @@ const S3L_Unit carUVs[CAR_UV_COUNT * 2] = {
398, 493, // 32 398, 493, // 32
397, 476, // 34 397, 476, // 34
484, 451, // 36 484, 451, // 36
386, 451, // 38 386, 476, // 38
386, 476, // 40 397, 451, // 40
398, 509, // 42 386, 451, // 42
398, 493, // 44 398, 509, // 44
397, 451 // 46 398, 493 // 46
}; // carUVs }; // carUVs
#define CAR_UV_INDEX_COUNT 18 #define CAR_UV_INDEX_COUNT 18
@ -78,15 +78,15 @@ const S3L_Index carUVIndices[CAR_UV_INDEX_COUNT * 3] = {
14, 15, 16, // 18 14, 15, 16, // 18
4, 17, 5, // 21 4, 17, 5, // 21
18, 8, 7, // 24 18, 8, 7, // 24
17, 19, 20, // 27 19, 20, 21, // 27
9, 1, 21, // 30 9, 1, 22, // 30
12, 15, 14, // 33 12, 15, 14, // 33
15, 12, 11, // 36 15, 12, 11, // 36
21, 22, 9, // 39 22, 23, 9, // 39
3, 10, 4, // 42 3, 10, 4, // 42
3, 6, 8, // 45 3, 6, 8, // 45
4, 23, 17, // 48 4, 20, 17, // 48
17, 23, 19 // 51 19, 17, 20 // 51
}; // carUVIndices }; // carUVIndices
S3L_Model3D carModel; S3L_Model3D carModel;

View file

@ -243,10 +243,8 @@ int main()
} }
while (SDL_PollEvent(&event)) while (SDL_PollEvent(&event))
{
if (event.type == SDL_QUIT) if (event.type == SDL_QUIT)
running = 0; running = 0;
}
uint8_t *state = SDL_GetKeyboardState(NULL); uint8_t *state = SDL_GetKeyboardState(NULL);

View file

@ -21,6 +21,8 @@
#define S3L_PERSPECTIVE_CORRECTION 0 #define S3L_PERSPECTIVE_CORRECTION 0
#endif #endif
#define S3L_NEAR (S3L_FRACTIONS_PER_UNIT / 5)
#define S3L_SORT 0 #define S3L_SORT 0
#define S3L_Z_BUFFER 1 #define S3L_Z_BUFFER 1

View file

@ -23,640 +23,50 @@ uint16_t level1Palette[256] = {
49168,53265,57363,61460,63509 49168,53265,57363,61460,63509
}; // level1Palette }; // level1Palette
#define LEVEL1_TEXTURE_WIDTH 128 #define LEVEL1_TEXTURE_WIDTH 32
#define LEVEL1_TEXTURE_HEIGHT 128 #define LEVEL1_TEXTURE_HEIGHT 32
uint8_t level1Texture[16384] = { uint8_t level1Texture[1024] = {
20,20,20,20,20,20,20,20,21,21,21,20,20,20,20,20,20,20,20,20,20,20,21,20,20,20, 20,20,21,20,20,20,20,20,20,20,20,21,21,22,22,21,21,20,21,21,21,21,21,20,21,21,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,22,21, 21,21,21,20,20,20,26,26,24,20,25,25,25,25,25,25,25,24,25,25,24,25,25,21,21,25,
22,22,22,22,22,21,21,21,21,21,21,21,21,20,20,20,20,20,20,20,21,21,21,21,21,21, 26,25,24,24,25,25,26,26,26,26,26,25,22,22,22,20,25,25,22,22,22,22,22,22,22,22,
21,21,21,21,21,21,21,21,21,21,21,21,21,20,20,20,21,21,21,21,21,21,21,21,21,21, 23,24,25,23,20,23,23,22,22,21,22,22,22,22,22,22,22,22,23,23,22,20,25,23,23,23,
21,21,21,21,21,21,21,21,21,21,21,21,20,20,20,20,20,20,20,20,20,20,20,20,20,20, 23,23,23,23,23,22,23,22,24,23,21,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,22,22,22,22,22,22,23,22,22, 22,19,25,24,23,23,23,23,24,24,23,23,23,23,24,23,21,23,24,24,24,24,24,24,24,24,
22,21,22,21,21,21,21,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23, 24,24,24,24,24,24,22,20,24,24,24,24,23,24,24,24,24,24,24,24,25,22,20,24,24,24,
23,23,22,22,22,22,21,22,22,22,22,21,21,20,20,20,20,20,20,21,21,21,21,21,21,21, 24,24,24,24,24,24,24,24,24,24,24,24,22,20,24,24,24,24,24,24,24,24,24,24,24,24,
21,21,21,21,21,21,21,21,21,21,21,21,20,20,21,20,21,21,21,21,21,21,21,22,22,22, 25,22,21,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,20,24,24,24,23,24,24,
22,22,22,22,22,22,22,22,22,22,22,22,22,21,22,22,21,21,20,22,20,20,25,24,25,24, 24,24,24,24,24,24,25,22,20,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,22,21,
23,24,24,22,21,20,20,20,20,20,21,23,24,24,24,25,25,25,24,25,25,25,25,25,25,24, 23,24,24,24,24,24,24,24,24,24,24,24,25,22,21,25,24,24,24,24,24,24,24,24,24,24,
25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, 24,24,23,23,22,21,22,25,25,24,24,24,24,24,24,25,25,24,23,22,20,24,24,24,24,24,
24,24,24,24,24,24,24,23,24,24,23,22,20,20,20,20,21,21,21,21,22,23,24,24,24,24, 24,24,24,24,24,23,23,23,20,20,20,20,20,21,21,21,21,20,20,21,21,20,21,21,21,20,
24,24,23,23,23,24,24,24,24,24,24,23,23,24,24,24,24,24,24,24,25,25,25,25,25,25, 20,22,23,22,22,22,21,21,21,21,21,20,20,20,20,22,24,23,23,23,25,24,23,23,21,22,
25,25,24,25,25,25,25,25,25,24,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26, 20,20,21,25,24,24,23,23,22,23,23,23,23,23,23,22,23,23,22,21,20,24,24,24,24,23,
26,25,22,21,20,20,20,21,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, 23,24,22,23,24,23,26,20,25,8,8,25,24,24,24,24,24,25,24,24,25,24,25,8,9,26,20,22,
25,25,25,25,25,25,25,24,25,25,25,24,24,24,24,24,25,25,24,24,24,24,24,25,25,25, 22,23,23,23,23,23,23,23,22,22,23,20,24,24,23,23,23,23,22,23,22,22,22,22,22,22,
25,25,25,25,25,25,24,25,25,23,21,20,20,20,21,21,21,22,24,25,25,25,25,25,25,25, 22,23,23,23,20,23,23,23,23,23,23,23,23,23,23,23,22,21,23,24,24,24,24,24,23,24,
25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26, 23,23,23,22,22,23,23,23,22,22,21,23,24,24,23,23,24,24,24,24,24,24,23,21,23,23,
26,26,26,26,26,26,26,26,26,26,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,25, 23,24,24,23,23,24,24,23,23,23,24,24,23,23,22,23,20,23,24,24,24,24,24,24,24,24,
24,21,20,20,20,22,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, 24,24,23,21,23,23,23,24,24,24,24,24,24,24,24,24,23,24,23,23,24,24,20,23,24,24,
25,25,25,25,25,25,25,25,24,24,24,24,24,24,25,25,24,24,25,25,25,25,24,25,25,25, 24,24,24,24,24,24,24,24,22,21,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
25,25,25,25,25,25,25,24,21,21,20,21,21,22,23,24,25,25,26,26,26,25,25,25,25,25, 24,24,21,23,24,24,24,24,24,24,24,24,24,24,23,21,23,24,24,24,24,24,24,24,24,24,
25,25,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26, 24,24,24,24,24,24,24,24,20,24,24,24,24,24,24,24,23,24,24,24,23,20,22,24,24,24,
26,26,26,26,26,26,26,26,26,26,25,25,25,25,25,25,24,25,25,26,26,26,26,25,24,21, 24,24,24,24,24,24,24,24,24,23,23,24,24,24,20,24,24,24,24,24,24,24,24,24,24,24,
20,20,20,22,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,24, 23,20,22,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,20,21,22,21,22,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25, 24,24,24,24,24,24,23,21,21,23,24,23,23,24,24,24,24,24,24,23,23,23,23,23,24,24,
25,25,25,25,25,24,22,21,20,21,21,22,23,24,24,25,25,25,25,25,24,23,23,23,23,23, 19,19,20,19,19,19,20,20,20,21,21,21,21,20,21,21,21,21,20,21,21,21,21,22,22,21,
23,23,23,23,23,23,23,24,23,24,24,23,24,24,24,24,24,24,24,24,25,25,25,25,26,25, 21,21,20,20,20,20,24,24,24,24,24,23,22,20,24,24,24,25,25,25,25,25,25,25,25,25,
25,25,25,25,25,25,25,25,25,25,25,24,24,24,22,22,22,23,24,25,26,25,24,21,20,20, 25,25,23,20,22,24,24,25,25,25,24,24,23,23,23,23,23,23,22,20,24,22,23,23,23,23,
20,23,25,25,25,25,25,25,25,25,25,25,25,25,25,25,24,24,24,24,24,24,24,24,24,24, 23,23,23,23,22,22,22,22,23,20,23,23,24,23,22,22,21,22,21,22,22,21,21,22,23,20,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25, 22,23,23,24,23,23,23,23,23,23,22,22,22,22,23,20,22,24,23,23,23,22,20,21,23,23,
25,25,25,24,23,21,20,20,21,22,23,24,24,23,23,23,23,23,22,22,22,22,22,22,22,22, 23,23,22,22,23,20,23,23,23,24,24,23,23,23,23,23,23,23,23,23,23,20,22,24,23,23,
22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,24,23,24,24,24,24, 23,23,23,23,24,24,24,24,24,24,23,20,23,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,23,23,23,23,22,22,22,22,22,22,22,22,22,24,25,25,23,22,20,20,21,23, 23,20,22,24,24,24,24,24,24,24,24,24,24,24,24,24,23,20,23,24,24,24,24,24,24,24,
25,25,25,25,25,25,25,25,25,25,24,24,24,23,23,23,23,23,23,23,23,23,23,23,23,23, 24,24,24,24,24,24,24,20,22,24,24,24,24,24,24,24,24,24,24,24,24,24,23,20,24,24,
23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,25,25,25,25,25, 24,24,24,24,24,24,24,24,24,24,24,24,24,20,22,24,24,24,24,24,24,24,24,24,24,24,
24,24,23,21,21,20,20,22,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,22,22, 24,24,23,21,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,20,22,24,24,24,24,24,
22,22,21,21,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22, 24,24,24,24,24,23,23,23,23,20,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,19,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,25,22,22,20,20,20,24,25,25, 22,24,24,24,24,24,24,24
25,25,25,25,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,
22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,24,24,25,25,25,24,24,24,
23,21,21,20,20,22,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,21,21,21,21,
21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,24,22,23,21,20,20,23,25,25,25,25,
24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,25,25,24,24,24,23,21,
21,20,21,22,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,22,21,21,21,21,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,23,24,24,22,23,21,20,20,23,25,25,25,25,23,23,
22,22,22,22,22,22,22,22,21,22,22,22,22,22,22,22,22,22,22,22,22,22,23,22,22,23,
23,23,23,23,22,22,22,22,22,22,22,22,22,22,22,22,24,24,24,24,24,23,23,21,21,20,
21,22,23,23,23,23,23,23,23,23,22,22,22,22,22,22,23,23,23,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,23,23,23,23,22,22,22,23,23,23,23,23,23,23,23,23,23,23,22,
22,22,22,22,23,23,22,23,23,23,24,24,22,23,21,20,20,22,25,25,25,24,23,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,22,23,23,23,23,
23,23,23,23,22,23,23,23,23,22,22,22,22,22,24,25,24,24,24,23,23,22,21,20,21,22,
23,23,23,23,23,23,23,23,23,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,22,23,23,22,23,23,23,24,24,22,23,21,20,20,23,25,25,25,23,23,22,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,23,23,23,23,23,23,23,22,
22,22,22,22,23,23,23,23,23,22,22,23,24,25,24,24,23,23,23,22,21,20,21,22,23,23,
23,23,23,23,23,23,23,23,23,24,23,23,23,23,23,23,23,23,23,24,23,23,24,23,23,23,
24,23,23,23,24,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,24,24,23,22,23,21,20,20,23,25,25,26,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,24,24,24,23,23,23,22,21,20,21,22,23,23,23,23,
23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,23,24,24,23,23,24,24,24,
24,24,24,24,23,24,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,24,24,23,22,23,22,20,20,22,25,25,26,24,24,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,23,23,23,
23,23,23,23,23,23,23,23,23,24,24,24,23,23,23,22,21,20,21,22,23,23,23,23,23,23,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,23,23,23,24,23,23,24,23,23,23,23,23,23,24,24,24,24,
24,24,24,23,22,23,22,20,20,22,24,25,25,24,24,24,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,23,23,23,23,24,24,23,23,24,
23,23,24,24,24,23,23,24,24,24,23,23,23,22,21,20,21,22,23,23,23,23,23,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,23,22,22,21,20,19,21,24,24,25,24,24,24,24,24,23,23,23,23,23,23,23,23,23,23,
23,24,24,23,23,23,23,23,24,23,23,23,24,24,24,23,23,23,23,23,23,23,23,23,23,23,
23,24,23,23,23,24,24,24,23,23,23,22,21,20,21,22,23,23,23,23,23,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,
22,22,21,21,19,20,23,24,25,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23,23,24,
24,24,24,23,24,23,24,24,23,24,24,24,24,23,23,23,23,23,23,23,23,23,23,23,23,24,
23,23,23,23,24,24,23,23,22,22,20,20,21,22,23,23,23,23,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23,23,24,24,24,24,23,22,22,
21,21,20,20,22,24,25,24,24,24,24,24,24,24,24,24,23,23,23,23,23,23,23,23,23,23,
23,23,24,24,24,24,24,23,23,24,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,24,25,25,24,23,22,22,21,20,21,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,23,24,24,24,24,23,23,23,24,23,23,23,24,24,24,24,23,22,22,21,20,
20,20,21,23,24,24,24,24,24,24,24,24,24,23,23,23,23,23,23,23,23,23,23,23,23,23,
24,24,24,24,24,24,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
25,25,24,23,22,22,20,20,21,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,23,24,24,24,23,23,23,23,23,24,24,24,24,24,24,24,23,22,22,21,20,20,20,
22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23,23,23,23,23,24,24,24,24,
24,24,24,24,24,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,
24,23,22,21,20,20,20,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,22,21,20,20,20,22,23,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,24,23,
22,21,20,20,20,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,22,22,21,20,20,20,22,23,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,24,23,22,21,
20,19,21,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,22,21,21,20,20,21,23,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,24,23,22,21,20,20,
21,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,23,22,22,21,20,20,20,21,23,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,24,23,22,21,20,20,21,22,
23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,22,22,21,20,20,20,21,23,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,24,23,22,21,21,20,21,22,23,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,25,24,23,22,21,20,20,20,21,22,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,25,25,24,23,22,22,20,20,21,22,23,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,25,24,22,22,21,20,20,20,21,22,24,25,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,25,25,24,23,22,22,20,20,21,22,23,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,23,22,20,20,20,20,21,22,24,25,24,24,24,24,24,24,24,24,24,24,23,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,25,25,24,23,22,22,20,20,20,22,23,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,23,22,20,20,21,20,21,22,24,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,25,25,24,23,22,22,20,20,20,22,23,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
22,22,21,21,21,21,20,22,24,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,25,25,24,22,22,22,20,20,21,22,23,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,24,22,22,
21,20,21,21,20,22,23,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,25,25,23,22,22,22,21,20,21,22,23,24,25,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,24,22,22,21,20,
21,20,21,22,23,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
25,24,23,22,22,22,21,20,21,22,23,24,25,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,24,22,22,21,20,20,20,
20,22,23,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,24,
23,22,22,22,21,21,20,22,23,24,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,23,22,22,21,20,20,20,21,22,
22,24,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,24,24,24,24,25,25,24,22,22,
22,22,20,20,20,21,23,24,25,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,23,23,23,23,23,23,23,22,22,22,20,20,20,20,20,22,22,23,
25,25,25,24,24,25,25,25,24,24,24,24,25,25,25,25,25,25,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,23,22,21,22,22,
20,20,20,21,23,24,25,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,23,23,23,23,23,23,23,23,22,22,22,22,21,20,20,21,20,20,22,22,22,24,25,
25,25,25,25,25,25,24,24,24,24,24,24,24,24,24,24,24,23,23,24,24,24,24,24,24,24,
24,24,24,24,24,25,25,25,25,25,25,25,24,24,24,24,24,23,23,22,22,22,22,22,20,20,
20,21,23,23,24,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,22,22,22,22,22,22,22,22,22,21,21,21,21,20,20,22,22,22,22,23,24,24,
24,24,24,23,23,24,23,24,23,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
23,24,24,24,24,24,24,24,23,22,23,23,22,22,22,22,22,22,21,22,22,21,20,20,20,21,
23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,24,24,24,24,24,24,23,23,23,23,23,23,23,22,23,23,23,23,22,23,23,
22,22,22,22,22,22,22,22,22,22,21,21,21,20,20,20,20,21,22,22,22,22,22,22,22,22,
22,21,21,22,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,
21,22,22,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,21,21,21,20,20,20,22,23,
23,23,23,23,23,24,24,24,24,24,24,24,24,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
21,21,21,21,21,21,21,20,20,20,20,20,20,20,20,20,20,22,21,21,22,21,21,21,21,21,
21,21,21,20,21,21,21,21,20,20,20,20,20,21,21,20,20,20,20,20,20,20,20,20,20,20,
21,21,21,21,20,20,21,21,21,21,21,21,21,21,21,21,21,21,20,20,20,20,21,22,22,23,
23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,21,22,22,22,21,21,21,21,21,21,21,21,21,21,21,21,21,21,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,
21,21,21,21,21,21,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,20,20,20,20,
20,20,21,21,21,21,21,21,21,21,21,21,21,20,20,20,20,20,20,20,20,21,22,22,23,23,
23,23,22,22,22,22,21,21,22,21,21,22,22,22,22,22,21,21,21,21,21,21,21,22,21,21,
21,21,21,20,21,21,21,21,20,20,20,20,20,20,20,20,20,20,20,20,20,20,19,19,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,20,20,
21,21,21,21,20,20,20,20,20,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,
21,21,21,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,19,19,19,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,21,20,20,21,21,21,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,21,21,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,
21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,
21,21,22,21,22,22,22,21,21,21,21,21,21,21,22,21,21,21,21,21,21,21,21,21,21,21,
21,21,21,21,21,20,21,21,21,21,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,21,21,21,21,21,21,20,21,21,21,21,21,20,20,20,20,20,20,22,22,23,23,23,24,24,
24,23,23,22,23,24,23,24,24,23,23,24,25,24,25,24,24,24,24,25,24,23,23,24,23,23,
23,23,22,22,21,22,22,22,22,21,20,20,20,20,20,19,20,20,20,20,21,22,24,24,25,25,
24,24,24,24,24,24,24,24,24,23,23,23,23,23,23,23,23,23,22,23,23,22,23,23,23,23,
23,23,24,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,23,22,
22,23,23,22,22,22,22,22,21,21,21,21,20,20,20,20,22,24,25,26,26,26,26,26,26,26,
26,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,25,25,
26,25,25,25,25,25,25,25,24,25,24,22,20,19,20,21,21,24,25,25,26,26,26,26,26,26,
26,25,26,8,26,26,26,25,25,25,25,24,24,24,25,25,25,24,24,25,25,25,25,25,25,25,25,
25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,24,24,24,24,24,25,24,24,24,25,
25,25,24,23,23,24,23,22,21,20,21,20,20,23,25,26,26,9,9,9,26,26,26,26,26,26,26,
26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
26,26,26,26,26,26,26,25,21,19,20,21,22,24,25,26,26,26,26,26,8,26,8,9,9,8,9,8,26,
26,26,26,25,25,25,25,25,25,25,25,25,25,26,26,26,25,25,25,25,25,25,25,25,25,25,
25,25,25,25,25,25,25,25,25,25,25,25,25,26,8,8,9,9,9,9,9,9,9,26,26,25,25,26,24,
22,21,20,21,23,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,25,
26,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,25,26,26,26,25,
21,19,20,21,23,25,25,26,26,26,26,8,8,8,9,9,9,8,8,8,8,8,26,25,25,25,25,25,25,8,
26,25,26,26,26,26,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
25,25,25,26,9,9,9,9,9,9,9,9,9,9,9,9,26,26,26,26,23,21,20,20,24,24,24,24,24,24,
24,24,23,24,24,25,25,24,24,24,23,23,23,23,24,24,23,23,23,23,24,24,24,22,22,22,
24,24,23,24,23,24,24,25,24,23,23,24,25,26,26,25,20,19,20,21,22,24,25,9,9,9,8,8,
8,8,8,8,25,25,25,25,25,24,24,24,24,24,24,24,23,24,24,25,25,24,24,23,24,23,24,24,
23,24,25,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,24,24,24,25,25,25,8,25,8,
9,9,9,9,9,9,26,26,26,24,20,20,20,23,23,23,23,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,21,21,21,21,21,
21,22,21,22,24,25,25,21,19,20,21,22,23,25,25,25,24,24,25,25,24,23,23,24,23,23,
23,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,23,23,23,23,23,23,22,23,23,22,22,22,22,22,22,23,23,23,23,23,24,24,24,
24,24,25,8,8,25,21,20,20,22,23,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
21,22,24,24,20,20,21,21,22,23,24,24,23,22,23,23,22,22,22,22,23,22,23,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,
24,25,24,22,20,20,22,23,23,22,22,22,22,22,22,22,22,23,23,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,
23,22,20,20,21,21,22,22,24,24,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,22,23,24,
25,21,20,20,23,23,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,23,23,21,
20,20,20,21,22,22,24,24,23,24,24,23,24,24,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,22,22,22,22,23,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,24,24,21,
20,20,23,23,23,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,21,20,19,
20,21,22,22,23,24,24,24,23,23,23,23,23,23,23,23,24,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,24,21,21,20,
23,23,23,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,23,23,23,24,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,22,21,20,20,20,21,
22,22,23,24,24,24,24,24,23,24,24,23,24,23,24,23,24,23,23,24,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,20,20,20,23,23,
23,22,22,23,23,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,22,21,20,20,20,21,22,22,
23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23,23,
23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,23,23,23,23,23,23,23,23,23,23,22,23,23,23,22,22,23,22,21,20,20,23,23,23,22,
22,22,23,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,21,21,20,21,21,22,22,23,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23,23,23,23,
24,23,24,23,23,23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,23,23,23,
23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,20,20,20,22,23,23,23,22,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,21,21,21,22,22,22,23,23,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,23,23,23,23,23,23,
23,23,23,23,23,23,22,22,22,22,22,22,22,22,21,20,20,20,22,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,24,23,23,23,23,24,23,23,23,23,23,23,24,23,
23,23,23,23,23,24,23,23,23,23,23,23,23,22,21,21,21,22,22,22,23,23,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,
23,23,23,23,23,23,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,22,22,22,22,22,22,22,22,22,20,21,20,22,23,23,23,23,23,24,24,24,24,
24,24,24,24,24,24,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,23,23,24,24,24,24,24,24,23,23,21,21,21,21,22,22,22,23,24,24,24,23,24,24,24,
24,24,24,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,24,24,24,23,
23,23,23,23,22,22,22,22,23,23,22,23,23,23,23,24,24,24,24,24,24,23,23,23,23,23,
23,23,22,23,22,22,22,22,22,22,22,20,21,20,22,23,23,23,23,24,24,24,24,24,24,24,
24,24,23,23,24,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,23,21,21,21,21,22,22,22,23,23,24,24,23,24,23,23,23,23,
23,23,24,24,24,24,24,23,23,24,23,24,24,24,23,23,23,23,24,23,24,23,24,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,23,23,23,23,23,23,22,
22,22,22,22,22,23,23,23,22,21,21,20,22,23,23,23,23,24,24,24,24,24,24,24,24,24,
24,24,24,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,23,22,21,21,20,22,22,22,23,23,24,24,24,24,24,24,23,23,23,23,
24,24,24,24,24,24,24,24,23,24,24,24,24,24,24,24,24,23,24,24,24,24,24,24,24,23,
24,24,24,24,24,24,23,23,23,23,24,24,24,24,24,24,24,24,24,24,23,23,23,23,23,23,
23,23,23,23,23,23,23,21,20,19,22,23,23,23,23,23,23,24,23,23,23,24,24,24,23,23,
23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,23,22,22,21,21,22,22,22,23,23,23,24,23,24,24,24,23,23,23,23,24,23,
24,23,24,23,23,24,23,24,24,24,24,24,24,24,24,24,24,24,24,23,23,23,23,23,23,24,
23,23,23,23,23,23,23,23,24,24,24,24,24,23,23,23,23,23,23,23,23,23,23,24,24,24,
24,24,24,24,22,21,21,19,21,23,23,24,24,24,24,24,23,23,23,24,24,24,24,23,24,23,
23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,23,22,22,21,21,22,22,22,23,23,24,24,23,23,24,24,23,23,23,23,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23,24,24,24,24,
24,24,24,23,23,23,23,24,23,24,24,24,24,24,24,23,24,24,24,24,24,24,24,24,24,24,
24,24,23,21,20,20,22,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
23,22,22,21,21,22,22,23,23,24,24,24,23,23,23,23,23,23,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,23,23,23,23,24,24,24,24,24,24,24,23,23,23,23,23,24,24,24,24,24,24,24,24,24,
23,21,20,20,21,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,
22,21,22,22,22,23,23,24,24,24,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,
23,23,23,23,24,24,24,24,24,24,24,23,24,23,24,24,24,24,24,24,24,24,24,24,23,21,
20,20,21,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,22,22,22,21,
22,22,22,23,23,24,24,24,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,21,20,20,
21,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,22,22,22,21,22,22,
22,23,23,24,24,24,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,21,20,20,21,22,
23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,22,22,22,21,21,22,22,22,
23,24,24,24,24,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,21,20,19,20,22,23,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,22,21,21,22,22,22,23,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,21,20,20,20,22,23,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,22,21,21,21,21,22,23,24,24,24,
24,24,24,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,22,21,20,20,20,22,23,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,23,22,22,21,21,21,21,22,23,24,24,24,24,24,
24,23,24,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,24,
24,24,24,24,24,24,24,24,24,24,24,23,22,22,21,20,20,22,23,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,23,22,22,21,21,21,21,21,23,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,23,22,22,21,20,20,22,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,23,22,22,21,21,21,21,21,23,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,23,22,22,21,20,20,22,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,25,24,23,22,22,21,20,21,21,22,23,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,23,24,24,24,24,24,24,24,24,24,24,23,23,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,23,22,22,20,19,20,22,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,25,24,23,22,22,20,20,21,21,21,23,24,24,24,24,24,24,24,24,24,24,24,23,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
23,23,23,23,24,24,24,23,24,24,23,23,24,23,23,23,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,22,22,20,19,21,22,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,
25,24,23,22,21,20,20,21,21,21,22,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,
23,24,24,24,24,24,24,24,24,24,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,
24,24,22,22,20,19,21,22,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,24,
23,22,21,20,20,21,21,21,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
22,22,20,19,20,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,23,21,
21,20,20,21,21,21,22,23,24,23,24,24,24,24,24,24,24,24,24,24,23,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,24,23,22,
20,19,20,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,23,22,21,20,
20,21,21,21,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,22,21,20,19,
20,22,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,23,22,21,20,20,21,
21,22,22,23,24,25,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,22,21,20,19,19,20,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,24,23,21,21,20,20,21,21,22,
22,23,23,24,24,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,22,21,20,19,19,19,21,22,
23,24,24,25,25,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,24,23,22,21,20,21,21,21,21,23,23,
23,23,23,24,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,22,21,20,19,19,19,19,21,22,22,
22,23,23,23,22,21,22,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,21,20,21,21,21,21,22,23,23,23,
23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,22,21,20,19,19,19,21,22,22,22,22,21,
22,21,21,21,21,21,22,22,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,23,22,21,20,21,21,21,21,21,23,23,23,23,23,
24,24,24,24,24,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,23,24,24,
24,24,24,24,24,24,24,24,24,24,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,24,24,24,24,24,24,24,24,23,22,21,19,19,19,19,22,23,23,23,22,20,21,21,
22,22,23,23,23,22,22,22,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,23,22,21,20,21,21,21,21,21,22,23,23,23,22,23,23,
22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,22,22,22,23,23,22,22,22,22,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,24,23,22,20,19,19,19,20,22,22,22,22,21,20,20,21,22,22,
23,23,23,23,22,21,21,21,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
22,22,22,23,22,23,23,23,22,21,21,20,21,21,21,21,21,21,21,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,23,22,23,22,21,19,19,18,19,20,20,21,21,21,21,20,19,20,20,20,20,21,
21,21,21,20,20,20,20,20,20,20,21,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,
21,22,21,22,22,21,21,21,20,20,20,20,21,21,21,21,21,21,21,22,22,22,22,22,22,21,
21,21,21,21,21,21,21,21,21,22,21,22,22,22,22,22,22,21,22,21,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,21,21,21,21,21,22,22,21,21,21,21,21,21,21,21,21,21,
21,21,21,21,21,20,20,19,19,18,19,19,19,20,19,19,20,20,20,19,19,20,20,20,19,19,
19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,20,
21,20,20,21,21,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,
21,21,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,21,
22,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,20,20,20,20,20,20,20,20,20,20,
20,20,20,19,19,18,18,18,19,19,19,19,19,19,19,19,19,19,19,20,20,19,19,19,19,19,
19,19,19,20,20,20,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,
21,21,21,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,20,20,21,20,21,21,21,
21,21,21,21,21,21,21,20,20,21,20,20,20,20,20,20,20,20,20,20,20,20,19,19,20,19,
19,19,18,19,18,19,19,19,20,20,19,19,19,19,19,19,19,19,19,20,19,20,19,19,19,19,
19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,21,
22,22,21,21,22,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,
23,22,22,22,22,22,22,22,22,22,22,22,21,21,21,21,21,20,20,20,20,21,20,20,21,20,
21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,20,21,20,19,19,19,19,19,19,19,
19,19,21,22,21,22,22,22,22,21,22,21,21,22,21,21,20,20,20,19,20,19,20,20,20,20,
20,20,20,20,20,20,20,21,21,22,22,21,21,22,23,24,23,23,23,23,23,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,24,
24,24,24,24,24,24,24,24,24,24,24,23,22,21,21,20,20,20,21,21,20,20,21,21,21,22,
21,21,21,21,21,21,22,21,21,22,22,22,23,22,22,22,21,21,21,21,21,21,22,21,21,21,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,22,22,22,23,23,23,22,22,20,
20,20,20,20,22,23,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,
25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
25,25,25,25,25,25,25,25,25,25,23,22,21,20,20,21,21,21,22,23,24,23,24,24,24,24,
24,23,24,25,25,25,25,25,25,25,25,25,25,25,25,24,24,23,23,24,24,24,24,24,25,25,
25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,24,24,24,22,20,20,
20,21,23,24,25,25,25,24,25,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,
25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
25,25,25,25,25,25,25,25,25,23,21,20,20,20,21,22,24,24,25,25,25,25,25,25,25,25,
26,26,26,26,26,26,26,26,26,26,26,26,26,25,25,25,25,25,25,25,25,25,25,25,25,25,
25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,23,22,20,20,20,22,
24,25,25,25,24,24,23,23,24,24,24,23,24,24,24,24,24,24,24,24,24,24,25,24,25,25,
25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
25,25,25,25,25,25,24,23,21,20,20,20,21,22,24,24,25,25,25,25,25,25,25,25,25,25,
25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,24,25,25,25,25,25,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,20,20,20,21,23,24,
24,24,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,23,22,20,20,20,21,22,24,24,24,24,25,25,25,24,25,24,24,24,24,24,
23,23,23,23,23,23,23,23,24,23,24,24,24,24,25,25,25,25,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,20,20,20,21,23,24,24,22,
22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,
23,23,23,23,22,20,20,20,21,22,23,23,24,24,23,23,23,23,24,23,23,23,23,23,22,22,
22,22,22,22,22,21,22,22,21,22,22,22,22,22,23,23,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,22,20,20,20,21,23,24,23,22,22,22,
22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,22,22,22,22,22,22,22,22,22,22,22,21,22,22,22,22,21,22,22,22,22,
23,23,22,20,20,20,21,22,23,23,23,23,23,23,24,24,23,23,23,23,23,23,23,22,22,22,
22,22,22,21,21,21,21,21,21,21,21,21,22,21,21,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,23,23,23,23,21,20,20,20,21,23,23,23,22,21,22,22,22,
23,23,23,23,23,23,24,23,23,23,24,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,22,23,22,23,22,22,22,22,22,22,22,22,22,22,22,22,21,22,22,22,22,22,22,
22,20,20,20,20,22,23,23,23,22,23,23,24,24,23,23,23,23,23,23,23,23,23,22,22,22,
22,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,21,22,21,21,22,22,
22,21,21,22,22,22,22,23,23,23,23,22,20,20,20,21,22,23,23,22,22,22,22,23,23,23,
23,23,23,23,24,23,23,23,23,23,23,24,23,23,23,23,23,24,24,24,23,23,23,23,23,23,
23,22,23,22,22,23,22,22,22,23,22,22,22,22,22,22,22,22,22,22,22,22,23,22,22,20,
20,20,20,22,23,23,23,23,23,24,24,24,23,23,23,23,23,23,23,23,23,22,22,22,22,21,
21,21,21,21,21,21,21,20,21,21,21,21,21,22,22,22,22,22,22,21,21,21,21,21,21,21,
21,21,21,22,22,23,23,23,23,22,20,20,20,21,22,23,22,22,22,22,23,23,23,23,23,23,
23,23,24,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,23,24,23,23,23,23,23,22,
23,22,22,22,22,22,23,23,22,23,22,22,22,22,22,22,22,22,22,23,23,22,22,20,20,20,
20,22,22,23,23,23,24,24,24,24,23,23,23,23,23,23,23,23,23,22,22,22,22,22,21,21,
20,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,23,23,24,23,23,21,20,20,21,22,23,23,22,22,22,23,23,23,23,23,23,24,24,
24,24,23,23,23,23,24,23,23,23,23,24,23,23,23,24,24,24,24,24,23,23,23,22,23,23,
23,23,23,23,23,23,23,23,23,23,23,22,22,22,22,23,23,23,23,22,22,21,20,20,20,22,
22,23,23,24,24,24,24,24,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,21,21,
21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,21,22,
22,23,23,24,23,23,22,20,20,21,22,23,22,22,22,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,24,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,22,22,22,22,23,23,23,22,22,21,20,20,20,22,22,23,
23,24,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,22,23,
23,24,23,23,21,20,20,21,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,24,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,22,22,22,23,23,23,22,22,21,20,20,20,22,22,23,23,24,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,23,23,24,
23,23,21,21,20,21,23,23,23,23,23,23,23,23,23,23,23,23,24,23,24,23,23,23,24,23,
23,23,23,23,23,23,23,23,23,24,23,24,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,21,20,20,20,22,22,23,24,24,24,24,
24,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
24,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,23,23,24,24,23,23,
22,21,20,22,23,23,23,24,24,24,23,24,23,23,23,23,23,23,23,23,23,23,24,23,23,23,
23,23,23,23,23,23,23,24,23,24,23,23,23,23,23,23,24,23,23,23,23,23,23,23,23,24,
23,23,23,23,23,23,23,23,23,24,23,22,22,21,20,20,20,22,22,23,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,
24,24,24,24,23,23,23,24,23,23,23,23,23,23,23,23,23,23,23,23,24,24,23,23,22,21,
20,22,23,23,23,24,24,24,24,24,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,24,23,24,23,23,23,23,23,23,24,23,23,23,23,23,23,23,23,24,23,23,
23,23,23,23,23,23,24,24,23,23,22,21,20,20,20,22,22,23,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23,23,23,24,24,23,23,22,21,20,22,
23,23,23,23,24,24,24,24,24,23,23,24,23,23,24,23,23,23,23,23,23,24,23,23,23,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,24,23,23,
23,23,24,23,24,24,23,23,22,21,20,20,20,22,22,23,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23,22,21,20,22,23,23,
23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,23,23,22,21,20,20,20,22,22,23,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23,21,20,20,22,22,23,23,23,
23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,
23,24,23,23,22,21,20,20,20,21,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23,22,20,20,22,23,23,23,23,23,23,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,24,24,
23,23,22,21,20,20,20,21,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,23,23,21,20,20,21,22,23,23,23,24,23,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,24,24,23,23,
22,21,20,20,20,22,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,23,23,21,20,20,22,22,23,23,23,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,21,
20,20,20,22,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,23,23,21,20,20,22,23,23,23,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,21,20,20,
20,22,22,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,23,23,20,20,20,21,23,23,23,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,21,20,20,20,22,
22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,23,23,20,19,20,21,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,21,20,20,20,21,22,23,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,23,22,20,20,20,22,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,21,20,20,20,22,22,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
23,22,20,20,20,22,22,23,23,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,21,20,20,20,22,22,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,
20,20,20,21,22,23,23,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,25,24,23,22,21,20,20,20,22,22,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,20,20,
20,21,22,23,23,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,25,25,23,22,21,20,20,20,22,22,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,20,20,21,21,
22,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,25,24,23,22,21,20,20,20,22,22,23,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,20,20,21,21,21,23,
23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,25,24,23,22,21,20,20,20,21,22,22,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,20,20,21,21,21,22,23,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,25,24,23,22,20,20,20,20,22,22,22,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,22,21,21,20,21,21,22,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,
24,23,22,20,19,20,20,21,22,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
23,23,23,23,23,23,23,23,23,24,24,23,23,22,21,20,20,20,20,21,23,23,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,
21,20,19,19,20,22,22,22,22,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,23,23,23,23,22,23,23,23,23,22,23,23,23,23,
23,23,23,23,23,23,22,23,22,22,22,22,21,20,20,20,20,21,22,22,22,22,22,22,22,23,
23,23,23,22,22,22,22,22,23,23,22,23,22,22,22,22,23,23,23,23,23,23,23,23,23,23,
23,23,23,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,20,19,
19,19,19,21,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,21,20,20,20,21,20,20,20,20,19,19,20,20,20,20,20,21,21,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,20,20,20,21,22,22,
21,20,20,20,20,21,22,21,21,21,21,21,21,21,21,21,22,22,22,21,21,20,20,20,19,19,
19,20,21,22,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,
22,22,22,22,22,22,22,22,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,20,20,
20,21,20,20,20,21,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,
21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,20,20,20,20,19,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20
}; // level1Texture }; // level1Texture
#endif // guard #endif // guard

View file

@ -4,10 +4,16 @@
/* /*
Simple realtime 3D software rasterization renderer. It is fast, focused on Simple realtime 3D software rasterization renderer. It is fast, focused on
resource-limited computers, located in a single C header file, with no resource-limited computers, located in a single C header file, with no
dependencies, using only integer arithmetics. dependencies, using only 32bit integer arithmetics.
author: Miloslav Ciz author: Miloslav Ciz
license: CC0 1.0 + additional waiver of all IP license: CC0 1.0 + additional waiver of all IP
version: TODO
Before including the library, define S3L_PIXEL_FUNCTION to the name of the
function you'll be using to draw single pixels (this function will be called
by the library to render the frames). Also define S3L_RESOLUTION_X and
S3L_RESOLUTION_Y.
-------------------- --------------------
@ -33,12 +39,13 @@
CONVENTIONS: CONVENTIONS:
This library should never draw pixels outside the specified screen This library should never draw pixels outside the specified screen
boundaries, so you don't have to check this! boundaries, so you don't have to check this (that would cost CPU time)!
You can safely assume that triangles are rasterized one by one and from top You can safely assume that triangles are rasterized one by one and from top
down, left to right (so you can utilize e.g. various caches), and if sorting down, left to right (so you can utilize e.g. various caches), and if sorting
is disabled the order of rasterization will be that specified in the scene is disabled the order of rasterization will be that specified in the scene
structure (of course, some triangles and models may be skipped). structure and model arrays (of course, some triangles and models may be
skipped due to culling etc.).
Angles are in S3L_Units, a full angle (2 pi) is S3L_FRACTIONS_PER_UNITs. Angles are in S3L_Units, a full angle (2 pi) is S3L_FRACTIONS_PER_UNITs.
@ -57,8 +64,8 @@
Untransformed camera is placed at [0,0,0], looking forward along +z axis. The Untransformed camera is placed at [0,0,0], looking forward along +z axis. The
projection plane is centered at [0,0,0], stretrinch from projection plane is centered at [0,0,0], stretrinch from
-S3L_FRACTIONS_PER_UNIT to S3L_FRACTIONS_PER_UNIT horizontally (x), -S3L_FRACTIONS_PER_UNIT to S3L_FRACTIONS_PER_UNIT horizontally (x),
vertical size (y) depends on the camera aspect ratio. Camera FOV is defined vertical size (y) depends on the aspect ratio (S3L_RESOLUTION_X and
by focal length. S3L_RESOLUTION_Y). Camera FOV is defined by focal length in S3L_Units.
y ^ y ^
| _ | _
@ -74,7 +81,7 @@
ZXY order (by Z, then by X, then by Y). Positive rotation about an axis ZXY order (by Z, then by X, then by Y). Positive rotation about an axis
rotates CW (clock-wise) when looking in the direction of the axis. rotates CW (clock-wise) when looking in the direction of the axis.
Coordinates of pixels on screen start typically at the top left, from [0,0]. Coordinates of pixels on the screen start at the top left, from [0,0].
There is NO subpixel accuracy (screen coordinates are only integer). There is NO subpixel accuracy (screen coordinates are only integer).
@ -101,12 +108,12 @@
- Adjacent triangles don't have any overlapping pixels, nor gaps between. - Adjacent triangles don't have any overlapping pixels, nor gaps between.
- Triangles of points that lie on a single line are NOT rasterized. - Triangles of points that lie on a single line are NOT rasterized.
- A single "long" triangle CAN be rasterized as non-continuous. - A single "long" triangle CAN be rasterized as isolated islands of pixels.
- Transforming (e.g. mirroring, rotating by 90 degrees etc.) a result of - Transforming (e.g. mirroring, rotating by 90 degrees etc.) a result of
rasterizing triangle A is NOT generally equal to applying the same rasterizing triangle A is NOT generally equal to applying the same
transformation to triangle A first and then rasterizing it. Even the number transformation to triangle A first and then rasterizing it. Even the number
of rasterized pixels is usually different. of rasterized pixels is usually different.
- If specifying a triangle with integer coordinates, then: - If specifying a triangle with integer coordinates (which we are), then:
- The bottom-most corner (or side) of a triangle is never rasterized - The bottom-most corner (or side) of a triangle is never rasterized
(because it is connected to a right side). (because it is connected to a right side).
- The top-most corner can only be rasterized on completely horizontal side - The top-most corner can only be rasterized on completely horizontal side
@ -175,14 +182,20 @@ typedef uint16_t S3L_Index;
/** Specifies what type of perspective correction (PC) to use. Remember this /** Specifies what type of perspective correction (PC) to use. Remember this
is an expensive operation! Possible values: is an expensive operation! Possible values:
- 0: No perspective correction. Fastest, ugly. - 0: No perspective correction. Fastest, inaccurate from most angles.
- 1: Per-pixel perspective correction, nice but very expensive. - 1: Per-pixel perspective correction, accurate but very expensive.
- 2: Approximation (computing only at every S3L_PC_APPROX_LENGTHth pixel). */ - 2: Approximation (computing only at every S3L_PC_APPROX_LENGTHth pixel).
Quake-style approximation is used, which only computes the PC after
S3L_PC_APPROX_LENGTH pixels. This is reasonably accurate and fast. */
#define S3L_PERSPECTIVE_CORRECTION 0 #define S3L_PERSPECTIVE_CORRECTION 0
#endif #endif
#ifndef S3L_PC_APPROX_LENGTH #ifndef S3L_PC_APPROX_LENGTH
/** For S3L_PERSPECTIVE_CORRECTION == 2, this specifies after how many pixels
PC is recomputed. Should be a power of two to keep up the performance.
Smaller is nicer but slower. */
#define S3L_PC_APPROX_LENGTH 32 #define S3L_PC_APPROX_LENGTH 32
#endif #endif
@ -192,7 +205,8 @@ typedef uint16_t S3L_Index;
#ifndef S3L_COMPUTE_DEPTH #ifndef S3L_COMPUTE_DEPTH
/** Whether to compute depth for each pixel (fragment). Some other options /** Whether to compute depth for each pixel (fragment). Some other options
may turn this on automatically. */ may turn this on automatically. If you don't need depth information, turning
this off can save performance. */
#define S3L_COMPUTE_DEPTH 1 #define S3L_COMPUTE_DEPTH 1
#endif #endif
@ -215,26 +229,30 @@ typedef uint16_t S3L_Index;
#ifndef S3L_REDUCED_Z_BUFFER_GRANULARITY #ifndef S3L_REDUCED_Z_BUFFER_GRANULARITY
/** For S3L_Z_BUFFER == 2 this sets the reduced z-buffer granularity. */ /** For S3L_Z_BUFFER == 2 this sets the reduced z-buffer granularity. */
#define S3L_REDUCED_Z_BUFFER_GRANULARITY 5 #define S3L_REDUCED_Z_BUFFER_GRANULARITY 5
#endif #endif
#ifndef S3L_STENCIL_BUFFER #ifndef S3L_STENCIL_BUFFER
/** Whether to use stencil buffer for drawing -- with this a pixel that would /** Whether to use stencil buffer for drawing -- with this a pixel that would
be resterized over an already rasterized pixel will be discarded. This is be resterized over an already rasterized pixel (within a frame) will be
mostly for front-to-back sorted drawing. */ discarded. This is mostly for front-to-back sorted drawing. */
#define S3L_STENCIL_BUFFER 0 #define S3L_STENCIL_BUFFER 0
#endif #endif
#ifndef S3L_SORT #ifndef S3L_SORT
/** Defines how to sort triangles before drawing a frame. This can be used to /** Defines how to sort triangles before drawing a frame. This can be used to
solve visibility in case z-buffer is not used, to prevent overwrting already solve visibility in case z-buffer is not used, to prevent overwriting already
rasterized pixels, implement transparency etc. Note that for simplicity and rasterized pixels, implement transparency etc. Note that for simplicity and
performance a relatively simple sorting is used which doesn't work completely performance a relatively simple sorting is used which doesn't work completely
correctly, so mistakes can occur (even the best sorting wouldn't be able to correctly, so mistakes can occur (even the best sorting wouldn't be able to
solve e.g. intersecting triangles). Possible values: solve e.g. intersecting triangles). Note that sorting requires a bit of extra
memory -- an array of the triangles to sort -- the size of this array limits
the maximum number of triangles that can be drawn in a single frame
(S3L_MAX_TRIANGES_DRAWN). Possible values:
- 0: Don't sort triangles. This is fastest. - 0: Don't sort triangles. This is fastest and doesn't use extra memory.
- 1: Sort triangles from back to front. This can in most cases solve - 1: Sort triangles from back to front. This can in most cases solve
visibility without requiring almost any extra memory compared to visibility without requiring almost any extra memory compared to
z-buffer. z-buffer.
@ -275,7 +293,8 @@ typedef uint16_t S3L_Index;
#endif #endif
/** Vector that consists of four scalars and can represent homogenous /** Vector that consists of four scalars and can represent homogenous
coordinates, but is generally also used as Vec3 and Vec2. */ coordinates, but is generally also used as Vec3 and Vec2 for various
purposes. */
typedef struct typedef struct
{ {
S3L_Unit x; S3L_Unit x;
@ -284,6 +303,9 @@ typedef struct
S3L_Unit w; S3L_Unit w;
} S3L_Vec4; } S3L_Vec4;
#define S3L_logVec4(v)\
printf("Vec4: %d %d %d %d\n",((v).x),((v).y),((v).z),((v).w))
static inline void S3L_initVec4(S3L_Vec4 *v); static inline void S3L_initVec4(S3L_Vec4 *v);
static inline void S3L_setVec4(S3L_Vec4 *v, S3L_Unit x, S3L_Unit y, static inline void S3L_setVec4(S3L_Vec4 *v, S3L_Unit x, S3L_Unit y,
S3L_Unit z, S3L_Unit w); S3L_Unit z, S3L_Unit w);
@ -301,7 +323,7 @@ static inline S3L_Unit S3L_dotProductVec3(S3L_Vec4 a, S3L_Vec4 b);
be normalized as well. */ be normalized as well. */
void S3L_reflect(S3L_Vec4 toLight, S3L_Vec4 normal, S3L_Vec4 *result); void S3L_reflect(S3L_Vec4 toLight, S3L_Vec4 normal, S3L_Vec4 *result);
/** Determines the winding of triangle, returns 1 (CW, clockwise), -1 (CCW, /** Determines the winding of a triangle, returns 1 (CW, clockwise), -1 (CCW,
counterclockwise) or 0 (points lie on a single line). */ counterclockwise) or 0 (points lie on a single line). */
static inline int8_t S3L_triangleWinding( static inline int8_t S3L_triangleWinding(
S3L_ScreenCoord x0, S3L_ScreenCoord x0,
@ -311,9 +333,6 @@ static inline int8_t S3L_triangleWinding(
S3L_ScreenCoord x2, S3L_ScreenCoord x2,
S3L_ScreenCoord y2); S3L_ScreenCoord y2);
#define S3L_logVec4(v)\
printf("Vec4: %d %d %d %d\n",((v).x),((v).y),((v).z),((v).w))
typedef struct typedef struct
{ {
S3L_Vec4 translation; S3L_Vec4 translation;
@ -355,7 +374,6 @@ void S3L_rotationToDirections(
S3L_Vec4 *right, S3L_Vec4 *right,
S3L_Vec4 *up); S3L_Vec4 *up);
/** 4x4 matrix, used mostly for 3D transforms. The indexing is this: /** 4x4 matrix, used mostly for 3D transforms. The indexing is this:
matrix[column][row]. */ matrix[column][row]. */
typedef S3L_Unit S3L_Mat4[4][4]; typedef S3L_Unit S3L_Mat4[4][4];
@ -538,7 +556,6 @@ void S3L_triangleNormal(S3L_Vec4 t0, S3L_Vec4 t1, S3L_Vec4 t2,
vectors (into x, y, z and w, depending on 'numComponents'). This function is vectors (into x, y, z and w, depending on 'numComponents'). This function is
meant to be used per-triangle (typically from a cache), NOT per-pixel, as it meant to be used per-triangle (typically from a cache), NOT per-pixel, as it
is not as fast as possible! */ is not as fast as possible! */
void S3L_getIndexedTriangleValues( void S3L_getIndexedTriangleValues(
S3L_Index triangleIndex, S3L_Index triangleIndex,
const S3L_Index *indices, const S3L_Index *indices,
@ -554,7 +571,6 @@ void S3L_getIndexedTriangleValues(
sizeof(S3L_Unit). Note that for advanced allowing sharp edges it is not sizeof(S3L_Unit). Note that for advanced allowing sharp edges it is not
sufficient to have per-vertex normals, but must be per-triangle. This sufficient to have per-vertex normals, but must be per-triangle. This
function doesn't support this. */ function doesn't support this. */
void S3L_computeModelNormals(S3L_Model3D model, S3L_Unit *dst, void S3L_computeModelNormals(S3L_Model3D model, S3L_Unit *dst,
int8_t transformNormals); int8_t transformNormals);