Working on model loading and added poker table

This commit is contained in:
2021-05-09 14:38:08 -07:00
parent 4a3b6c2f98
commit 848f3cc3b8
30 changed files with 1789 additions and 38 deletions

2
.gitignore vendored
View File

@ -4,7 +4,7 @@
# Object files
*.o
*.ko
*.obj
build/*.obj
*.elf
# Linker output

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

View File

@ -0,0 +1,492 @@
# Blender v2.92.0 OBJ File: 'Poker Table.blend'
# www.blender.org
o Cube
v 3.002608 0.000000 -1.243721
v 2.934959 0.176777 -1.215700
v 2.608318 0.176777 -1.080401
v 2.540669 0.000000 -1.052380
v 2.771638 -0.250000 -1.148051
v 2.934959 -0.176777 -1.215700
v 1.243721 0.000000 -3.002609
v 1.215699 0.176777 -2.934959
v 1.080400 0.176777 -2.608318
v 1.052379 0.000000 -2.540669
v 1.148050 -0.250000 -2.771639
v 1.215699 -0.176777 -2.934959
v -1.243721 0.000000 -3.002608
v -1.215700 0.176777 -2.934959
v -1.080401 0.176777 -2.608318
v -1.052379 0.000000 -2.540669
v -1.148050 -0.250000 -2.771638
v -1.215700 -0.176777 -2.934959
v -3.002609 0.000000 -1.243720
v -2.934959 0.176777 -1.215699
v -2.608319 0.176777 -1.080400
v -2.540669 0.000000 -1.052379
v -2.771639 -0.250000 -1.148049
v -2.934959 -0.176777 -1.215699
v -3.002608 0.000000 1.243721
v -2.934959 0.176777 1.215700
v -2.608318 0.176777 1.080401
v -2.540669 0.000000 1.052379
v -2.771638 -0.250000 1.148050
v -2.934959 -0.176777 1.215700
v -1.243722 0.000000 3.002608
v -1.215700 0.176777 2.934959
v -1.080401 0.176777 2.608318
v -1.052380 0.000000 2.540668
v -1.148051 -0.250000 2.771638
v -1.215700 -0.176777 2.934959
v 1.243722 0.000000 3.002608
v 1.215700 0.176777 2.934959
v 1.080401 0.176777 2.608318
v 1.052380 0.000000 2.540669
v 1.148051 -0.250000 2.771638
v 1.215700 -0.176777 2.934959
v 3.002608 0.000000 1.243722
v 2.934958 0.176777 1.215701
v 2.608318 0.176777 1.080402
v 2.540668 0.000000 1.052381
v 2.771638 -0.250000 1.148052
v 2.934958 -0.176777 1.215701
v -0.000000 -2.250000 -0.562500
v -0.000000 -0.250000 -0.562500
v 0.397748 -2.250000 -0.397748
v 0.397748 -0.250000 -0.397748
v 0.562500 -2.250000 0.000000
v 0.562500 -0.250000 0.000000
v 0.397748 -2.250000 0.397748
v 0.397748 -0.250000 0.397748
v -0.000000 -2.250000 0.562500
v -0.000000 -0.250000 0.562500
v -0.397748 -2.250000 0.397748
v -0.397748 -0.250000 0.397748
v -0.562500 -2.250000 -0.000000
v -0.562500 -0.250000 -0.000000
v -0.397748 -2.250000 -0.397748
v -0.397748 -0.250000 -0.397748
v -1.875000 -2.500000 0.562500
v -1.875000 -2.250000 0.562500
v -1.875000 -2.500000 -0.562500
v -1.875000 -2.250000 -0.562500
v 1.875000 -2.500000 0.562500
v 1.875000 -2.250000 0.562500
v 1.875000 -2.500000 -0.562500
v 1.875000 -2.250000 -0.562500
v 0.562500 -2.500000 1.875000
v 0.562500 -2.250000 1.875000
v -0.562500 -2.500000 1.875000
v -0.562500 -2.250000 1.875000
v 0.562500 -2.500000 -1.875000
v 0.562500 -2.250000 -1.875000
v -0.562500 -2.500000 -1.875000
v -0.562500 -2.250000 -1.875000
v 0.562500 -2.250000 -0.562500
v 0.562500 -2.500000 -0.562500
v 0.562500 -2.250000 0.562500
v 0.562500 -2.500000 0.562500
v -0.562500 -2.250000 -1.875000
v -0.562500 -2.500000 -1.875000
v -0.562500 -2.250000 1.875000
v -0.562500 -2.500000 1.875000
v -0.562500 -2.500000 -0.562500
v -0.562500 -2.250000 -0.562500
v -0.562500 -2.250000 0.562500
v -0.562500 -2.500000 0.562500
v -0.562500 -2.250000 -0.562500
v -0.562500 -2.250000 0.562500
v -0.562500 -2.500000 -0.562500
v -0.562500 -2.500000 0.562500
vt 0.836914 0.734375
vt 0.853516 0.935547
vt 0.836914 0.935547
vt 0.426758 0.990234
vt 0.411133 0.817383
vt 0.426758 0.817383
vt 0.937500 0.566406
vt 0.952148 0.761719
vt 0.937500 0.761719
vt 0.920898 0.000000
vt 0.936523 0.199219
vt 0.920898 0.199219
vt 0.473633 0.761719
vt 0.489258 0.961914
vt 0.473633 0.961914
vt 0.984375 0.234375
vt 0.968750 0.407227
vt 0.968750 0.234375
vt 0.914062 0.969727
vt 0.928711 0.774414
vt 0.928711 0.969727
vt 0.936523 0.407227
vt 0.920898 0.208008
vt 0.936523 0.208008
vt 0.914062 0.766602
vt 0.929688 0.566406
vt 0.929688 0.766602
vt 0.960938 0.407227
vt 0.944336 0.234375
vt 0.960938 0.234375
vt 0.615234 0.761719
vt 0.630859 0.957031
vt 0.615234 0.957031
vt 0.861328 0.735352
vt 0.876953 0.935547
vt 0.861328 0.935547
vt 0.544922 0.961914
vt 0.560547 0.761719
vt 0.560547 0.961914
vt 0.967773 0.173828
vt 0.983398 0.000000
vt 0.983398 0.173828
vt 0.937500 0.770508
vt 0.953125 0.966797
vt 0.937500 0.966797
vt 0.497070 0.761719
vt 0.512695 0.961914
vt 0.497070 0.961914
vt 0.805664 0.935547
vt 0.790039 0.735352
vt 0.805664 0.735352
vt 0.434570 0.990234
vt 0.450195 0.817383
vt 0.450195 0.990234
vt 0.944336 0.000000
vt 0.959961 0.195312
vt 0.944336 0.195312
vt 0.813477 0.735352
vt 0.829102 0.935547
vt 0.813477 0.935547
vt 0.757812 0.935547
vt 0.742188 0.736328
vt 0.757812 0.736328
vt 0.960938 0.748047
vt 0.976562 0.921875
vt 0.960938 0.921875
vt 0.638672 0.957031
vt 0.654297 0.761719
vt 0.654297 0.957031
vt 0.765625 0.735352
vt 0.781250 0.935547
vt 0.765625 0.935547
vt 0.520508 0.961914
vt 0.536133 0.761719
vt 0.536133 0.961914
vt 0.026367 0.148438
vt 0.136719 0.000000
vt 0.146484 0.028320
vt 1.000000 0.740234
vt 0.984375 0.566406
vt 1.000000 0.566406
vt 0.889648 0.774414
vt 0.905273 0.969727
vt 0.889648 0.969727
vt 0.568359 0.761719
vt 0.583984 0.961914
vt 0.568359 0.961914
vt 0.889648 0.565430
vt 0.906250 0.766602
vt 0.889648 0.766602
vt 0.976562 0.566406
vt 0.960938 0.740234
vt 0.960938 0.566406
vt 0.592773 0.957031
vt 0.608398 0.761719
vt 0.608398 0.957031
vt 0.734375 0.935547
vt 0.717773 0.735352
vt 0.734375 0.735352
vt 0.000000 0.333984
vt 0.000000 0.136719
vt 0.026367 0.323242
vt 0.136719 0.470703
vt 0.318359 0.443359
vt 0.328125 0.470703
vt 0.465820 0.333008
vt 0.438477 0.323242
vt 0.465820 0.137695
vt 0.318359 0.028320
vt 0.328125 0.000000
vt 0.402220 0.766728
vt 0.119141 0.885742
vt 0.000000 0.598633
vt 0.472656 0.314453
vt 0.472656 0.130859
vt 0.916016 0.314453
vt 0.881836 0.727539
vt 0.846680 0.566406
vt 0.881836 0.566406
vt 0.752930 0.727539
vt 0.717773 0.566406
vt 0.752930 0.566406
vt 0.709961 0.896484
vt 0.674805 0.735352
vt 0.709961 0.735352
vt 0.709961 0.727539
vt 0.674805 0.566406
vt 0.709961 0.566406
vt 0.795898 0.727539
vt 0.760742 0.566406
vt 0.795898 0.566406
vt 0.445312 0.808594
vt 0.410156 0.647461
vt 0.445312 0.647461
vt 0.838867 0.727539
vt 0.803711 0.566406
vt 0.838867 0.566406
vt 0.445312 0.639648
vt 0.410156 0.478516
vt 0.445312 0.478516
vt 0.028691 0.984986
vt 0.048481 0.894905
vt 0.048481 0.984986
vt 0.801758 0.558594
vt 0.822266 0.452148
vt 0.822266 0.558594
vt 0.057383 0.984986
vt 0.077172 0.894905
vt 0.077172 0.984986
vt 0.114766 0.984986
vt 0.134555 0.894905
vt 0.134555 0.984986
vt 0.086074 0.984986
vt 0.105863 0.894905
vt 0.105863 0.984986
vt 0.879883 0.452148
vt 0.858398 0.558594
vt 0.858398 0.452148
vt 0.830078 0.452148
vt 0.850586 0.558594
vt 0.830078 0.558594
vt 0.937500 0.558594
vt 0.916016 0.452148
vt 0.937500 0.452148
vt 0.945312 0.558594
vt 0.965820 0.452148
vt 0.965820 0.558594
vt 0.020508 0.895508
vt 0.000000 1.000000
vt 0.000000 0.895508
vt 0.793945 0.452148
vt 0.772461 0.558594
vt 0.772461 0.452148
vt 0.887695 0.558594
vt 0.908203 0.452148
vt 0.908203 0.558594
vt 0.674805 0.452148
vt 0.764648 0.558594
vt 0.674805 0.558594
vt 0.577148 0.557617
vt 0.666487 0.452869
vt 0.666992 0.753906
vt 0.472656 0.648438
vt 0.472656 0.557617
vt 0.853516 0.734375
vt 0.411133 0.990234
vt 0.952148 0.566406
vt 0.936523 0.000000
vt 0.489258 0.761719
vt 0.984375 0.407227
vt 0.914062 0.774414
vt 0.920898 0.407227
vt 0.914062 0.566406
vt 0.944336 0.407227
vt 0.630859 0.761719
vt 0.876953 0.735352
vt 0.544922 0.761719
vt 0.967773 0.000000
vt 0.953125 0.770508
vt 0.512695 0.761719
vt 0.790039 0.935547
vt 0.434570 0.817383
vt 0.959961 0.000000
vt 0.829102 0.735352
vt 0.742188 0.935547
vt 0.976562 0.748047
vt 0.638672 0.761719
vt 0.781250 0.735352
vt 0.520508 0.761719
vt 0.984375 0.740234
vt 0.905273 0.774414
vt 0.583984 0.761719
vt 0.906250 0.565430
vt 0.976562 0.740234
vt 0.592773 0.761719
vt 0.717773 0.935547
vt 0.146484 0.443359
vt 0.438477 0.148438
vt 0.119141 0.479492
vt 0.283203 0.479492
vt 0.402344 0.598633
vt 0.283203 0.885742
vt 0.000000 0.766602
vt 0.602539 0.000977
vt 0.786133 0.000977
vt 0.916016 0.130859
vt 0.786133 0.444336
vt 0.602539 0.444336
vt 0.846680 0.727539
vt 0.717773 0.727539
vt 0.674805 0.896484
vt 0.674805 0.727539
vt 0.760742 0.727539
vt 0.410156 0.808594
vt 0.803711 0.727539
vt 0.410156 0.639648
vt 0.028691 0.894905
vt 0.801758 0.452148
vt 0.057383 0.894905
vt 0.114766 0.894905
vt 0.086074 0.894905
vt 0.879883 0.558594
vt 0.850586 0.452148
vt 0.916016 0.558594
vt 0.945312 0.452148
vt 0.020508 1.000000
vt 0.793945 0.558594
vt 0.887695 0.452148
vt 0.764648 0.452148
vt 0.577148 0.753906
vt 0.577148 0.648438
vt 0.577436 0.452869
s off
f 7/1 2/2 1/3
f 9/4 4/5 3/6
f 11/7 6/8 5/9
f 12/10 1/11 6/12
f 13/13 8/14 7/15
f 9/16 16/17 10/18
f 11/19 18/20 12/21
f 18/22 7/23 12/24
f 13/25 20/26 14/27
f 21/28 16/29 15/30
f 23/31 18/32 17/33
f 24/34 13/35 18/36
f 19/37 26/38 20/39
f 21/40 28/41 22/42
f 29/43 24/44 23/45
f 30/46 19/47 24/48
f 31/49 26/50 25/51
f 27/52 34/53 28/54
f 35/55 30/56 29/57
f 36/58 25/59 30/60
f 37/61 32/62 31/63
f 39/64 34/65 33/66
f 35/67 42/68 36/69
f 42/70 31/71 36/72
f 37/73 44/74 38/75
f 33/76 38/77 39/78
f 45/79 40/80 39/81
f 47/82 42/83 41/84
f 48/85 37/86 42/87
f 1/88 44/89 43/90
f 45/91 4/92 46/93
f 47/94 6/95 48/96
f 6/97 43/98 48/99
f 33/76 26/100 32/101
f 27/102 20/103 26/100
f 20/103 15/104 14/105
f 15/104 8/106 14/105
f 9/107 2/108 8/106
f 2/108 45/109 44/110
f 39/78 44/110 45/109
f 34/111 22/112 10/113
f 17/114 11/115 35/116
f 50/117 51/118 49/119
f 52/120 53/121 51/122
f 54/123 55/124 53/125
f 56/126 57/127 55/128
f 58/129 59/130 57/131
f 60/132 61/133 59/134
f 62/135 63/136 61/137
f 64/138 49/139 63/140
f 66/141 67/142 65/143
f 87/144 92/145 88/146
f 72/147 69/148 71/149
f 74/150 75/151 73/152
f 80/153 77/154 79/155
f 86/156 90/157 85/158
f 72/159 82/160 81/161
f 69/162 83/163 84/164
f 68/165 95/166 67/167
f 65/168 94/169 66/170
f 73/171 83/172 74/173
f 78/174 82/175 77/176
f 94/177 68/178 66/179
f 81/180 80/181 76/182
f 81/180 70/183 72/184
f 7/1 8/185 2/2
f 9/4 10/186 4/5
f 11/7 12/187 6/8
f 12/10 7/188 1/11
f 13/13 14/189 8/14
f 9/16 15/190 16/17
f 11/19 17/191 18/20
f 18/22 13/192 7/23
f 13/25 19/193 20/26
f 21/28 22/194 16/29
f 23/31 24/195 18/32
f 24/34 19/196 13/35
f 19/37 25/197 26/38
f 21/40 27/198 28/41
f 29/43 30/199 24/44
f 30/46 25/200 19/47
f 31/49 32/201 26/50
f 27/52 33/202 34/53
f 35/55 36/203 30/56
f 36/58 31/204 25/59
f 37/61 38/205 32/62
f 39/64 40/206 34/65
f 35/67 41/207 42/68
f 42/70 37/208 31/71
f 37/73 43/209 44/74
f 33/76 32/101 38/77
f 45/79 46/210 40/80
f 47/82 48/211 42/83
f 48/85 43/212 37/86
f 1/88 2/213 44/89
f 45/91 3/214 4/92
f 47/94 5/215 6/95
f 6/97 1/216 43/98
f 33/76 27/102 26/100
f 27/102 21/217 20/103
f 20/103 21/217 15/104
f 15/104 9/107 8/106
f 9/107 3/218 2/108
f 2/108 3/218 45/109
f 39/78 38/77 44/110
f 10/113 4/219 34/111
f 4/219 46/220 34/111
f 46/220 40/221 34/111
f 34/111 28/222 22/112
f 22/112 16/223 10/113
f 11/115 5/224 47/225
f 47/225 41/226 11/115
f 41/226 35/116 11/115
f 35/116 29/227 23/228
f 23/228 17/114 35/116
f 50/117 52/229 51/118
f 52/120 54/230 53/121
f 54/123 56/231 55/124
f 56/126 58/232 57/127
f 58/129 60/233 59/130
f 60/132 62/234 61/133
f 62/135 64/235 63/136
f 64/138 50/236 49/139
f 66/141 68/237 67/142
f 87/144 91/238 92/145
f 72/147 70/239 69/148
f 74/150 76/240 75/151
f 80/153 78/241 77/154
f 86/156 89/242 90/157
f 72/159 71/243 82/160
f 69/162 70/244 83/163
f 68/165 93/245 95/166
f 65/168 96/246 94/169
f 73/171 84/247 83/172
f 78/174 81/248 82/175
f 94/177 93/249 68/178
f 76/182 74/250 83/251
f 81/180 78/252 80/181
f 76/182 83/251 81/180
f 81/180 83/251 70/183

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
assets/pokertable.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

View File

@ -81,10 +81,17 @@ typedef struct {
tileset_t *kagamiTileset;
primitive_t *kagamiQuad;
primitive_t *tablePrimitive;
texture_t *tableTexture;
texture_t *cardTexture;
tileset_t *cardTileset;
primitive_t *cardPrimitive;
texture_t *fontTexture;
tileset_t *fontTileset;
spritebatch_t *fontBatch;
/** Game Render Frames */
framebuffer_t *frameLeft;
framebuffer_t *frameRight;

