demo3d.h 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  1. /**
  2. Simple 3D model viewer demo for SAF, using small3dlib.
  3. by drummyfish, released under CC0 1.0, public domain
  4. */
  5. #define SAF_PROGRAM_NAME "demo3d"
  6. #include "../saf.h"
  7. #define S3L_PIXEL_FUNCTION pixelFunc
  8. #define S3L_RESOLUTION_X SAF_SCREEN_WIDTH
  9. #define S3L_RESOLUTION_Y SAF_SCREEN_HEIGHT
  10. #define S3L_Z_BUFFER 2
  11. #define S3L_SORT 0
  12. #define S3L_STENCIL_BUFFER 0
  13. #define S3L_PERSPECTIVE_CORRECTION 0
  14. #include "small3dlib.h"
  15. #define HOUSE_VERTEX_COUNT 127
  16. const S3L_Unit houseVertices[HOUSE_VERTEX_COUNT * 3] = {
  17. 1809, 657, -687, // 0
  18. 1635, -291, -914, // 3
  19. 1635, -309, -632, // 6
  20. 1473, 657, -1113, // 9
  21. 1809, 657, -1113, // 12
  22. 2070, 661, -1396, // 15
  23. 1659, 657, -687, // 18
  24. 1659, 657, 1039, // 21
  25. 1563, 142, -217, // 24
  26. 1563, 138, 582, // 27
  27. 1489, -270, -632, // 30
  28. 188, 733, -1473, // 33
  29. 1354, -245, -914, // 36
  30. 1473, 657, -910, // 39
  31. 1354, -206, -729, // 42
  32. 1240, 2205, 176, // 45
  33. 68, 2107, 176, // 48
  34. 1530, -1123, -636, // 51
  35. 1313, -1123, -765, // 54
  36. 1313, -1123, -1005, // 57
  37. 1644, -1123, -1005, // 60
  38. 1644, -1123, -636, // 63
  39. 602, -251, -728, // 66
  40. 637, 374, -882, // 69
  41. 539, -1118, -936, // 72
  42. 637, 372, -1124, // 75
  43. 539, -1123, -768, // 78
  44. 464, 190, -1109, // 81
  45. 372, -1119, -948, // 84
  46. 464, 192, -845, // 87
  47. 372, -1123, -748, // 90
  48. 1312, 142, -217, // 93
  49. 1489, -248, -204, // 96
  50. 1312, -534, -171, // 99
  51. 1312, -533, 521, // 102
  52. 1312, 138, 582, // 105
  53. 1508, -534, -171, // 108
  54. 1508, -533, 521, // 111
  55. 1530, -1123, 988, // 114
  56. -1672, 657, -687, // 117
  57. -1498, -315, -914, // 120
  58. -1672, 657, -1113, // 123
  59. -1336, 657, -1113, // 126
  60. -1909, 681, -1429, // 129
  61. -1352, -251, -632, // 132
  62. -1498, -315, -632, // 135
  63. -1426, 146, 494, // 138
  64. -1323, -347, 999, // 141
  65. -1352, -247, 503, // 144
  66. -1221, -305, -914, // 147
  67. -1336, 657, -910, // 150
  68. -2446, 2327, 278, // 153
  69. -1872, 681, 1713, // 156
  70. -1393, -1123, -636, // 159
  71. -1176, -1123, -765, // 162
  72. -1221, -284, -729, // 165
  73. -1176, -1123, -961, // 168
  74. -1527, -1123, -636, // 171
  75. -443, -251, -728, // 174
  76. -477, 343, -882, // 177
  77. -402, -1118, -936, // 180
  78. -402, -1123, -768, // 183
  79. -304, 160, -1109, // 186
  80. -477, 341, -1124, // 189
  81. -235, -1119, -948, // 192
  82. -304, 162, -845, // 195
  83. -1672, 657, 1039, // 198
  84. -1175, 146, -142, // 201
  85. -1175, -645, -145, // 204
  86. -1352, -247, -151, // 207
  87. -1426, 146, -142, // 210
  88. -1371, -645, -145, // 213
  89. -1523, 657, 1039, // 216
  90. 1809, 657, 1039, // 219
  91. 1635, -251, 1266, // 222
  92. 1809, 628, 1466, // 225
  93. 2450, 2567, 227, // 228
  94. -1336, 657, 1262, // 231
  95. 247, 714, 1527, // 234
  96. 1473, 657, 1262, // 237
  97. 1473, 657, 1466, // 240
  98. 2042, 591, 1653, // 243
  99. 1635, -219, 984, // 246
  100. 1373, -213, 1266, // 249
  101. -1103, 2205, 176, // 252
  102. -1286, 1892, -143, // 255
  103. 1489, -219, 984, // 258
  104. 1313, -1123, 1117, // 261
  105. 1373, -213, 1081, // 264
  106. 1313, -1123, 1313, // 267
  107. 1644, -1123, 988, // 270
  108. 1489, -248, 555, // 273
  109. -1468, -347, 1266, // 276
  110. -1468, -347, 999, // 279
  111. -1336, 657, 1466, // 282
  112. -1672, 657, 1466, // 285
  113. -1175, 146, 494, // 288
  114. -1523, 657, -687, // 291
  115. -1222, -347, 1266, // 294
  116. -1222, -347, 1081, // 297
  117. -1393, -1123, 988, // 300
  118. -1176, -1123, 1117, // 303
  119. -1176, -1123, 1313, // 306
  120. -1507, -1123, 1313, // 309
  121. -1507, -1123, 988, // 312
  122. -1371, -645, 497, // 315
  123. -1175, -645, 497, // 318
  124. -235, -1123, -748, // 321
  125. -1442, 2357, -538, // 324
  126. -1405, 1712, -323, // 327
  127. -1589, 1878, -170, // 330
  128. -1257, 2383, -200, // 333
  129. -1712, 2416, -224, // 336
  130. -1527, -1123, -961, // 339
  131. 1644, -1123, 1313, // 342
  132. -1636, 657, -930, // 345
  133. -1636, 657, -930, // 348
  134. -1672, 657, 1466, // 351
  135. 1773, 657, -930, // 354
  136. 1773, 657, -930, // 357
  137. 1809, 657, 1466, // 360
  138. -1636, 657, 1282, // 363
  139. -1636, 657, 1282, // 366
  140. -1672, 657, -1113, // 369
  141. 1773, 657, 1282, // 372
  142. 1773, 657, 1282, // 375
  143. 1809, 657, -1113 // 378
  144. }; // houseVertices
  145. #define HOUSE_TRIANGLE_COUNT 200
  146. const S3L_Index houseTriangleIndices[HOUSE_TRIANGLE_COUNT * 3] = {
  147. 0, 1, 2, // 0
  148. 3, 1, 4, // 3
  149. 3, 4, 5, // 6
  150. 0, 5, 4, // 9
  151. 2, 6, 0, // 12
  152. 7, 8, 9, // 15
  153. 6, 10, 8, // 18
  154. 11, 3, 5, // 21
  155. 12, 13, 14, // 24
  156. 15, 16, 11, // 27
  157. 2, 17, 10, // 30
  158. 12, 18, 19, // 33
  159. 1, 19, 20, // 36
  160. 1, 21, 2, // 39
  161. 22, 18, 14, // 42
  162. 23, 14, 13, // 45
  163. 24, 23, 25, // 48
  164. 26, 22, 23, // 51
  165. 24, 27, 28, // 54
  166. 28, 29, 30, // 57
  167. 31, 32, 33, // 60
  168. 32, 31, 8, // 63
  169. 31, 34, 35, // 66
  170. 36, 33, 32, // 69
  171. 37, 17, 38, // 72
  172. 17, 36, 10, // 75
  173. 39, 40, 41, // 78
  174. 40, 42, 41, // 81
  175. 42, 43, 41, // 84
  176. 39, 41, 43, // 87
  177. 39, 44, 45, // 90
  178. 46, 47, 48, // 93
  179. 11, 43, 42, // 96
  180. 49, 50, 42, // 99
  181. 51, 52, 43, // 102
  182. 53, 45, 44, // 105
  183. 49, 54, 55, // 108
  184. 40, 56, 49, // 111
  185. 57, 40, 45, // 114
  186. 54, 58, 55, // 117
  187. 55, 59, 50, // 120
  188. 60, 59, 61, // 123
  189. 61, 59, 58, // 126
  190. 60, 62, 63, // 129
  191. 64, 65, 62, // 132
  192. 43, 66, 39, // 135
  193. 67, 68, 69, // 138
  194. 69, 70, 67, // 141
  195. 71, 69, 68, // 144
  196. 72, 47, 46, // 147
  197. 73, 74, 75, // 150
  198. 15, 5, 76, // 153
  199. 77, 78, 79, // 156
  200. 74, 80, 75, // 159
  201. 80, 81, 75, // 162
  202. 73, 75, 81, // 165
  203. 7, 82, 73, // 168
  204. 0, 7, 73, // 171
  205. 10, 32, 8, // 174
  206. 78, 81, 80, // 177
  207. 83, 79, 80, // 180
  208. 16, 84, 85, // 183
  209. 15, 78, 16, // 186
  210. 38, 82, 86, // 189
  211. 83, 87, 88, // 192
  212. 74, 89, 83, // 195
  213. 90, 74, 82, // 198
  214. 35, 34, 91, // 201
  215. 91, 9, 35, // 204
  216. 8, 35, 9, // 207
  217. 37, 91, 34, // 210
  218. 33, 37, 34, // 213
  219. 10, 36, 32, // 216
  220. 66, 92, 93, // 219
  221. 84, 52, 51, // 222
  222. 94, 78, 77, // 225
  223. 94, 92, 95, // 228
  224. 94, 95, 52, // 231
  225. 66, 52, 95, // 234
  226. 93, 72, 66, // 237
  227. 96, 68, 67, // 240
  228. 97, 70, 44, // 243
  229. 78, 94, 52, // 246
  230. 98, 77, 99, // 249
  231. 15, 81, 78, // 252
  232. 84, 16, 78, // 255
  233. 70, 72, 46, // 258
  234. 93, 100, 47, // 261
  235. 98, 101, 102, // 264
  236. 98, 103, 92, // 267
  237. 92, 104, 93, // 270
  238. 99, 87, 101, // 273
  239. 77, 88, 99, // 276
  240. 105, 53, 71, // 279
  241. 96, 48, 106, // 282
  242. 48, 96, 46, // 285
  243. 106, 71, 68, // 288
  244. 105, 106, 48, // 291
  245. 46, 67, 70, // 294
  246. 70, 69, 44, // 297
  247. 66, 97, 39, // 300
  248. 81, 0, 73, // 303
  249. 76, 5, 81, // 306
  250. 30, 65, 107, // 309
  251. 27, 65, 29, // 312
  252. 27, 63, 62, // 315
  253. 59, 25, 23, // 318
  254. 23, 50, 59, // 321
  255. 11, 50, 13, // 324
  256. 3, 11, 13, // 327
  257. 11, 42, 50, // 330
  258. 7, 9, 86, // 333
  259. 86, 9, 91, // 336
  260. 86, 91, 37, // 339
  261. 38, 86, 37, // 342
  262. 105, 48, 47, // 345
  263. 47, 100, 105, // 348
  264. 71, 44, 69, // 351
  265. 44, 71, 53, // 354
  266. 85, 108, 109, // 357
  267. 108, 110, 109, // 360
  268. 110, 111, 85, // 363
  269. 112, 108, 111, // 366
  270. 43, 110, 51, // 369
  271. 109, 110, 43, // 372
  272. 11, 16, 85, // 375
  273. 109, 11, 85, // 378
  274. 109, 43, 11, // 381
  275. 85, 84, 110, // 384
  276. 84, 51, 110, // 387
  277. 78, 80, 79, // 390
  278. 0, 4, 1, // 393
  279. 3, 12, 1, // 396
  280. 2, 10, 6, // 399
  281. 7, 6, 8, // 402
  282. 12, 3, 13, // 405
  283. 2, 21, 17, // 408
  284. 12, 14, 18, // 411
  285. 1, 12, 19, // 414
  286. 1, 20, 21, // 417
  287. 22, 26, 18, // 420
  288. 23, 22, 14, // 423
  289. 24, 26, 23, // 426
  290. 24, 25, 27, // 429
  291. 28, 27, 29, // 432
  292. 31, 33, 34, // 435
  293. 37, 36, 17, // 438
  294. 39, 45, 40, // 441
  295. 40, 49, 42, // 444
  296. 39, 97, 44, // 447
  297. 49, 55, 50, // 450
  298. 53, 57, 45, // 453
  299. 49, 56, 54, // 456
  300. 40, 113, 56, // 459
  301. 57, 113, 40, // 462
  302. 54, 61, 58, // 465
  303. 55, 58, 59, // 468
  304. 60, 63, 59, // 471
  305. 60, 64, 62, // 474
  306. 64, 107, 65, // 477
  307. 43, 52, 66, // 480
  308. 73, 82, 74, // 483
  309. 15, 11, 5, // 486
  310. 74, 83, 80, // 489
  311. 7, 86, 82, // 492
  312. 0, 6, 7, // 495
  313. 83, 88, 79, // 498
  314. 38, 90, 82, // 501
  315. 83, 89, 87, // 504
  316. 74, 114, 89, // 507
  317. 90, 114, 74, // 510
  318. 8, 31, 35, // 513
  319. 33, 36, 37, // 516
  320. 66, 95, 92, // 519
  321. 84, 78, 52, // 522
  322. 94, 98, 92, // 525
  323. 93, 47, 72, // 528
  324. 96, 106, 68, // 531
  325. 98, 94, 77, // 534
  326. 15, 76, 81, // 537
  327. 70, 97, 72, // 540
  328. 93, 104, 100, // 543
  329. 98, 99, 101, // 546
  330. 98, 102, 103, // 549
  331. 92, 103, 104, // 552
  332. 99, 88, 87, // 555
  333. 77, 79, 88, // 558
  334. 105, 100, 53, // 561
  335. 106, 105, 71, // 564
  336. 46, 96, 67, // 567
  337. 66, 72, 97, // 570
  338. 81, 5, 0, // 573
  339. 30, 29, 65, // 576
  340. 27, 62, 65, // 579
  341. 27, 25, 63, // 582
  342. 59, 63, 25, // 585
  343. 23, 13, 50, // 588
  344. 85, 111, 108, // 591
  345. 108, 112, 110, // 594
  346. 110, 112, 111 // 597
  347. }; // houseTriangleIndices
  348. #define HOUSE_UV_COUNT 173
  349. const S3L_Unit houseUVs[HOUSE_UV_COUNT * 2] = {
  350. 279, 174, // 0
  351. 166, 140, // 2
  352. 166, 174, // 4
  353. 279, 106, // 6
  354. 279, 140, // 8
  355. 281, 238, // 10
  356. 307, 238, // 12
  357. 327, 260, // 14
  358. 307, 206, // 16
  359. 279, 204, // 18
  360. 484, 15, // 20
  361. 393, 53, // 22
  362. 447, 53, // 24
  363. 355, 15, // 26
  364. 360, 83, // 28
  365. 183, 266, // 30
  366. 166, 106, // 32
  367. 279, 74, // 34
  368. 166, 74, // 36
  369. 263, 397, // 38
  370. 203, 397, // 40
  371. 203, 505, // 42
  372. 68, 204, // 44
  373. 166, 204, // 46
  374. 68, 74, // 48
  375. 68, 106, // 50
  376. 68, 140, // 52
  377. 68, 174, // 54
  378. 454, 338, // 56
  379. 494, 392, // 58
  380. 496, 335, // 60
  381. 451, 298, // 62
  382. 504, 280, // 64
  383. 440, 382, // 66
  384. 445, 304, // 68
  385. 445, 392, // 70
  386. 436, 314, // 72
  387. 431, 382, // 74
  388. 432, 318, // 76
  389. 428, 373, // 78
  390. 399, 58, // 80
  391. 392, 82, // 82
  392. 401, 102, // 84
  393. 439, 102, // 86
  394. 441, 58, // 88
  395. 395, 107, // 90
  396. 444, 107, // 92
  397. 359, 147, // 94
  398. 480, 147, // 96
  399. 279, 106, // 98
  400. 166, 140, // 100
  401. 279, 140, // 102
  402. 279, 174, // 104
  403. 66, 238, // 106
  404. 22, 263, // 108
  405. 41, 238, // 110
  406. 41, 206, // 112
  407. 166, 74, // 114
  408. 166, 106, // 116
  409. 447, 53, // 118
  410. 480, 85, // 120
  411. 448, 82, // 122
  412. 166, 174, // 124
  413. 279, 204, // 126
  414. 86, 397, // 128
  415. 0, 449, // 130
  416. 86, 505, // 132
  417. 68, 74, // 134
  418. 68, 204, // 136
  419. 166, 204, // 138
  420. 68, 174, // 140
  421. 68, 106, // 142
  422. 337, 392, // 144
  423. 378, 338, // 146
  424. 334, 340, // 148
  425. 381, 300, // 150
  426. 327, 280, // 152
  427. 391, 382, // 154
  428. 385, 392, // 156
  429. 396, 315, // 158
  430. 387, 306, // 160
  431. 399, 382, // 162
  432. 400, 319, // 164
  433. 41, 74, // 166
  434. 399, 58, // 168
  435. 401, 102, // 170
  436. 392, 82, // 172
  437. 393, 53, // 174
  438. 395, 107, // 176
  439. 484, 15, // 178
  440. 279, 106, // 180
  441. 166, 140, // 182
  442. 279, 140, // 184
  443. 314, 505, // 186
  444. 314, 397, // 188
  445. 66, 57, // 190
  446. 187, 36, // 192
  447. 281, 57, // 194
  448. 279, 174, // 196
  449. 281, 41, // 198
  450. 325, 27, // 200
  451. 307, 41, // 202
  452. 307, 74, // 204
  453. 279, 74, // 206
  454. 166, 106, // 208
  455. 295, 74, // 210
  456. 166, 174, // 212
  457. 279, 204, // 214
  458. 144, 397, // 216
  459. 136, 420, // 218
  460. 203, 291, // 220
  461. 68, 74, // 222
  462. 166, 74, // 224
  463. 68, 204, // 226
  464. 166, 204, // 228
  465. 68, 174, // 230
  466. 68, 106, // 232
  467. 448, 82, // 234
  468. 279, 174, // 236
  469. 166, 140, // 238
  470. 166, 174, // 240
  471. 86, 291, // 242
  472. 66, 41, // 244
  473. 279, 106, // 246
  474. 279, 140, // 248
  475. 41, 41, // 250
  476. 25, 22, // 252
  477. 279, 204, // 254
  478. 441, 58, // 256
  479. 355, 15, // 258
  480. 360, 83, // 260
  481. 166, 106, // 262
  482. 279, 74, // 264
  483. 166, 74, // 266
  484. 314, 291, // 268
  485. 68, 204, // 270
  486. 166, 204, // 272
  487. 68, 74, // 274
  488. 68, 106, // 276
  489. 68, 140, // 278
  490. 68, 174, // 280
  491. 495, 218, // 282
  492. 345, 264, // 284
  493. 492, 264, // 286
  494. 502, 158, // 288
  495. 342, 210, // 290
  496. 444, 107, // 292
  497. 359, 147, // 294
  498. 439, 102, // 296
  499. 52, 206, // 298
  500. 402, 449, // 300
  501. 403, 373, // 302
  502. 66, 223, // 304
  503. 281, 223, // 306
  504. 480, 85, // 308
  505. 480, 147, // 310
  506. 492, 407, // 312
  507. 425, 437, // 314
  508. 492, 437, // 316
  509. 492, 467, // 318
  510. 425, 500, // 320
  511. 492, 500, // 322
  512. 425, 467, // 324
  513. 398, 484, // 326
  514. 121, 423, // 328
  515. 131, 433, // 330
  516. 279, 74, // 332
  517. 68, 140, // 334
  518. 295, 206, // 336
  519. 68, 140, // 338
  520. 336, 158, // 340
  521. 52, 74, // 342
  522. 425, 407 // 344
  523. }; // houseUVs
  524. #define HOUSE_UV_INDEX_COUNT 200
  525. const S3L_Index houseUVIndices[HOUSE_UV_INDEX_COUNT * 3] = {
  526. 0, 1, 2, // 0
  527. 3, 1, 4, // 3
  528. 5, 6, 7, // 6
  529. 8, 7, 6, // 9
  530. 2, 9, 0, // 12
  531. 10, 11, 12, // 15
  532. 13, 14, 11, // 18
  533. 15, 5, 7, // 21
  534. 16, 17, 18, // 24
  535. 19, 20, 21, // 27
  536. 2, 22, 23, // 30
  537. 16, 24, 25, // 33
  538. 1, 25, 26, // 36
  539. 1, 27, 2, // 39
  540. 28, 29, 30, // 42
  541. 31, 30, 32, // 45
  542. 33, 31, 34, // 48
  543. 35, 28, 31, // 51
  544. 33, 36, 37, // 54
  545. 37, 38, 39, // 57
  546. 40, 41, 42, // 60
  547. 41, 40, 11, // 63
  548. 40, 43, 44, // 66
  549. 45, 42, 41, // 69
  550. 46, 47, 48, // 72
  551. 47, 45, 14, // 75
  552. 49, 50, 51, // 78
  553. 50, 52, 51, // 81
  554. 53, 54, 55, // 84
  555. 56, 55, 54, // 87
  556. 49, 57, 58, // 90
  557. 59, 60, 61, // 93
  558. 15, 54, 53, // 96
  559. 62, 63, 52, // 99
  560. 64, 65, 66, // 102
  561. 67, 58, 57, // 105
  562. 62, 68, 69, // 108
  563. 50, 70, 62, // 111
  564. 71, 50, 58, // 114
  565. 72, 73, 74, // 117
  566. 74, 75, 76, // 120
  567. 77, 75, 78, // 123
  568. 78, 75, 73, // 126
  569. 77, 79, 80, // 129
  570. 81, 82, 79, // 132
  571. 54, 83, 56, // 135
  572. 84, 85, 86, // 138
  573. 86, 87, 84, // 141
  574. 88, 86, 85, // 144
  575. 89, 60, 59, // 147
  576. 90, 91, 92, // 150
  577. 19, 93, 94, // 153
  578. 95, 96, 97, // 156
  579. 91, 98, 92, // 159
  580. 99, 100, 101, // 162
  581. 102, 101, 100, // 165
  582. 103, 104, 90, // 168
  583. 8, 105, 102, // 171
  584. 14, 41, 11, // 174
  585. 96, 100, 99, // 177
  586. 106, 107, 98, // 180
  587. 20, 108, 109, // 183
  588. 19, 110, 20, // 186
  589. 111, 104, 112, // 189
  590. 106, 113, 114, // 192
  591. 91, 115, 106, // 195
  592. 116, 91, 104, // 198
  593. 44, 43, 117, // 201
  594. 117, 12, 44, // 204
  595. 11, 44, 12, // 207
  596. 46, 117, 43, // 210
  597. 42, 46, 43, // 213
  598. 14, 45, 41, // 216
  599. 118, 119, 120, // 219
  600. 108, 121, 64, // 222
  601. 122, 96, 95, // 225
  602. 123, 119, 124, // 228
  603. 122, 125, 126, // 231
  604. 83, 126, 125, // 234
  605. 120, 127, 118, // 237
  606. 128, 85, 84, // 240
  607. 129, 87, 130, // 243
  608. 96, 122, 126, // 246
  609. 131, 132, 133, // 249
  610. 19, 134, 110, // 252
  611. 108, 20, 110, // 255
  612. 87, 89, 59, // 258
  613. 120, 135, 136, // 261
  614. 131, 137, 138, // 264
  615. 131, 139, 119, // 267
  616. 119, 140, 120, // 270
  617. 141, 142, 143, // 273
  618. 144, 145, 141, // 276
  619. 146, 147, 88, // 279
  620. 128, 61, 148, // 282
  621. 61, 128, 59, // 285
  622. 148, 88, 85, // 288
  623. 146, 148, 61, // 291
  624. 59, 84, 87, // 294
  625. 87, 86, 130, // 297
  626. 83, 149, 56, // 300
  627. 100, 8, 102, // 303
  628. 94, 93, 150, // 306
  629. 39, 82, 151, // 309
  630. 36, 82, 38, // 312
  631. 36, 80, 79, // 315
  632. 75, 34, 31, // 318
  633. 31, 76, 75, // 321
  634. 15, 152, 153, // 324
  635. 5, 15, 153, // 327
  636. 15, 53, 152, // 330
  637. 10, 12, 154, // 333
  638. 154, 12, 117, // 336
  639. 154, 117, 46, // 339
  640. 48, 154, 46, // 342
  641. 146, 61, 60, // 345
  642. 60, 155, 146, // 348
  643. 88, 130, 86, // 351
  644. 130, 88, 147, // 354
  645. 156, 157, 158, // 357
  646. 157, 159, 158, // 360
  647. 159, 160, 161, // 363
  648. 162, 163, 160, // 366
  649. 66, 164, 64, // 369
  650. 165, 164, 66, // 372
  651. 21, 20, 109, // 375
  652. 165, 21, 109, // 378
  653. 165, 66, 21, // 381
  654. 109, 108, 164, // 384
  655. 108, 64, 164, // 387
  656. 96, 99, 97, // 390
  657. 0, 4, 1, // 393
  658. 3, 16, 1, // 396
  659. 2, 23, 9, // 399
  660. 10, 13, 11, // 402
  661. 16, 3, 17, // 405
  662. 2, 27, 22, // 408
  663. 16, 18, 24, // 411
  664. 1, 16, 25, // 414
  665. 1, 26, 27, // 417
  666. 28, 35, 29, // 420
  667. 31, 28, 30, // 423
  668. 33, 35, 31, // 426
  669. 33, 34, 36, // 429
  670. 37, 36, 38, // 432
  671. 40, 42, 43, // 435
  672. 46, 45, 47, // 438
  673. 49, 58, 50, // 441
  674. 50, 62, 52, // 444
  675. 49, 166, 57, // 447
  676. 62, 69, 63, // 450
  677. 67, 71, 58, // 453
  678. 62, 70, 68, // 456
  679. 50, 167, 70, // 459
  680. 71, 167, 50, // 462
  681. 72, 78, 73, // 465
  682. 74, 73, 75, // 468
  683. 77, 80, 75, // 471
  684. 77, 81, 79, // 474
  685. 81, 151, 82, // 477
  686. 54, 126, 83, // 480
  687. 90, 104, 91, // 483
  688. 19, 21, 93, // 486
  689. 91, 106, 98, // 489
  690. 103, 112, 104, // 492
  691. 8, 168, 105, // 495
  692. 106, 114, 107, // 498
  693. 111, 116, 104, // 501
  694. 106, 115, 113, // 504
  695. 91, 169, 115, // 507
  696. 116, 169, 91, // 510
  697. 11, 40, 44, // 513
  698. 42, 45, 46, // 516
  699. 118, 124, 119, // 519
  700. 108, 110, 121, // 522
  701. 123, 131, 119, // 525
  702. 120, 136, 127, // 528
  703. 128, 148, 85, // 531
  704. 131, 123, 132, // 534
  705. 19, 94, 134, // 537
  706. 87, 129, 89, // 540
  707. 120, 140, 135, // 543
  708. 131, 133, 137, // 546
  709. 131, 138, 139, // 549
  710. 119, 139, 140, // 552
  711. 141, 145, 142, // 555
  712. 144, 170, 145, // 558
  713. 146, 155, 147, // 561
  714. 148, 146, 88, // 564
  715. 59, 128, 84, // 567
  716. 83, 171, 149, // 570
  717. 100, 7, 8, // 573
  718. 39, 38, 82, // 576
  719. 36, 79, 82, // 579
  720. 36, 34, 80, // 582
  721. 75, 80, 34, // 585
  722. 31, 32, 76, // 588
  723. 156, 172, 157, // 591
  724. 157, 162, 159, // 594
  725. 159, 162, 160 // 597
  726. }; // houseUVIndices
  727. const uint8_t houseTexture[4096] = {
  728. 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
  729. 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
  730. 141,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
  731. 177,177,177,177,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
  732. 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
  733. 141,141,141,109,141,145,145,145,141,141,141,141,141,141,141,141,141,141,141,141,
  734. 141,141,141,141,141,145,145,145,141,141,141,105,105,105,72,73,109,73,105,109,
  735. 105,105,109,109,105,109,109,105,105,141,109,105,109,105,105,109,105,105,141,105,
  736. 105,109,105,105,109,109,105,105,145,177,145,141,105,105,141,105,109,105,105,105,
  737. 105,141,109,105,141,141,105,109,105,141,145,145,141,141,109,72,68,68,68,68,68,
  738. 68,68,72,68,68,68,72,72,73,73,73,73,109,105,105,109,105,105,105,105,73,105,72,
  739. 73,73,72,72,72,68,68,68,73,145,145,145,105,141,141,141,177,141,173,141,141,177,
  740. 177,141,177,177,141,141,109,145,145,177,141,141,109,68,68,68,72,72,68,72,105,68,
  741. 72,72,68,68,72,68,68,68,68,68,68,68,68,68,68,68,68,68,36,68,72,68,68,72,68,68,
  742. 72,68,73,141,177,145,109,145,177,141,145,141,177,141,177,178,177,177,182,177,
  743. 177,173,141,145,177,177,141,141,109,68,68,73,68,68,36,72,105,68,72,105,68,72,
  744. 105,72,68,105,72,68,105,72,68,104,72,68,104,105,68,72,105,68,72,72,72,72,72,72,
  745. 73,141,177,177,141,141,178,178,178,141,145,141,177,177,177,177,214,177,177,141,
  746. 141,177,177,177,141,141,73,72,68,72,105,73,36,68,72,68,68,72,68,68,72,68,68,72,
  747. 68,36,72,68,36,68,68,36,68,68,36,68,68,36,68,72,105,73,68,72,68,141,177,177,141,
  748. 141,182,178,177,105,109,109,105,109,109,109,182,177,145,141,141,177,177,177,141,
  749. 141,73,68,72,72,105,105,105,73,73,105,73,105,73,73,73,73,73,73,73,105,105,73,
  750. 105,105,105,105,105,105,105,105,105,105,73,105,109,105,68,104,68,141,177,177,
  751. 141,177,182,178,177,105,142,145,109,146,146,109,177,178,178,145,141,177,177,177,
  752. 141,141,105,68,68,73,109,141,145,145,145,145,145,145,145,145,145,145,145,145,
  753. 145,145,145,145,141,141,141,141,141,141,141,145,141,141,109,109,109,73,68,68,68,
  754. 141,177,177,141,177,182,182,177,109,182,186,145,182,182,141,177,178,178,177,145,
  755. 177,177,177,141,141,73,68,72,68,68,105,105,105,105,105,105,105,105,105,105,105,
  756. 105,105,105,105,105,105,105,105,105,105,73,105,105,105,73,73,68,68,73,72,68,72,
  757. 68,141,177,177,141,177,182,182,177,109,150,182,145,182,182,141,141,178,178,177,
  758. 141,177,177,177,141,141,105,72,105,72,68,105,68,73,105,105,105,105,105,105,105,
  759. 105,109,109,105,109,109,109,105,105,105,105,105,105,105,73,73,68,36,68,72,72,
  760. 105,105,68,141,177,177,141,145,182,182,141,141,146,146,146,182,146,141,141,178,
  761. 178,145,141,177,177,177,141,141,105,68,104,68,73,105,105,109,141,141,141,141,
  762. 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,109,109,105,105,
  763. 68,68,73,68,104,72,68,141,177,177,145,145,178,178,141,109,182,182,146,186,186,
  764. 141,109,177,182,145,141,177,177,177,141,141,73,68,72,68,68,105,105,109,109,141,
  765. 141,141,141,141,141,109,109,109,109,109,109,141,141,141,141,141,141,141,141,141,
  766. 109,105,68,68,73,68,104,72,68,141,177,177,145,141,177,178,177,105,182,182,146,
  767. 182,182,105,177,177,182,141,145,177,177,177,141,141,105,72,105,104,68,105,73,
  768. 105,105,105,109,141,141,109,109,105,105,105,105,105,105,109,141,109,109,109,105,
  769. 105,109,109,105,105,68,68,73,72,105,105,68,141,177,177,145,141,141,178,178,105,
  770. 141,141,141,141,109,73,177,177,182,141,145,177,177,177,141,141,73,68,104,68,72,
  771. 105,73,109,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
  772. 141,141,141,141,141,109,105,68,72,72,68,104,104,68,109,177,177,145,141,177,178,
  773. 178,141,141,141,141,145,145,141,177,177,182,141,141,177,177,177,141,141,73,68,
  774. 104,68,68,105,73,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
  775. 145,177,145,141,141,141,141,141,141,109,72,72,73,68,104,104,68,109,177,177,145,
  776. 141,178,178,177,141,145,141,141,141,141,109,177,177,182,141,141,177,177,177,141,
  777. 141,105,72,105,104,68,105,73,109,141,141,141,141,141,141,141,141,141,141,141,
  778. 141,141,141,141,141,141,141,141,141,141,141,109,105,68,72,73,72,105,105,68,109,
  779. 177,177,145,141,177,178,177,141,177,145,177,177,141,141,177,145,178,141,145,177,
  780. 177,177,141,141,73,68,104,72,68,105,72,105,109,109,109,105,109,109,109,109,105,
  781. 109,109,109,109,141,141,141,109,109,109,109,109,105,105,73,36,72,72,68,104,104,
  782. 68,141,177,177,145,141,177,177,177,141,178,145,177,177,141,141,177,141,177,141,
  783. 145,177,177,177,141,141,73,68,104,72,68,105,73,109,109,109,109,109,109,109,109,
  784. 109,141,141,141,141,141,141,141,141,141,141,141,141,141,141,109,105,68,72,73,68,
  785. 104,105,68,141,177,177,145,141,145,178,178,141,177,145,177,177,177,141,177,177,
  786. 177,145,145,177,177,177,141,141,73,72,105,104,68,105,73,141,141,141,141,141,141,
  787. 141,141,141,141,145,145,177,145,141,145,177,177,145,141,141,141,141,141,105,68,
  788. 72,73,72,105,105,72,109,141,141,141,109,109,141,141,109,109,109,109,109,141,109,
  789. 109,141,141,109,109,109,109,141,141,141,72,68,104,72,68,105,72,141,141,141,141,
  790. 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,109,
  791. 105,72,72,72,68,104,104,68,105,105,145,141,141,141,141,109,109,105,109,141,105,
  792. 141,141,141,141,141,105,105,105,105,141,141,141,105,68,104,68,73,105,72,109,109,
  793. 109,109,109,109,109,109,141,141,141,141,109,109,109,109,109,109,105,105,109,109,
  794. 105,105,105,72,72,105,68,104,104,72,109,141,178,178,141,177,145,141,141,109,141,
  795. 177,141,141,141,141,177,141,109,141,141,105,141,141,141,105,72,105,72,68,105,
  796. 105,109,109,109,141,109,109,109,109,141,141,141,141,141,109,109,109,109,109,109,
  797. 109,109,109,109,109,105,68,72,73,68,105,105,68,141,141,178,178,177,177,177,177,
  798. 177,145,178,182,145,177,177,141,141,141,141,145,141,141,145,141,141,73,68,105,
  799. 72,68,105,105,109,141,141,141,141,141,141,141,141,141,141,141,141,109,109,105,
  800. 105,105,105,109,109,109,109,109,105,72,72,72,68,105,105,68,141,141,177,177,177,
  801. 182,177,177,182,177,177,178,141,177,182,141,177,177,141,177,141,141,177,141,141,
  802. 105,68,104,68,73,105,72,105,105,109,109,109,109,109,109,105,105,105,105,105,105,
  803. 73,73,73,73,105,105,105,105,105,73,72,36,72,105,68,72,104,68,141,141,141,141,
  804. 177,182,177,177,182,145,178,178,177,177,182,145,182,177,141,177,141,141,177,141,
  805. 141,73,72,72,68,72,109,109,109,109,109,109,109,109,109,141,141,109,109,105,109,
  806. 109,109,109,109,109,109,109,109,109,109,105,105,72,105,73,68,72,104,68,141,141,
  807. 141,145,177,182,177,178,214,182,214,214,178,182,214,177,182,178,141,177,141,141,
  808. 177,141,141,105,72,72,72,105,141,141,141,141,141,141,141,141,141,141,141,141,
  809. 141,141,141,141,145,145,145,141,141,145,145,145,141,141,141,109,109,105,72,72,
  810. 105,68,141,141,141,177,145,178,177,182,214,214,218,218,182,214,214,177,182,182,
  811. 141,145,141,145,177,141,141,105,68,68,73,109,109,105,105,105,105,73,73,73,73,73,
  812. 73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,72,73,105,73,68,72,68,141,
  813. 141,141,177,177,177,141,182,214,182,218,218,182,214,214,177,182,182,145,141,109,
  814. 177,177,141,141,73,72,72,68,105,72,68,68,72,68,68,72,68,68,72,72,68,72,72,68,72,
  815. 72,68,72,72,68,72,72,68,72,72,68,68,68,105,72,68,72,68,141,145,145,177,177,177,
  816. 141,182,182,182,218,218,178,214,214,177,182,182,177,178,141,177,177,141,141,73,
  817. 72,72,68,68,68,68,72,105,72,72,105,72,72,105,104,104,105,104,104,105,105,104,
  818. 105,105,104,104,105,104,104,105,72,72,68,72,72,72,105,68,141,177,141,177,141,
  819. 177,141,182,182,178,214,214,178,177,177,177,182,182,177,177,141,177,177,141,141,
  820. 73,68,72,68,72,72,72,104,105,72,104,105,104,104,105,104,104,105,104,104,105,105,
  821. 104,105,105,104,104,105,104,104,105,104,72,104,68,68,72,72,68,141,177,141,177,
  822. 141,141,141,182,178,178,214,214,177,182,177,177,182,177,145,177,141,177,177,141,
  823. 141,73,68,72,72,72,105,68,72,105,68,72,105,68,68,105,72,72,105,72,72,105,72,72,
  824. 104,104,72,72,105,72,72,104,68,72,104,72,72,72,68,68,141,177,141,177,141,177,
  825. 141,145,145,177,214,214,177,178,177,141,177,177,141,177,141,145,177,141,141,73,
  826. 68,68,68,68,68,36,68,68,36,36,68,36,36,68,68,68,68,68,68,68,68,68,68,68,36,68,
  827. 68,68,68,68,68,68,72,68,68,68,68,68,141,177,109,141,141,178,141,177,145,177,178,
  828. 178,177,177,177,141,177,177,141,145,109,145,177,141,141,109,109,109,109,109,109,
  829. 141,145,145,145,145,145,177,177,145,145,177,145,145,145,177,177,181,181,181,181,
  830. 181,181,181,181,145,181,177,177,145,145,141,109,141,177,177,177,177,145,177,141,
  831. 177,177,177,177,177,173,177,177,141,177,177,177,177,145,177,177,141,141,141,141,
  832. 141,141,141,145,177,177,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
  833. 181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,141,141,141,141,141,
  834. 141,141,141,141,141,141,141,141,141,141,141,141,141,145,141,141,145,141,141,141,
  835. 141,141,141,141,141,141,141,177,177,181,181,181,181,181,181,181,181,181,181,181,
  836. 181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,145,
  837. 141,105,105,105,105,105,105,105,105,105,105,73,105,105,105,109,105,141,141,141,
  838. 109,105,105,109,141,141,141,141,141,141,145,177,177,181,213,177,177,177,177,177,
  839. 177,177,177,177,173,177,177,177,177,177,209,177,209,209,177,177,173,173,177,177,
  840. 177,177,177,177,145,109,141,109,141,141,141,141,109,141,141,109,141,109,141,145,
  841. 109,109,109,177,145,141,141,141,141,141,141,141,141,141,145,177,177,181,181,173,
  842. 141,173,141,141,141,141,141,173,141,173,141,173,141,141,173,141,173,141,173,141,
  843. 141,141,173,141,173,141,141,177,145,109,141,141,177,141,177,105,105,109,109,109,
  844. 109,109,109,109,105,145,141,178,177,145,141,145,141,141,141,141,141,145,177,177,
  845. 177,181,177,141,141,141,137,137,137,137,137,141,141,141,141,141,137,137,141,141,
  846. 141,137,137,137,105,137,137,137,141,137,141,177,177,141,177,145,177,141,145,105,
  847. 109,141,141,141,141,141,141,109,105,177,141,178,177,141,141,145,141,141,141,141,
  848. 141,177,177,177,177,181,177,141,141,141,141,141,173,141,173,173,173,141,173,173,
  849. 173,141,173,173,173,173,141,141,141,141,141,141,141,141,141,213,177,141,177,141,
  850. 145,145,145,73,141,141,109,109,109,109,141,141,105,145,177,178,178,141,141,177,
  851. 141,141,141,141,177,177,177,177,181,181,177,141,141,141,141,141,173,141,173,173,
  852. 173,173,173,173,173,173,173,141,141,141,141,141,141,141,137,137,105,137,137,181,
  853. 145,141,177,177,182,177,141,73,141,109,73,105,105,73,109,141,73,145,177,182,182,
  854. 141,141,177,141,141,141,145,177,177,177,177,181,181,177,141,141,173,173,177,173,
  855. 177,177,177,209,209,177,177,177,177,177,177,177,173,177,173,177,173,177,141,141,
  856. 141,173,177,177,141,177,178,214,177,141,73,141,141,109,141,141,105,141,141,105,
  857. 141,177,214,178,141,145,177,141,141,145,177,177,177,177,177,181,181,177,141,141,
  858. 177,173,173,173,177,177,177,177,177,173,177,173,173,177,173,173,141,141,141,173,
  859. 141,173,137,137,137,141,177,177,141,145,177,214,177,141,73,141,141,105,145,177,
  860. 105,141,141,105,145,177,214,177,141,145,177,141,141,177,177,177,177,177,177,181,
  861. 181,177,141,141,173,177,173,173,173,141,173,173,177,177,173,173,173,177,177,173,
  862. 173,173,173,173,173,173,173,141,141,141,181,177,141,141,177,214,177,145,73,141,
  863. 141,105,145,146,109,141,141,105,177,178,214,177,109,177,177,141,145,177,177,177,
  864. 177,177,177,181,181,177,141,141,173,177,173,173,173,141,109,141,141,177,173,173,
  865. 173,177,173,173,173,173,173,173,173,141,173,141,141,137,181,177,141,141,177,214,
  866. 178,145,73,141,141,105,177,145,105,141,141,105,177,145,178,141,109,145,177,145,
  867. 177,177,177,177,177,177,181,181,181,177,141,141,141,173,173,173,141,177,177,173,
  868. 173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,141,141,173,177,177,
  869. 141,109,141,182,178,177,73,141,141,105,145,141,105,145,141,105,177,141,145,141,
  870. 105,145,177,177,177,177,177,177,177,181,181,181,181,181,173,141,141,141,173,141,
  871. 141,141,145,141,173,173,173,173,173,173,173,177,173,177,173,177,173,177,141,141,
  872. 173,173,177,181,145,109,141,182,178,177,105,109,141,105,141,141,105,145,109,109,
  873. 145,177,177,141,109,145,177,177,177,177,177,181,181,181,181,181,181,181,141,141,
  874. 141,141,141,137,141,141,105,141,141,141,141,141,141,141,141,141,141,141,141,141,
  875. 141,141,141,141,141,141,177,181,145,141,141,178,177,177,105,109,141,109,141,141,
  876. 109,145,109,141,141,141,141,141,109,177,177,177,177,177,181,181,181,181,181,181,
  877. 181,181,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
  878. 141,141,141,141,141,141,141,141,141,141,177,181,177,141,141,141,109,177,141,105,
  879. 141,141,141,141,141,141,109,141,141,141,145,141,141,177,177,145,145,177,177,177,
  880. 177,177,177,181,181,141,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
  881. 173,173,173,173,173,173,173,173,173,173,173,173,173,173,141,177,181,145,145,141,
  882. 141,177,177,141,141,141,141,141,141,141,141,141,141,141,177,177,177,177,177,145,
  883. 145,177,177,177,177,177,181,145,105,105,141,141,141,141,141,141,141,141,141,141,
  884. 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,105,105,
  885. 141,181,177,145,145,177,177,177,145,145,145,145,145,145,177,145,173,173,177,177,
  886. 177,177,177,145,145,145,145,145,177,181,141,105,105,105,141,141,141,141,141,141,
  887. 141,137,137,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,
  888. 141,141,105,105,105,105,177,181,145,145,145,145,145,145,145,145,114,146,146,150,
  889. 182,145,145,109,109,141,145,145,141,141,145,181,145,105,105,141,141,105,141,141,
  890. 141,141,105,137,105,137,141,137,141,141,141,141,141,141,141,137,137,141,141,109,
  891. 105,109,105,141,141,141,105,109,141,105,105,141,177,145,145,141,141,141,141,141,
  892. 114,146,150,182,182,178,145,105,104,141,145,145,145,181,177,137,105,109,141,141,
  893. 141,105,141,141,141,141,141,177,141,141,141,141,141,141,173,173,173,173,173,141,
  894. 141,141,141,141,141,105,141,141,141,141,105,109,141,141,105,105,105,145,181,181,
  895. 145,145,141,141,114,146,150,182,182,182,145,105,104,109,141,181,181,141,105,105,
  896. 141,141,177,145,141,105,137,137,137,141,105,105,137,137,137,141,141,141,141,173,
  897. 141,141,141,141,141,137,141,109,141,141,141,137,137,137,105,109,145,177,141,141,
  898. 105,105,141,177,181,181,145,141,114,146,182,182,182,178,145,105,104,109,141,177,
  899. 105,105,145,141,177,177,177,177,109,105,141,141,141,141,141,141,141,173,173,173,
  900. 173,173,173,177,173,173,173,173,173,173,141,109,105,141,141,141,141,141,105,105,
  901. 177,177,177,177,141,145,105,105,145,181,181,141,114,146,182,182,182,182,145,109,
  902. 104,109,141,105,105,109,145,141,177,177,177,177,141,105,137,137,137,137,141,141,
  903. 141,141,141,141,173,173,173,173,173,173,173,173,173,173,173,173,173,173,141,141,
  904. 141,141,105,109,177,177,177,177,141,145,105,73,105,177,181,145,114,146,150,182,
  905. 182,182,145,109,104,109,141,141,109,109,105,109,145,177,177,141,141,105,141,141,
  906. 137,141,173,173,173,173,173,173,177,177,177,173,173,177,177,177,177,177,173,173,
  907. 173,177,173,141,141,141,105,141,141,177,177,145,109,105,109,141,141,145,181,145,
  908. 114,146,150,182,182,178,145,105,104,109,141,145,109,141,141,109,109,141,177,145,
  909. 141,105,137,141,137,137,141,173,173,173,173,173,173,173,177,173,173,173,177,173,
  910. 177,173,173,173,173,141,141,141,141,141,105,145,177,177,141,109,109,141,141,109,
  911. 145,181,181,141,109,146,150,182,182,178,145,105,104,109,141,181,181,141,141,141,
  912. 141,105,105,145,141,105,137,141,141,141,141,173,173,173,141,173,173,173,173,173,
  913. 173,173,173,173,173,173,173,141,141,141,141,141,141,141,105,141,145,109,109,141,
  914. 141,141,141,181,181,177,109,73,109,146,150,182,182,178,145,109,105,109,141,181,
  915. 181,181,145,109,109,141,109,105,105,105,141,141,141,141,141,173,141,141,141,141,
  916. 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,105,105,
  917. 105,109,141,109,109,145,181,181,181,109,0,36,109,146,146,182,182,178,145,109,
  918. 105,109,141,181,181,181,181,181,141,109,141,141,105,105,141,141,141,141,141,141,
  919. 141,141,173,141,141,141,141,141,141,137,137,141,141,141,141,141,141,141,141,173,
  920. 141,141,105,105,141,141,109,141,181,181,181,181,181,145,109,37,109,146,146,182,
  921. 182,178,145,109,105,141,141,181,181,181,181,181,181,177,141,141,141,137,141,173,
  922. 141,141,173,141,173,173,173,173,173,141,141,141,141,141,141,141,141,173,141,173,
  923. 141,173,141,173,141,141,141,141,141,141,181,181,181,181,181,181,177,145,141,109,
  924. 109,145,146,146,145,145,141,105,104,141,141,145,145,177,181,181,181,181,181,145,
  925. 109,181,213,213,213,209,177,177,177,177,209,209,209,177,177,177,177,177,177,177,
  926. 177,177,177,177,177,177,177,177,177,213,181,141,145,181,181,181,181,181,145,145,
  927. 145,145,141,109,109,141,141,141,141,141,141,141,141,141,141
  928. }; // houseTexture
  929. S3L_Model3D houseModel;
  930. void houseModelInit()
  931. {
  932. S3L_initModel3D(
  933. houseVertices,
  934. HOUSE_VERTEX_COUNT,
  935. houseTriangleIndices,
  936. HOUSE_TRIANGLE_COUNT,
  937. &houseModel);
  938. }
  939. S3L_Vec4 uv0, uv1, uv2;
  940. const uint8_t *texture = houseTexture;
  941. int16_t previousTriangle = -1;
  942. const S3L_Index *uvIndices = houseUVIndices;
  943. const S3L_Unit *uvs = houseUVs;
  944. void pixelFunc(S3L_PixelInfo *p)
  945. {
  946. S3L_Unit u, v;
  947. if (p->triangleIndex != previousTriangle)
  948. {
  949. // cache
  950. S3L_getIndexedTriangleValues(p->triangleIndex,uvIndices,uvs,2,&uv0,&uv1,&uv2);
  951. previousTriangle = p->triangleIndex;
  952. }
  953. u = S3L_interpolateBarycentric(uv0.x,uv1.x,uv2.x,p->barycentric) >> 3;
  954. v = S3L_interpolateBarycentric(uv0.y,uv1.y,uv2.y,p->barycentric) >> 3;
  955. uint8_t c = texture[v * 64 + u];
  956. SAF_drawPixel(p->x,p->y,c);
  957. }
  958. S3L_Scene scene;
  959. #define ROTATION_STEP 8
  960. #define ZOOM_STEP 64
  961. #define ZOOM_MAX (-7 * S3L_FRACTIONS_PER_UNIT)
  962. #define ZOOM_MIN (-12 * S3L_FRACTIONS_PER_UNIT)
  963. void SAF_init(void)
  964. {
  965. houseModelInit();
  966. S3L_initScene(&houseModel,1,&scene);
  967. scene.camera.transform.translation.z = (ZOOM_MIN + ZOOM_MAX) / 2;
  968. }
  969. uint8_t SAF_loop(void)
  970. {
  971. SAF_clearScreen(SAF_COLOR_BLACK);
  972. S3L_newFrame();
  973. S3L_drawScene(scene);
  974. if (!SAF_buttonPressed(SAF_BUTTON_B))
  975. {
  976. if (SAF_buttonPressed(SAF_BUTTON_LEFT))
  977. scene.models[0].transform.rotation.y -= ROTATION_STEP;
  978. else if (SAF_buttonPressed(SAF_BUTTON_RIGHT))
  979. scene.models[0].transform.rotation.y += ROTATION_STEP;
  980. else if (SAF_buttonPressed(SAF_BUTTON_DOWN))
  981. scene.models[0].transform.rotation.x += ROTATION_STEP;
  982. else if (SAF_buttonPressed(SAF_BUTTON_UP))
  983. scene.models[0].transform.rotation.x -= ROTATION_STEP;
  984. }
  985. else
  986. {
  987. if (SAF_buttonPressed(SAF_BUTTON_DOWN) && scene.camera.transform.translation.z > ZOOM_MIN)
  988. scene.camera.transform.translation.z -= ZOOM_STEP;
  989. else if (SAF_buttonPressed(SAF_BUTTON_UP) && scene.camera.transform.translation.z < ZOOM_MAX)
  990. scene.camera.transform.translation.z += ZOOM_STEP;
  991. }
  992. return 1;
  993. }