View File

@ -16,6 +16,10 @@
#include "display/texture.h"
#include "display/tileset.h"
#include "display/debug/position.h"
#include "display/gui/font.h"
// File / Asset Management
#include "file/asset.h"

View File

@ -0,0 +1,27 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "../../libs.h"
#include "../primitive.h"
#include "../texture.h"
#include "../tileset.h"
#define POSITION_DEBUG_FONT_CHARS_MAX 256
/** Struct representing a positionable object in space */
typedef struct {
primitive_t *primitive;
spritebatch_t *textBatch;
texture_t *textTexture;
tileset_t *textTileset;
float x, y, z;
float pitch, yaw, roll;
float scaleX, scaleY, scaleZ;
} positiondebug_t;

View File

@ -0,0 +1,25 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "../../libs.h"
/** Which is the first character within the font tilemap */
#define FONT_CHAR_START 33
/** Center a font along the X axis */
#define FONT_CENTER_X 9876543
/** Center a font along the Y axis */
#define FONT_CENTER_Y -FONT_CENTER_X
/** Align right edge of font to origin */
#define FONT_RIGHT_X (FONT_CENTER_X-1)
typedef struct {
float width, height;
int32_t lines;
} fontmeasure_t;

View File

@ -8,14 +8,26 @@
#include "../util/list.h"
/** Inputs */
#define INPUT_UP (inputbind_t)0x01
#define INPUT_DOWN (inputbind_t)0x02
#define INPUT_LEFT (inputbind_t)0x03
#define INPUT_RIGHT (inputbind_t)0x04
/** Debug Inputs */
#define INPUT_NULL (inputbind_t)0x00
#define INPUT_DEBUG_UP (inputbind_t)0x01
#define INPUT_DEBUG_DOWN (inputbind_t)0x02
#define INPUT_DEBUG_LEFT (inputbind_t)0x03
#define INPUT_DEBUG_RIGHT (inputbind_t)0x04
#define INPUT_DEBUG_RAISE (inputbind_t)0x05
#define INPUT_DEBUG_LOWER (inputbind_t)0x06
#define INPUT_DEBUG_FINE (inputbind_t)0x07
#define INPUT_DEBUG_PLUS (inputbind_t)0x08
#define INPUT_DEBUG_MINUS (inputbind_t)0x09
#define INPUT_NULL (inputbind_t)0x00
#define INPUT_BIND_COUNT 128
/** Real Inputs (Starts at 128/0x80) */
#define INPUT_UP (inputbind_t)0x80
#define INPUT_DOWN (inputbind_t)0x81
#define INPUT_LEFT (inputbind_t)0x82
#define INPUT_RIGHT (inputbind_t)0x83
#define INPUT_BIND_COUNT 0xFF
#define INPUT_SOURCE_COUNT 4096
/**

View File

@ -21,6 +21,19 @@ void holdemGameInit() {
HOLDEM_GAME_STATE.quadLeft = quadCreate(0, 0, 0, 0, 0, lWidth, height, 1, 1);
HOLDEM_GAME_STATE.quadRight = quadCreate(0, 0, 0, 0, 0, rWidth, height, 1, 1);
// Font
HOLDEM_GAME_STATE.fontTexture = assetTextureLoad("font.png");
HOLDEM_GAME_STATE.fontTileset = tilesetCreate(20, 20,
HOLDEM_GAME_STATE.fontTexture->width,
HOLDEM_GAME_STATE.fontTexture->height,
1, 1, 1, 1
);
HOLDEM_GAME_STATE.fontBatch = spriteBatchCreate(1024);
// Poker Table
HOLDEM_GAME_STATE.tablePrimitive = pokerTableCreate();
HOLDEM_GAME_STATE.tableTexture = assetTextureLoad("pokertable.png");
// Kagami
HOLDEM_GAME_STATE.kagamiTexture = assetTextureLoad("kagami.png");
HOLDEM_GAME_STATE.kagamiTileset = tilesetCreate(3, 2,
@ -54,15 +67,23 @@ void holdemGameInit() {
// Prepare match
holdemMatchInit(&HOLDEM_GAME_STATE.match);
holdemRoundInit(&HOLDEM_GAME_STATE.match);
cardShuffle(HOLDEM_GAME_STATE.match.deck, HOLDEM_GAME_STATE.match.deckSize);
holdemFlop(&HOLDEM_GAME_STATE.match);
}
void holdemGameUpdate() {
int32_t lWidth, rWidth, height;
TIME_STATE.current;
// Resize Frame buffers.
lWidth = HOLDEM_GAME_FRAME_LEFT_WIDTH, rWidth = HOLDEM_GAME_FRAME_RIGHT_WIDTH;
height = HOLDEM_GAME_FRAME_HEIGHT;
if(HOLDEM_GAME_STATE.frameLeft->texture->width != lWidth) {
if(
HOLDEM_GAME_STATE.frameLeft->texture->width != lWidth ||
HOLDEM_GAME_STATE.frameLeft->texture->height != height
) {
frameBufferDispose(HOLDEM_GAME_STATE.frameLeft);
frameBufferDispose(HOLDEM_GAME_STATE.frameRight);
HOLDEM_GAME_STATE.frameLeft = frameBufferCreate(lWidth, height);

View File

@ -9,7 +9,9 @@
#include <dawn/dawn.h>
#include "holdem.h"
#include "render/holdemrender.h"
#include "../card.h"
#include "../../display/framebuffer.h"
#include "../../display/debug/position.h"
#include "../../display/primitive.h"
#include "../../display/shader.h"
#include "../../display/camera.h"
@ -17,6 +19,8 @@
#include "../../display/tileset.h"
#include "../../display/primitives/quad.h"
#include "../../file/asset.h"
#include "../../display/gui/font.h"
#include "model/pokertable.h"
void holdemGameInit();

View File

@ -0,0 +1,697 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "pokertable.h"
primitive_t * pokerTableCreate() {
vertice_t vertices[POKER_TABLE_VERTICE_COUNT] = {
{ .x = 0.12437210000000001, .y = 0, .z = -0.30026090000000005, .u = 0.836914, .v = 0.265625 },
{ .x = 0.29349590000000003, .y = 0.0176777, .z = -0.12157000000000001, .u = 0.853516, .v = 0.06445299999999998 },
{ .x = 0.3002608, .y = 0, .z = -0.12437210000000001, .u = 0.836914, .v = 0.06445299999999998 },
{ .x = 0.10804000000000001, .y = 0.0176777, .z = -0.2608318, .u = 0.426758, .v = 0.009766000000000052 },
{ .x = 0.2540669, .y = 0, .z = -0.10523800000000001, .u = 0.411133, .v = 0.18261700000000003 },
{ .x = 0.2608318, .y = 0.0176777, .z = -0.1080401, .u = 0.426758, .v = 0.18261700000000003 },
{ .x = 0.114805, .y = -0.025, .z = -0.2771639, .u = 0.9375, .v = 0.43359400000000003 },
{ .x = 0.29349590000000003, .y = -0.0176777, .z = -0.12157000000000001, .u = 0.952148, .v = 0.23828099999999997 },
{ .x = 0.2771638, .y = -0.025, .z = -0.1148051, .u = 0.9375, .v = 0.23828099999999997 },
{ .x = 0.12156990000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.920898, .v = 1 },
{ .x = 0.3002608, .y = 0, .z = -0.12437210000000001, .u = 0.936523, .v = 0.800781 },
{ .x = 0.29349590000000003, .y = -0.0176777, .z = -0.12157000000000001, .u = 0.920898, .v = 0.800781 },
{ .x = -0.12437210000000001, .y = 0, .z = -0.3002608, .u = 0.473633, .v = 0.23828099999999997 },
{ .x = 0.12156990000000001, .y = 0.0176777, .z = -0.29349590000000003, .u = 0.489258, .v = 0.03808599999999995 },
{ .x = 0.12437210000000001, .y = 0, .z = -0.30026090000000005, .u = 0.473633, .v = 0.03808599999999995 },
{ .x = 0.10804000000000001, .y = 0.0176777, .z = -0.2608318, .u = 0.984375, .v = 0.765625 },
{ .x = -0.1052379, .y = 0, .z = -0.2540669, .u = 0.96875, .v = 0.592773 },
{ .x = 0.1052379, .y = 0, .z = -0.2540669, .u = 0.96875, .v = 0.765625 },
{ .x = 0.114805, .y = -0.025, .z = -0.2771639, .u = 0.914062, .v = 0.030272999999999994 },
{ .x = -0.12157000000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.928711, .v = 0.22558599999999995 },
{ .x = 0.12156990000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.928711, .v = 0.030272999999999994 },
{ .x = -0.12157000000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.936523, .v = 0.592773 },
{ .x = 0.12437210000000001, .y = 0, .z = -0.30026090000000005, .u = 0.920898, .v = 0.791992 },
{ .x = 0.12156990000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.936523, .v = 0.791992 },
{ .x = -0.12437210000000001, .y = 0, .z = -0.3002608, .u = 0.914062, .v = 0.233398 },
{ .x = -0.29349590000000003, .y = 0.0176777, .z = -0.12156990000000001, .u = 0.929688, .v = 0.43359400000000003 },
{ .x = -0.12157000000000001, .y = 0.0176777, .z = -0.29349590000000003, .u = 0.929688, .v = 0.233398 },
{ .x = -0.2608319, .y = 0.0176777, .z = -0.10804000000000001, .u = 0.960938, .v = 0.592773 },
{ .x = -0.1052379, .y = 0, .z = -0.2540669, .u = 0.944336, .v = 0.765625 },
{ .x = -0.1080401, .y = 0.0176777, .z = -0.2608318, .u = 0.960938, .v = 0.765625 },
{ .x = -0.2771639, .y = -0.025, .z = -0.11480490000000002, .u = 0.615234, .v = 0.23828099999999997 },
{ .x = -0.12157000000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.630859, .v = 0.042969000000000035 },
{ .x = -0.114805, .y = -0.025, .z = -0.2771638, .u = 0.615234, .v = 0.042969000000000035 },
{ .x = -0.29349590000000003, .y = -0.0176777, .z = -0.12156990000000001, .u = 0.861328, .v = 0.264648 },
{ .x = -0.12437210000000001, .y = 0, .z = -0.3002608, .u = 0.876953, .v = 0.06445299999999998 },
{ .x = -0.12157000000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.861328, .v = 0.06445299999999998 },
{ .x = -0.30026090000000005, .y = 0, .z = -0.124372, .u = 0.544922, .v = 0.03808599999999995 },
{ .x = -0.29349590000000003, .y = 0.0176777, .z = 0.12157000000000001, .u = 0.560547, .v = 0.23828099999999997 },
{ .x = -0.29349590000000003, .y = 0.0176777, .z = -0.12156990000000001, .u = 0.560547, .v = 0.03808599999999995 },
{ .x = -0.2608319, .y = 0.0176777, .z = -0.10804000000000001, .u = 0.967773, .v = 0.826172 },
{ .x = -0.2540669, .y = 0, .z = 0.1052379, .u = 0.983398, .v = 1 },
{ .x = -0.2540669, .y = 0, .z = -0.1052379, .u = 0.983398, .v = 0.826172 },
{ .x = -0.2771638, .y = -0.025, .z = 0.114805, .u = 0.9375, .v = 0.22949200000000003 },
{ .x = -0.29349590000000003, .y = -0.0176777, .z = -0.12156990000000001, .u = 0.953125, .v = 0.03320299999999998 },
{ .x = -0.2771639, .y = -0.025, .z = -0.11480490000000002, .u = 0.9375, .v = 0.03320299999999998 },
{ .x = -0.29349590000000003, .y = -0.0176777, .z = 0.12157000000000001, .u = 0.49707, .v = 0.23828099999999997 },
{ .x = -0.30026090000000005, .y = 0, .z = -0.124372, .u = 0.512695, .v = 0.03808599999999995 },
{ .x = -0.29349590000000003, .y = -0.0176777, .z = -0.12156990000000001, .u = 0.49707, .v = 0.03808599999999995 },
{ .x = -0.1243722, .y = 0, .z = 0.3002608, .u = 0.805664, .v = 0.06445299999999998 },
{ .x = -0.29349590000000003, .y = 0.0176777, .z = 0.12157000000000001, .u = 0.790039, .v = 0.264648 },
{ .x = -0.3002608, .y = 0, .z = 0.12437210000000001, .u = 0.805664, .v = 0.264648 },
{ .x = -0.2608318, .y = 0.0176777, .z = 0.1080401, .u = 0.43457, .v = 0.009766000000000052 },
{ .x = -0.10523800000000001, .y = 0, .z = 0.25406680000000004, .u = 0.450195, .v = 0.18261700000000003 },
{ .x = -0.2540669, .y = 0, .z = 0.1052379, .u = 0.450195, .v = 0.009766000000000052 },
{ .x = -0.1148051, .y = -0.025, .z = 0.2771638, .u = 0.944336, .v = 1 },
{ .x = -0.29349590000000003, .y = -0.0176777, .z = 0.12157000000000001, .u = 0.959961, .v = 0.804688 },
{ .x = -0.2771638, .y = -0.025, .z = 0.114805, .u = 0.944336, .v = 0.804688 },
{ .x = -0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.813477, .v = 0.264648 },
{ .x = -0.3002608, .y = 0, .z = 0.12437210000000001, .u = 0.829102, .v = 0.06445299999999998 },
{ .x = -0.29349590000000003, .y = -0.0176777, .z = 0.12157000000000001, .u = 0.813477, .v = 0.06445299999999998 },
{ .x = 0.1243722, .y = 0, .z = 0.3002608, .u = 0.757812, .v = 0.06445299999999998 },
{ .x = -0.12157000000000001, .y = 0.0176777, .z = 0.29349590000000003, .u = 0.742188, .v = 0.263672 },
{ .x = -0.1243722, .y = 0, .z = 0.3002608, .u = 0.757812, .v = 0.263672 },
{ .x = 0.1080401, .y = 0.0176777, .z = 0.2608318, .u = 0.960938, .v = 0.251953 },
{ .x = -0.10523800000000001, .y = 0, .z = 0.25406680000000004, .u = 0.976562, .v = 0.078125 },
{ .x = -0.1080401, .y = 0.0176777, .z = 0.2608318, .u = 0.960938, .v = 0.078125 },
{ .x = -0.1148051, .y = -0.025, .z = 0.2771638, .u = 0.638672, .v = 0.042969000000000035 },
{ .x = 0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.654297, .v = 0.23828099999999997 },
{ .x = -0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.654297, .v = 0.042969000000000035 },
{ .x = 0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.765625, .v = 0.264648 },
{ .x = -0.1243722, .y = 0, .z = 0.3002608, .u = 0.78125, .v = 0.06445299999999998 },
{ .x = -0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.765625, .v = 0.06445299999999998 },
{ .x = 0.1243722, .y = 0, .z = 0.3002608, .u = 0.520508, .v = 0.03808599999999995 },
{ .x = 0.29349580000000003, .y = 0.0176777, .z = 0.1215701, .u = 0.536133, .v = 0.23828099999999997 },
{ .x = 0.12157000000000001, .y = 0.0176777, .z = 0.29349590000000003, .u = 0.536133, .v = 0.03808599999999995 },
{ .x = -0.1080401, .y = 0.0176777, .z = 0.2608318, .u = 0.026367, .v = 0.851562 },
{ .x = 0.12157000000000001, .y = 0.0176777, .z = 0.29349590000000003, .u = 0.136719, .v = 1 },
{ .x = 0.1080401, .y = 0.0176777, .z = 0.2608318, .u = 0.146484, .v = 0.97168 },
{ .x = 0.2608318, .y = 0.0176777, .z = 0.10804020000000002, .u = 1, .v = 0.25976600000000005 },
{ .x = 0.10523800000000001, .y = 0, .z = 0.2540669, .u = 0.984375, .v = 0.43359400000000003 },
{ .x = 0.1080401, .y = 0.0176777, .z = 0.2608318, .u = 1, .v = 0.43359400000000003 },
{ .x = 0.2771638, .y = -0.025, .z = 0.11480520000000001, .u = 0.889648, .v = 0.22558599999999995 },
{ .x = 0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.905273, .v = 0.030272999999999994 },
{ .x = 0.1148051, .y = -0.025, .z = 0.2771638, .u = 0.889648, .v = 0.030272999999999994 },
{ .x = 0.29349580000000003, .y = -0.0176777, .z = 0.1215701, .u = 0.568359, .v = 0.23828099999999997 },
{ .x = 0.1243722, .y = 0, .z = 0.3002608, .u = 0.583984, .v = 0.03808599999999995 },
{ .x = 0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.568359, .v = 0.03808599999999995 },
{ .x = 0.3002608, .y = 0, .z = -0.12437210000000001, .u = 0.889648, .v = 0.43457 },
{ .x = 0.29349580000000003, .y = 0.0176777, .z = 0.1215701, .u = 0.90625, .v = 0.233398 },
{ .x = 0.3002608, .y = 0, .z = 0.1243722, .u = 0.889648, .v = 0.233398 },
{ .x = 0.2608318, .y = 0.0176777, .z = 0.10804020000000002, .u = 0.976562, .v = 0.43359400000000003 },
{ .x = 0.2540669, .y = 0, .z = -0.10523800000000001, .u = 0.960938, .v = 0.25976600000000005 },
{ .x = 0.25406680000000004, .y = 0, .z = 0.1052381, .u = 0.960938, .v = 0.43359400000000003 },
{ .x = 0.2771638, .y = -0.025, .z = 0.11480520000000001, .u = 0.592773, .v = 0.042969000000000035 },
{ .x = 0.29349590000000003, .y = -0.0176777, .z = -0.12157000000000001, .u = 0.608398, .v = 0.23828099999999997 },
{ .x = 0.29349580000000003, .y = -0.0176777, .z = 0.1215701, .u = 0.608398, .v = 0.042969000000000035 },
{ .x = 0.29349590000000003, .y = -0.0176777, .z = -0.12157000000000001, .u = 0.734375, .v = 0.06445299999999998 },
{ .x = 0.3002608, .y = 0, .z = 0.1243722, .u = 0.717773, .v = 0.264648 },
{ .x = 0.29349580000000003, .y = -0.0176777, .z = 0.1215701, .u = 0.734375, .v = 0.264648 },
{ .x = -0.29349590000000003, .y = 0.0176777, .z = 0.12157000000000001, .u = 0, .v = 0.6660159999999999 },
{ .x = -0.12157000000000001, .y = 0.0176777, .z = 0.29349590000000003, .u = 0, .v = 0.863281 },
{ .x = -0.2608318, .y = 0.0176777, .z = 0.1080401, .u = 0.026367, .v = 0.676758 },
{ .x = -0.29349590000000003, .y = 0.0176777, .z = -0.12156990000000001, .u = 0.136719, .v = 0.529297 },
{ .x = -0.1080401, .y = 0.0176777, .z = -0.2608318, .u = 0.318359, .v = 0.5566409999999999 },
{ .x = -0.12157000000000001, .y = 0.0176777, .z = -0.29349590000000003, .u = 0.328125, .v = 0.529297 },
{ .x = 0.12156990000000001, .y = 0.0176777, .z = -0.29349590000000003, .u = 0.46582, .v = 0.666992 },
{ .x = 0.10804000000000001, .y = 0.0176777, .z = -0.2608318, .u = 0.438477, .v = 0.676758 },
{ .x = 0.29349590000000003, .y = 0.0176777, .z = -0.12157000000000001, .u = 0.46582, .v = 0.862305 },
{ .x = 0.2608318, .y = 0.0176777, .z = 0.10804020000000002, .u = 0.318359, .v = 0.97168 },
{ .x = 0.29349580000000003, .y = 0.0176777, .z = 0.1215701, .u = 0.328125, .v = 1 },
{ .x = -0.10523800000000001, .y = 0, .z = 0.25406680000000004, .u = 0.40222, .v = 0.23327200000000003 },
{ .x = -0.2540669, .y = 0, .z = -0.1052379, .u = 0.119141, .v = 0.11425799999999997 },
{ .x = 0.1052379, .y = 0, .z = -0.2540669, .u = 0, .v = 0.40136700000000003 },
{ .x = -0.114805, .y = -0.025, .z = -0.2771638, .u = 0.472656, .v = 0.685547 },
{ .x = 0.114805, .y = -0.025, .z = -0.2771639, .u = 0.472656, .v = 0.8691409999999999 },
{ .x = -0.1148051, .y = -0.025, .z = 0.2771638, .u = 0.916016, .v = 0.685547 },
{ .x = 0, .y = -0.025, .z = -0.05625, .u = 0.881836, .v = 0.27246099999999995 },
{ .x = 0.0397748, .y = -0.225, .z = -0.0397748, .u = 0.84668, .v = 0.43359400000000003 },
{ .x = 0, .y = -0.225, .z = -0.05625, .u = 0.881836, .v = 0.43359400000000003 },
{ .x = 0.0397748, .y = -0.025, .z = -0.0397748, .u = 0.75293, .v = 0.27246099999999995 },
{ .x = 0.05625, .y = -0.225, .z = 0, .u = 0.717773, .v = 0.43359400000000003 },
{ .x = 0.0397748, .y = -0.225, .z = -0.0397748, .u = 0.75293, .v = 0.43359400000000003 },
{ .x = 0.05625, .y = -0.025, .z = 0, .u = 0.709961, .v = 0.10351600000000005 },
{ .x = 0.0397748, .y = -0.225, .z = 0.0397748, .u = 0.674805, .v = 0.264648 },
{ .x = 0.05625, .y = -0.225, .z = 0, .u = 0.709961, .v = 0.264648 },
{ .x = 0.0397748, .y = -0.025, .z = 0.0397748, .u = 0.709961, .v = 0.27246099999999995 },
{ .x = 0, .y = -0.225, .z = 0.05625, .u = 0.674805, .v = 0.43359400000000003 },
{ .x = 0.0397748, .y = -0.225, .z = 0.0397748, .u = 0.709961, .v = 0.43359400000000003 },
{ .x = 0, .y = -0.025, .z = 0.05625, .u = 0.795898, .v = 0.27246099999999995 },
{ .x = -0.0397748, .y = -0.225, .z = 0.0397748, .u = 0.760742, .v = 0.43359400000000003 },
{ .x = 0, .y = -0.225, .z = 0.05625, .u = 0.795898, .v = 0.43359400000000003 },
{ .x = -0.0397748, .y = -0.025, .z = 0.0397748, .u = 0.445312, .v = 0.19140599999999997 },
{ .x = -0.05625, .y = -0.225, .z = 0, .u = 0.410156, .v = 0.35253900000000005 },
{ .x = -0.0397748, .y = -0.225, .z = 0.0397748, .u = 0.445312, .v = 0.35253900000000005 },
{ .x = -0.05625, .y = -0.025, .z = 0, .u = 0.838867, .v = 0.27246099999999995 },
{ .x = -0.0397748, .y = -0.225, .z = -0.0397748, .u = 0.803711, .v = 0.43359400000000003 },
{ .x = -0.05625, .y = -0.225, .z = 0, .u = 0.838867, .v = 0.43359400000000003 },
{ .x = -0.0397748, .y = -0.025, .z = -0.0397748, .u = 0.445312, .v = 0.360352 },
{ .x = 0, .y = -0.225, .z = -0.05625, .u = 0.410156, .v = 0.5214840000000001 },
{ .x = -0.0397748, .y = -0.225, .z = -0.0397748, .u = 0.445312, .v = 0.5214840000000001 },
{ .x = -0.1875, .y = -0.225, .z = 0.05625, .u = 0.028691, .v = 0.015013999999999972 },
{ .x = -0.1875, .y = -0.25, .z = -0.05625, .u = 0.048481, .v = 0.10509500000000005 },
{ .x = -0.1875, .y = -0.25, .z = 0.05625, .u = 0.048481, .v = 0.015013999999999972 },
{ .x = -0.05625, .y = -0.225, .z = 0.1875, .u = 0.801758, .v = 0.44140599999999997 },
{ .x = -0.05625, .y = -0.25, .z = 0.05625, .u = 0.822266, .v = 0.547852 },
{ .x = -0.05625, .y = -0.25, .z = 0.1875, .u = 0.822266, .v = 0.44140599999999997 },
{ .x = 0.1875, .y = -0.225, .z = -0.05625, .u = 0.057383, .v = 0.015013999999999972 },
{ .x = 0.1875, .y = -0.25, .z = 0.05625, .u = 0.077172, .v = 0.10509500000000005 },
{ .x = 0.1875, .y = -0.25, .z = -0.05625, .u = 0.077172, .v = 0.015013999999999972 },
{ .x = 0.05625, .y = -0.225, .z = 0.1875, .u = 0.114766, .v = 0.015013999999999972 },
{ .x = -0.05625, .y = -0.25, .z = 0.1875, .u = 0.134555, .v = 0.10509500000000005 },
{ .x = 0.05625, .y = -0.25, .z = 0.1875, .u = 0.134555, .v = 0.015013999999999972 },
{ .x = -0.05625, .y = -0.225, .z = -0.1875, .u = 0.086074, .v = 0.015013999999999972 },
{ .x = 0.05625, .y = -0.25, .z = -0.1875, .u = 0.105863, .v = 0.10509500000000005 },
{ .x = -0.05625, .y = -0.25, .z = -0.1875, .u = 0.105863, .v = 0.015013999999999972 },
{ .x = -0.05625, .y = -0.25, .z = -0.1875, .u = 0.879883, .v = 0.547852 },
{ .x = -0.05625, .y = -0.225, .z = -0.05625, .u = 0.858398, .v = 0.44140599999999997 },
{ .x = -0.05625, .y = -0.225, .z = -0.1875, .u = 0.858398, .v = 0.547852 },
{ .x = 0.1875, .y = -0.225, .z = -0.05625, .u = 0.830078, .v = 0.547852 },
{ .x = 0.05625, .y = -0.25, .z = -0.05625, .u = 0.850586, .v = 0.44140599999999997 },
{ .x = 0.05625, .y = -0.225, .z = -0.05625, .u = 0.830078, .v = 0.44140599999999997 },
{ .x = 0.1875, .y = -0.25, .z = 0.05625, .u = 0.9375, .v = 0.44140599999999997 },
{ .x = 0.05625, .y = -0.225, .z = 0.05625, .u = 0.916016, .v = 0.547852 },
{ .x = 0.05625, .y = -0.25, .z = 0.05625, .u = 0.9375, .v = 0.547852 },
{ .x = -0.1875, .y = -0.225, .z = -0.05625, .u = 0.945312, .v = 0.44140599999999997 },
{ .x = -0.05625, .y = -0.25, .z = -0.05625, .u = 0.96582, .v = 0.547852 },
{ .x = -0.1875, .y = -0.25, .z = -0.05625, .u = 0.96582, .v = 0.44140599999999997 },
{ .x = -0.1875, .y = -0.25, .z = 0.05625, .u = 0.020508, .v = 0.10449200000000003 },
{ .x = -0.05625, .y = -0.225, .z = 0.05625, .u = 0, .v = 0 },
{ .x = -0.1875, .y = -0.225, .z = 0.05625, .u = 0, .v = 0.10449200000000003 },
{ .x = 0.05625, .y = -0.25, .z = 0.1875, .u = 0.793945, .v = 0.547852 },
{ .x = 0.05625, .y = -0.225, .z = 0.05625, .u = 0.772461, .v = 0.44140599999999997 },
{ .x = 0.05625, .y = -0.225, .z = 0.1875, .u = 0.772461, .v = 0.547852 },
{ .x = 0.05625, .y = -0.225, .z = -0.1875, .u = 0.887695, .v = 0.44140599999999997 },
{ .x = 0.05625, .y = -0.25, .z = -0.05625, .u = 0.908203, .v = 0.547852 },
{ .x = 0.05625, .y = -0.25, .z = -0.1875, .u = 0.908203, .v = 0.44140599999999997 },
{ .x = -0.05625, .y = -0.225, .z = 0.05625, .u = 0.674805, .v = 0.547852 },
{ .x = -0.1875, .y = -0.225, .z = -0.05625, .u = 0.764648, .v = 0.44140599999999997 },
{ .x = -0.1875, .y = -0.225, .z = 0.05625, .u = 0.674805, .v = 0.44140599999999997 },
{ .x = 0.05625, .y = -0.225, .z = -0.05625, .u = 0.577148, .v = 0.44238299999999997 },
{ .x = -0.05625, .y = -0.225, .z = -0.1875, .u = 0.666487, .v = 0.547131 },
{ .x = -0.05625, .y = -0.225, .z = 0.1875, .u = 0.666992, .v = 0.24609400000000003 },
{ .x = 0.1875, .y = -0.225, .z = 0.05625, .u = 0.472656, .v = 0.35156200000000004 },
{ .x = 0.1875, .y = -0.225, .z = -0.05625, .u = 0.472656, .v = 0.44238299999999997 },
{ .x = 0.12156990000000001, .y = 0.0176777, .z = -0.29349590000000003, .u = 0.853516, .v = 0.265625 },
{ .x = 0.1052379, .y = 0, .z = -0.2540669, .u = 0.411133, .v = 0.009766000000000052 },
{ .x = 0.12156990000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.952148, .v = 0.43359400000000003 },
{ .x = 0.12437210000000001, .y = 0, .z = -0.30026090000000005, .u = 0.936523, .v = 1 },
{ .x = -0.12157000000000001, .y = 0.0176777, .z = -0.29349590000000003, .u = 0.489258, .v = 0.23828099999999997 },
{ .x = -0.1080401, .y = 0.0176777, .z = -0.2608318, .u = 0.984375, .v = 0.592773 },
{ .x = -0.114805, .y = -0.025, .z = -0.2771638, .u = 0.914062, .v = 0.22558599999999995 },
{ .x = -0.12437210000000001, .y = 0, .z = -0.3002608, .u = 0.920898, .v = 0.592773 },
{ .x = -0.30026090000000005, .y = 0, .z = -0.124372, .u = 0.914062, .v = 0.43359400000000003 },
{ .x = -0.2540669, .y = 0, .z = -0.1052379, .u = 0.944336, .v = 0.592773 },
{ .x = -0.29349590000000003, .y = -0.0176777, .z = -0.12156990000000001, .u = 0.630859, .v = 0.23828099999999997 },
{ .x = -0.30026090000000005, .y = 0, .z = -0.124372, .u = 0.876953, .v = 0.264648 },
{ .x = -0.3002608, .y = 0, .z = 0.12437210000000001, .u = 0.544922, .v = 0.23828099999999997 },
{ .x = -0.2608318, .y = 0.0176777, .z = 0.1080401, .u = 0.967773, .v = 1 },
{ .x = -0.29349590000000003, .y = -0.0176777, .z = 0.12157000000000001, .u = 0.953125, .v = 0.22949200000000003 },
{ .x = -0.3002608, .y = 0, .z = 0.12437210000000001, .u = 0.512695, .v = 0.23828099999999997 },
{ .x = -0.12157000000000001, .y = 0.0176777, .z = 0.29349590000000003, .u = 0.790039, .v = 0.06445299999999998 },
{ .x = -0.1080401, .y = 0.0176777, .z = 0.2608318, .u = 0.43457, .v = 0.18261700000000003 },
{ .x = -0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.959961, .v = 1 },
{ .x = -0.1243722, .y = 0, .z = 0.3002608, .u = 0.829102, .v = 0.264648 },
{ .x = 0.12157000000000001, .y = 0.0176777, .z = 0.29349590000000003, .u = 0.742188, .v = 0.06445299999999998 },
{ .x = 0.10523800000000001, .y = 0, .z = 0.2540669, .u = 0.976562, .v = 0.251953 },
{ .x = 0.1148051, .y = -0.025, .z = 0.2771638, .u = 0.638672, .v = 0.23828099999999997 },
{ .x = 0.1243722, .y = 0, .z = 0.3002608, .u = 0.78125, .v = 0.264648 },
{ .x = 0.3002608, .y = 0, .z = 0.1243722, .u = 0.520508, .v = 0.23828099999999997 },
{ .x = 0.25406680000000004, .y = 0, .z = 0.1052381, .u = 0.984375, .v = 0.25976600000000005 },
{ .x = 0.29349580000000003, .y = -0.0176777, .z = 0.1215701, .u = 0.905273, .v = 0.22558599999999995 },
{ .x = 0.3002608, .y = 0, .z = 0.1243722, .u = 0.583984, .v = 0.23828099999999997 },
{ .x = 0.29349590000000003, .y = 0.0176777, .z = -0.12157000000000001, .u = 0.90625, .v = 0.43457 },
{ .x = 0.2608318, .y = 0.0176777, .z = -0.1080401, .u = 0.976562, .v = 0.25976600000000005 },
{ .x = 0.2771638, .y = -0.025, .z = -0.1148051, .u = 0.592773, .v = 0.23828099999999997 },
{ .x = 0.3002608, .y = 0, .z = -0.12437210000000001, .u = 0.717773, .v = 0.06445299999999998 },
{ .x = -0.2608319, .y = 0.0176777, .z = -0.10804000000000001, .u = 0.146484, .v = 0.5566409999999999 },
{ .x = 0.2608318, .y = 0.0176777, .z = -0.1080401, .u = 0.438477, .v = 0.851562 },
{ .x = 0.2540669, .y = 0, .z = -0.10523800000000001, .u = 0.119141, .v = 0.520508 },
{ .x = 0.25406680000000004, .y = 0, .z = 0.1052381, .u = 0.283203, .v = 0.520508 },
{ .x = 0.10523800000000001, .y = 0, .z = 0.2540669, .u = 0.402344, .v = 0.40136700000000003 },
{ .x = -0.2540669, .y = 0, .z = 0.1052379, .u = 0.283203, .v = 0.11425799999999997 },
{ .x = -0.1052379, .y = 0, .z = -0.2540669, .u = 0, .v = 0.233398 },
{ .x = 0.2771638, .y = -0.025, .z = -0.1148051, .u = 0.602539, .v = 0.999023 },
{ .x = 0.2771638, .y = -0.025, .z = 0.11480520000000001, .u = 0.786133, .v = 0.999023 },
{ .x = 0.1148051, .y = -0.025, .z = 0.2771638, .u = 0.916016, .v = 0.8691409999999999 },
{ .x = -0.2771638, .y = -0.025, .z = 0.114805, .u = 0.786133, .v = 0.5556639999999999 },
{ .x = -0.2771639, .y = -0.025, .z = -0.11480490000000002, .u = 0.602539, .v = 0.5556639999999999 },
{ .x = 0.0397748, .y = -0.025, .z = -0.0397748, .u = 0.84668, .v = 0.27246099999999995 },
{ .x = 0.05625, .y = -0.025, .z = 0, .u = 0.717773, .v = 0.27246099999999995 },
{ .x = 0.0397748, .y = -0.025, .z = 0.0397748, .u = 0.674805, .v = 0.10351600000000005 },
{ .x = 0, .y = -0.025, .z = 0.05625, .u = 0.674805, .v = 0.27246099999999995 },
{ .x = -0.0397748, .y = -0.025, .z = 0.0397748, .u = 0.760742, .v = 0.27246099999999995 },
{ .x = -0.05625, .y = -0.025, .z = 0, .u = 0.410156, .v = 0.19140599999999997 },
{ .x = -0.0397748, .y = -0.025, .z = -0.0397748, .u = 0.803711, .v = 0.27246099999999995 },
{ .x = 0, .y = -0.025, .z = -0.05625, .u = 0.410156, .v = 0.360352 },
{ .x = -0.1875, .y = -0.225, .z = -0.05625, .u = 0.028691, .v = 0.10509500000000005 },
{ .x = -0.05625, .y = -0.225, .z = 0.05625, .u = 0.801758, .v = 0.547852 },
{ .x = 0.1875, .y = -0.225, .z = 0.05625, .u = 0.057383, .v = 0.10509500000000005 },
{ .x = -0.05625, .y = -0.225, .z = 0.1875, .u = 0.114766, .v = 0.10509500000000005 },
{ .x = 0.05625, .y = -0.225, .z = -0.1875, .u = 0.086074, .v = 0.10509500000000005 },
{ .x = -0.05625, .y = -0.25, .z = -0.05625, .u = 0.879883, .v = 0.44140599999999997 },
{ .x = 0.1875, .y = -0.25, .z = -0.05625, .u = 0.850586, .v = 0.547852 },
{ .x = 0.1875, .y = -0.225, .z = 0.05625, .u = 0.916016, .v = 0.44140599999999997 },
{ .x = -0.05625, .y = -0.225, .z = -0.05625, .u = 0.945312, .v = 0.547852 },
{ .x = -0.05625, .y = -0.25, .z = 0.05625, .u = 0.020508, .v = 0 },
{ .x = 0.05625, .y = -0.25, .z = 0.05625, .u = 0.793945, .v = 0.44140599999999997 },
{ .x = 0.05625, .y = -0.225, .z = -0.05625, .u = 0.887695, .v = 0.547852 },
{ .x = -0.05625, .y = -0.225, .z = -0.05625, .u = 0.764648, .v = 0.547852 },
{ .x = 0.05625, .y = -0.225, .z = 0.1875, .u = 0.577148, .v = 0.24609400000000003 },
{ .x = 0.05625, .y = -0.225, .z = 0.05625, .u = 0.577148, .v = 0.35156200000000004 },
{ .x = 0.05625, .y = -0.225, .z = -0.1875, .u = 0.577436, .v = 0.547131 }
};
indice_t indices[POKER_TABLE_INDICE_COUNT] = {
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
75,
99,
100,
101,
102,
99,
102,
103,
104,
103,
105,
104,
106,
107,
105,
107,
108,
109,
77,
109,
108,
110,
111,
112,
113,
114,
115,
116,
117,
118,
119,
120,
121,
122,
123,
124,
125,
126,
127,
128,
129,
130,
131,
132,
133,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
147,
148,
149,
150,
151,
152,
153,
154,
155,
156,
157,
158,
159,
160,
161,
162,
163,
164,
165,
166,
167,
168,
169,
170,
171,
172,
173,
174,
175,
176,
177,
178,
179,
180,
181,
179,
182,
183,
0,
184,
1,
3,
185,
4,
6,
186,
7,
9,
187,
10,
12,
188,
13,
15,
189,
16,
18,
190,
19,
21,
191,
22,
24,
192,
25,
27,
193,
28,
30,
194,
31,
33,
195,
34,
36,
196,
37,
39,
197,
40,
42,
198,
43,
45,
199,
46,
48,
200,
49,
51,
201,
52,
54,
202,
55,
57,
203,
58,
60,
204,
61,
63,
205,
64,
66,
206,
67,
69,
207,
70,
72,
208,
73,
75,
100,
76,
78,
209,
79,
81,
210,
82,
84,
211,
85,
87,
212,
88,
90,
213,
91,
93,
214,
94,
96,
215,
97,
75,
101,
99,
101,
216,
102,
102,
216,
103,
103,
106,
105,
106,
217,
107,
107,
217,
108,
77,
76,
109,
112,
218,
110,
218,
219,
110,
219,
220,
110,
110,
221,
111,
111,
222,
112,
114,
223,
224,
224,
225,
114,
225,
115,
114,
115,
226,
227,
227,
113,
115,
116,
228,
117,
119,
229,
120,
122,
230,
123,
125,
231,
126,
128,
232,
129,
131,
233,
132,
134,
234,
135,
137,
235,
138,
140,
236,
141,
143,
237,
144,
146,
238,
147,
149,
239,
150,
152,
240,
153,
155,
241,
156,
158,
242,
159,
161,
243,
162,
164,
244,
165,
167,
245,
168,
170,
246,
171,
173,
247,
174,
176,
248,
177,
181,
249,
250,
179,
251,
180,
181,
250,
179,
179,
250,
182
};
primitive_t *primitive = primitiveCreate(
POKER_TABLE_VERTICE_COUNT,
POKER_TABLE_INDICE_COUNT
);
primitiveBufferVertices(primitive, 0, POKER_TABLE_VERTICE_COUNT, vertices);
primitiveBufferIndices(primitive, 0, POKER_TABLE_INDICE_COUNT, indices);
return primitive;
}

View File

@ -0,0 +1,22 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <dawn/dawn.h>
#include "../../../display/primitive.h"
#define POKER_TABLE_NAME "Poker Table"
#define POKER_TABLE_VERTICE_COUNT 252
#define POKER_TABLE_INDICE_COUNT 420
#define POKER_TABLE_TRIANGLE_COUNT 140
/**
* Generated Model Poker Table
* Generated at Sun, 09 May 2021 21:15:45 GMT
* @returns Poker Table as a primitive.
*/
primitive_t * pokerTableCreate();

View File

@ -9,10 +9,10 @@
void holdemRenderPlayer(float x, float y, float z, float yaw) {
float w, h;
w = 1, h = (
w = 0.75, h = (
(float)HOLDEM_GAME_STATE.kagamiTileset->divY /
(float)HOLDEM_GAME_STATE.kagamiTileset->divX
);
) * w;
int i = (int32_t)(TIME_STATE.current*10)%HOLDEM_GAME_STATE.kagamiTileset->count;
quadBuffer(HOLDEM_GAME_STATE.kagamiQuad, 0,
@ -48,12 +48,62 @@ void holdemRenderCard(card_t card,
}
void holdemRenderWorld() {
holdemRenderCard(CARD_HEARTS_QUEEN, 0, 0, 0, mathDeg2Rad(-90), 0, 0);
uint8_t i, j;
float pitch;
holdemplayer_t *player;
char name[16];
// Poker Table
shaderUsePositionAndScale(GAME_STATE.shaderWorld,
0, -0.01, 0.05,
0, 0, 0,
3.29, 3.29, 3.29
);
shaderUseTexture(GAME_STATE.shaderWorld, HOLDEM_GAME_STATE.tableTexture);
primitiveDraw(HOLDEM_GAME_STATE.tablePrimitive, 0, -1);
for(j = 0; j < HOLDEM_GAME_STATE.match.cardsFacing; j++) {
pitch = mathDeg2Rad(-90);
holdemRenderCard(HOLDEM_GAME_STATE.match.cards[j], j*0.2, 0, -0.2, pitch, 0, 0);
}
for(i = 0; i < HOLDEM_PLAYER_COUNT; i++) {
player = HOLDEM_GAME_STATE.match.players + i;
if(player->state & HOLDEM_STATE_FOLDED) continue;
sprintf(name, "Player %i", i);
shaderUseTexture(GAME_STATE.shaderWorld, HOLDEM_GAME_STATE.fontTexture);
spriteBatchFlush(HOLDEM_GAME_STATE.fontBatch);
shaderUsePosition(GAME_STATE.shaderWorld, -0.1,0,i*0.2, mathDeg2Rad(-90),0,0);
fontSpriteBatchBuffer(
HOLDEM_GAME_STATE.fontBatch,
HOLDEM_GAME_STATE.fontTileset,
name, FONT_RIGHT_X, FONT_CENTER_Y, 0, -1, 0.1
);
spriteBatchDraw(HOLDEM_GAME_STATE.fontBatch, 0, -1);
for(j = 0; j < HOLDEM_PLAYER_HAND; j++) {
// pitch = mathDeg2Rad(player->state & HOLDEM_STATE_SHOWING ? -90 : 90);
holdemRenderCard(player->cards[j], j*0.2, 0, i*0.2, pitch, 0, 0);
}
}
shaderUseTexture(GAME_STATE.shaderWorld, HOLDEM_GAME_STATE.fontTexture);
spriteBatchFlush(HOLDEM_GAME_STATE.fontBatch);
shaderUsePosition(GAME_STATE.shaderWorld, -0.1,0,-0.2, mathDeg2Rad(-90),0,0);
fontSpriteBatchBuffer(
HOLDEM_GAME_STATE.fontBatch,
HOLDEM_GAME_STATE.fontTileset,
"Dealer", FONT_RIGHT_X, FONT_CENTER_Y, 0, -1, 0.1
);
spriteBatchDraw(HOLDEM_GAME_STATE.fontBatch, 0, -1);
// Draw the players
holdemRenderPlayer(0, 0, -1, 0);
holdemRenderPlayer(-1, 0, -0, 90);
holdemRenderPlayer(-0.75, 0, 0.75, -45);
holdemRenderPlayer(0.75, 0, 0.75, 45);
holdemRenderPlayer(1, 0, 0, -90);
float playerY = 0;
holdemRenderPlayer(0, playerY, -1, 0);
holdemRenderPlayer(-1, playerY, -0, 90);
holdemRenderPlayer(-0.75, playerY, 0.75, -45);
holdemRenderPlayer(0.75, playerY, 0.75, 45);
holdemRenderPlayer(1, playerY, 0, -90);
}

View File

@ -10,6 +10,8 @@
#include "../../../display/shader.h"
#include "../../../display/primitive.h"
#include "../../../display/primitives/quad.h"
#include "../../../display/spritebatch.h"
#include "../../../display/gui/font.h"
#include "../../../util/math.h"
void holdemRenderPlayer(float x, float y, float z, float yaw);

View File

@ -0,0 +1,81 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "position.h"
positiondebug_t positionDebugCreate(
primitive_t *debugPrimitive,
texture_t *fontTexture, tileset_t *fontTileset
) {
positiondebug_t debug = {
.primitive = debugPrimitive,
.textTexture = fontTexture,
.textTileset = fontTileset,
.x = 0, .y = 0, .z = 0,
.pitch = 0, .yaw = 0, .roll = 0,
.scaleX = 1, .scaleY = 1, .scaleZ = 1
};
debug.textBatch = spriteBatchCreate(POSITION_DEBUG_FONT_CHARS_MAX);
return debug;
}
void positionDebugRender(shader_t *shader, positiondebug_t *debug) {
float speed = 0.5;
// Update values.
if(inputIsDown(INPUT_DEBUG_FINE)) speed *= 0.1;
if(inputIsDown(INPUT_DEBUG_UP)) debug->z -= TIME_STATE.delta * speed;
if(inputIsDown(INPUT_DEBUG_DOWN)) debug->z += TIME_STATE.delta * speed;
if(inputIsDown(INPUT_DEBUG_LEFT)) debug->x -= TIME_STATE.delta * speed;
if(inputIsDown(INPUT_DEBUG_RIGHT)) debug->x += TIME_STATE.delta * speed;
if(inputIsDown(INPUT_DEBUG_LOWER)) debug->y -= TIME_STATE.delta * speed;
if(inputIsDown(INPUT_DEBUG_RAISE)) debug->y += TIME_STATE.delta * speed;
if(inputIsDown(INPUT_DEBUG_MINUS)) {
debug->scaleX -= TIME_STATE.delta * speed;
debug->scaleY -= TIME_STATE.delta * speed;
debug->scaleZ -= TIME_STATE.delta * speed;
}
if(inputIsDown(INPUT_DEBUG_PLUS)) {
debug->scaleX += TIME_STATE.delta * speed;
debug->scaleY += TIME_STATE.delta * speed;
debug->scaleZ += TIME_STATE.delta * speed;
}
// Render object
shaderUsePositionAndScale(shader,
debug->x, debug->y, debug->z,
mathDeg2Rad(debug->pitch),mathDeg2Rad(debug->yaw),mathDeg2Rad(debug->roll),
debug->scaleX, debug->scaleY, debug->scaleZ
);
primitiveDraw(debug->primitive, 0, -1);
// Render debug text
char text[POSITION_DEBUG_FONT_CHARS_MAX];
sprintf(text, "%.2f, %.2f, %.2f\n%.2f, %.2f, %.2f \n%.2f, %.2f, %.2f",
debug->x, debug->y, debug->z,
debug->pitch, debug->yaw, debug->roll,
debug->scaleX, debug->scaleY, debug->scaleZ
);
shaderUseTexture(shader, debug->textTexture);
shaderUsePosition(shader,
0, 1, 0,
mathDeg2Rad(-90), mathDeg2Rad(0), 0
);
spriteBatchFlush(debug->textBatch);
fontSpriteBatchBuffer(debug->textBatch, debug->textTileset, text,
FONT_CENTER_X, FONT_CENTER_Y, 0,
-1, 0.1
);
spriteBatchDraw(debug->textBatch, 0, -1);
}
void positionDebugDispose(positiondebug_t *debug) {
spriteBatchDispose(debug->textBatch);
}

View File

@ -0,0 +1,27 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <dawn/dawn.h>
#include "../primitive.h"
#include "../texture.h"
#include "../tileset.h"
#include "../gui/font.h"
#include "../spritebatch.h"
#include "../shader.h"
#include "../../input/input.h"
#include "../../util/math.h"
positiondebug_t positionDebugCreate(
primitive_t *debugPrimitive,
texture_t *fontTexture, tileset_t *fontTileset
);
void positionDebugRender(shader_t *shader, positiondebug_t *debug);
void positionDebugDispose(positiondebug_t *debug);

View File

@ -12,14 +12,74 @@ tilesetdiv_t * fontGetCharacterDivision(tileset_t *tileset, char character) {
return tileset->divisions + i;
}
void fontSpriteBatchBuffer(spritebatch_t *batch, tileset_t *tileset,
fontmeasure_t fontMeasure(char *string, float charWidth, float charHeight) {
int32_t i;
float x, y;
char c;
fontmeasure_t measure = {
.height = 0, .lines = 1, .width = 0
};
i = 0;
y = 0;
x = 0;
while(true) {
c = string[i];
if(c == '\0') break;
i++;
if(c == '\n') {
measure.width = mathMax(x, measure.width);
x = 0;
y += charHeight;
measure.lines++;
continue;
} else if(c == ' ') {
x += charWidth;
continue;
}
x += charWidth;
}
measure.width = mathMax(x, measure.width);
measure.height = y + charHeight;
return measure;
}
fontmeasure_t fontSpriteBatchBuffer(spritebatch_t *batch, tileset_t *tileset,
char *string, float x, float y, float z, float charWidth, float charHeight
) {
int32_t i;
char c;
tilesetdiv_t *div;
float cx, cy;
fontmeasure_t measure;
// Detect char dimensions
if(charWidth == -1) charWidth = tileset->divX * (charHeight / tileset->divY);
if(charHeight == -1) charHeight = tileset->divY * (charWidth / tileset->divX);
// Position the text.
if(x == FONT_CENTER_X ||
y == FONT_CENTER_Y ||
x == FONT_RIGHT_X
) {
measure = fontMeasure(string, charWidth, charHeight);
if(x == FONT_CENTER_X) {
x = -(measure.width/2);
} else if(x == FONT_RIGHT_X) {
x = -measure.width;
}
if(y == FONT_CENTER_Y) y = -(measure.height/2);
}
// Begin buffering the sprite batch
measure.width = 0;
measure.height = 0;
measure.lines = 1;
i = 0;
cx = x, cy = y;
@ -28,20 +88,28 @@ void fontSpriteBatchBuffer(spritebatch_t *batch, tileset_t *tileset,
if(c == '\0') break;
i++;
// Special chars
if(c == '\n') {
measure.width = mathMax(cx-x, measure.width);
cx = x;
cy += charWidth;
cy += charHeight;
measure.lines++;
continue;
} else if(c == ' ') {
cx += charHeight;
cx += charWidth;
continue;
}
div = fontGetCharacterDivision(tileset, c);
spriteBatchQuad(batch, -1,
cx, cy, z, charWidth, charHeight,
div->x0, div->y0, div->x1, div->y1
div->x0, div->y1, div->x1, div->y0
);
cx += charWidth;
}
measure.width = mathMax(cx-x, measure.width);
measure.height = cy-y + charHeight;
return measure;
}

View File

@ -8,8 +8,7 @@
#pragma once
#include <dawn/dawn.h>
#include "../spritebatch.h"
#define FONT_CHAR_START 33
#include "../../util/math.h"
/**
* Get the division for a given character.
@ -20,6 +19,16 @@
*/
tilesetdiv_t * fontGetCharacterDivision(tileset_t *tileset, char character);
/**
* Measures a string's fully rendered size.
*
* @param string The string to measure
* @param charWidth The width of each character.
* @param charHeight The height of each character.
* @return The measured string.
*/
fontmeasure_t fontMeasure(char *string, float charWidth, float charHeight);
/**
* Renders a set of font characters to the sprite. Coordinates are anchored to
* the top left (0,0) origin.
@ -30,9 +39,10 @@ tilesetdiv_t * fontGetCharacterDivision(tileset_t *tileset, char character);
* @param x Position in X space.
* @param y Position in Y space.
* @param z Position in Z space.
* @param charWidth Width of each character.
* @param charHeight Height of each character.
* @param charWidth Width of each character. Set to -1 to use the height ratio.
* @param charHeight Height of each character. Set to -1 to be the width ratio.
* @returns The string measurement.
*/
void fontSpriteBatchBuffer(spritebatch_t *batch, tileset_t *tileset,
fontmeasure_t fontSpriteBatchBuffer(spritebatch_t *batch, tileset_t *tileset,
char *string, float x, float y, float z, float charWidth, float charHeight
);

View File

@ -131,13 +131,41 @@ void shaderUsePosition(shader_t *shader,
//Rotation, we do each axis individually
axis[0] = 1, axis[1] = 0, axis[2] = 0;
glm_rotate(MATRIX_POSITION, pitch, axis);
axis[0] = 0, axis[1] = 1;
glm_rotate(MATRIX_POSITION, yaw, axis);
axis[1] = 0, axis[2] = 1;
glm_rotate(MATRIX_POSITION, roll, axis);
//Send to the shader.
glUniformMatrix4fv(shader->uniModl, 1, GL_FALSE, MATRIX_POSITION[0]);
}
void shaderUsePositionAndScale(shader_t *shader,
float x, float y, float z,
float pitch, float yaw, float roll,
float scaleX, float scaleY, float scaleZ
) {
mat4 MATRIX_POSITION;
vec3 axis;
// Identify mat.
glm_mat4_identity(MATRIX_POSITION);
// Position
axis[0] = x, axis[1] = y, axis[2] = z;
glm_translate(MATRIX_POSITION, axis);
// Rotation
axis[0] = 1, axis[1] = 0, axis[2] = 0;
glm_rotate(MATRIX_POSITION, pitch, axis);
axis[0] = 0, axis[1] = 1;
glm_rotate(MATRIX_POSITION, yaw, axis);
axis[1] = 0, axis[2] = 1;
glm_rotate(MATRIX_POSITION, roll, axis);
// Scale
axis[0] = scaleX, axis[1] = scaleY, axis[2] = scaleZ;
glm_scale(MATRIX_POSITION, axis);
glUniformMatrix4fv(shader->uniModl, 1, GL_FALSE, MATRIX_POSITION[0]);
}

View File

@ -61,4 +61,26 @@ void shaderUseTexture(shader_t *shader, texture_t *texture);
void shaderUsePosition(shader_t *shader,
float x, float y, float z,
float pitch, float yaw, float roll
);
/**
* Set's the current translation matrix onto the shader for the next
* render to use. Also provides scaling controls.
*
* @param shader Shader to attach to.
* @param x X coordinate (world space).
* @param y Y coordinate (world space).
* @param z Z coordinate (world space).
* @param pitch Pitch of the object (local space).
* @param yaw Yaw of the object (local space).
* @param roll Roll of the object (local space).
* @param scaleX X scale of model (1 being 100% scaled).
* @param scaleY Y scale of model (1 being 100% scaled).
* @param scaleZ Z scale of model (1 being 100% scaled).
*/
void shaderUsePositionAndScale(shader_t *shader,
float x, float y, float z,
float pitch, float yaw, float roll,
float scaleX, float scaleY, float scaleZ
);

View File

@ -44,7 +44,6 @@ bool gameUpdate(float platformDelta) {
void gameDispose() {
shaderDispose(GAME_STATE.shaderWorld);
worldDispose();
inputDispose();
renderDispose();
}

View File

@ -38,15 +38,25 @@ int32_t main() {
// Init the game
if(gameInit()) {
// Bind initial keys
inputBind(INPUT_NULL, (inputsource_t)GLFW_KEY_ESCAPE);
inputBind(INPUT_UP, (inputsource_t)GLFW_KEY_UP);
inputBind(INPUT_DOWN, (inputsource_t)GLFW_KEY_DOWN);
inputBind(INPUT_LEFT, (inputsource_t)GLFW_KEY_LEFT);
inputBind(INPUT_RIGHT, (inputsource_t)GLFW_KEY_RIGHT);
inputBind(INPUT_UP, (inputsource_t)GLFW_KEY_W);
inputBind(INPUT_DOWN, (inputsource_t)GLFW_KEY_S);
inputBind(INPUT_LEFT, (inputsource_t)GLFW_KEY_A);
inputBind(INPUT_RIGHT, (inputsource_t)GLFW_KEY_D);
inputBind(INPUT_NULL, (inputsource_t)GLFW_KEY_ESCAPE);
inputBind(INPUT_DEBUG_UP, (inputsource_t)GLFW_KEY_W);
inputBind(INPUT_DEBUG_DOWN, (inputsource_t)GLFW_KEY_S);
inputBind(INPUT_DEBUG_LEFT, (inputsource_t)GLFW_KEY_A);
inputBind(INPUT_DEBUG_RIGHT, (inputsource_t)GLFW_KEY_D);
inputBind(INPUT_DEBUG_RAISE, (inputsource_t)GLFW_KEY_Q);
inputBind(INPUT_DEBUG_LOWER, (inputsource_t)GLFW_KEY_E);
inputBind(INPUT_DEBUG_FINE, (inputsource_t)GLFW_KEY_LEFT_CONTROL);
inputBind(INPUT_DEBUG_PLUS, (inputsource_t)GLFW_KEY_EQUAL);
inputBind(INPUT_DEBUG_MINUS, (inputsource_t)GLFW_KEY_MINUS);
inputBind(INPUT_UP, (inputsource_t)GLFW_KEY_UP);
inputBind(INPUT_DOWN, (inputsource_t)GLFW_KEY_DOWN);
inputBind(INPUT_LEFT, (inputsource_t)GLFW_KEY_LEFT);
inputBind(INPUT_RIGHT, (inputsource_t)GLFW_KEY_RIGHT);
inputBind(INPUT_UP, (inputsource_t)GLFW_KEY_W);
inputBind(INPUT_DOWN, (inputsource_t)GLFW_KEY_S);
inputBind(INPUT_LEFT, (inputsource_t)GLFW_KEY_A);
inputBind(INPUT_RIGHT, (inputsource_t)GLFW_KEY_D);
// Init the render resolution
renderSetResolution(WINDOW_WIDTH_DEFAULT, WINDOW_HEIGHT_DEFAULT);

143
tools/model/obj_to_c.js Normal file
View File

@ -0,0 +1,143 @@
// Copyright (c) 2021 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
const fs = require('fs');
const path = require('path');
const MODEL_NAME = 'Poker Table';
const FLIP_TEXTURE_Y = true;
let rawVertices = [];
let faces = [];
let coordinates = [];
const filePath = path.join(__dirname, 'model.obj');
const data = fs.readFileSync(filePath, 'utf-8');
const scale = 0.1;
data.split('\n').forEach(line => {
const bits = line.trim().split(' ');
if(!bits.length || bits.every(n => !n || !bits.length)) return;
const lineType = bits.shift();
if(lineType === 'v') {
const [ x, y, z ] = bits.map(n => {
const val = parseFloat(n) * scale;
return val;
});
rawVertices.push({ x, y, z });
} else if(lineType === 'vt') {
let [ u, v ] = bits.map(n => parseFloat(n));
if(FLIP_TEXTURE_Y) v = 1 - v;
coordinates.push({ u, v });
} else if(lineType === 'f') {
faces.push(bits.map(n => {
const [ vertice, coordinate ] = n.split('/').map(n => parseInt(n));
return { vertice, coordinate };
}));
}
});
const verticeCompare = (vl, vr) => (
vl.x === vr.x &&
vl.y === vr.y &&
vl.z === vr.z &&
vl.u === vr.u &&
vl.v === vr.v
);
const indices = [];
const vertices = [];
faces.forEach(face => {
face.forEach(faceIndice => {
const rawVert = rawVertices[faceIndice.vertice-1];
const rawCoord = coordinates[faceIndice.coordinate-1];
const vertice = { ...rawVert, ...rawCoord };
const indice = vertices.findIndex(vert => {
return verticeCompare(vert, vertice);
});
if(indice === -1) {
indices.push(vertices.length);
vertices.push(vertice);
} else {
indices.push(indice);
}
})
})
const MODEL_NAME_CAPS = MODEL_NAME.replace(/\s/g, '_').toUpperCase();
const MODEL_NAME_CAMEL = [
MODEL_NAME[0].toLowerCase(),
MODEL_NAME.split(' ').join('').substr(1)
].join('')
// const fn = MODEL_NAME.toLowerCase().split(' ').join('');
const fn = 'model';
const license = `/**
* Copyright (c) ${new Date().getFullYear()} Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
`;
// Write header file
const header = `${license}
#pragma once
#include <dawn/dawn.h>
#include "../primitive.h"
#define ${MODEL_NAME_CAPS}_NAME "${MODEL_NAME}"
#define ${MODEL_NAME_CAPS}_VERTICE_COUNT ${vertices.length}
#define ${MODEL_NAME_CAPS}_INDICE_COUNT ${indices.length}
#define ${MODEL_NAME_CAPS}_TRIANGLE_COUNT ${indices.length/3}
/**
* Generated Model ${MODEL_NAME}
* Generated at ${new Date().toUTCString()}
* @returns ${MODEL_NAME} as a primitive.
*/
primitive_t * ${MODEL_NAME_CAMEL}Create();
`;
// Write Source file
const strVertices = vertices.map((v,i) => {
return `{ .x = ${v.x}, .y = ${v.y}, .z = ${v.z}, .u = ${v.u}, .v = ${v.v} }`;
}).join(',\n ');
const strIndices = indices.map(i => {
return `${i}`;
}).join(',\n ');
const source = `${license}
#include "${fn}.h"
primitive_t * ${MODEL_NAME_CAMEL}Create() {
vertice_t vertices[${MODEL_NAME_CAPS}_VERTICE_COUNT] = {
${strVertices}
};
indice_t indices[${MODEL_NAME_CAPS}_INDICE_COUNT] = {
${strIndices}
};
primitive_t *primitive = primitiveCreate(
${MODEL_NAME_CAPS}_VERTICE_COUNT,
${MODEL_NAME_CAPS}_INDICE_COUNT
);
primitiveBufferVertices(primitive, 0, ${MODEL_NAME_CAPS}_VERTICE_COUNT, vertices);
primitiveBufferIndices(primitive, 0, ${MODEL_NAME_CAPS}_INDICE_COUNT, indices);
return primitive;
}
`;
fs.writeFileSync(path.join(__dirname, fn+'.h'), header);
fs.writeFileSync(path.join(__dirname, fn+'.c'), source);