diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 54ca976..b750195 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,30 +10,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Cache Cargo registry - uses: actions/cache@v3 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-registry- - - - name: Cache Cargo index - uses: actions/cache@v3 - with: - path: ~/.cargo/index - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-index- - - - name: Cache Cargo build - uses: actions/cache@v3 - with: - path: target - key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-build- - - name: Install Rust uses: actions-rs/toolchain@v1 with: diff --git a/src/load_json.rs b/src/load_json.rs index b00eb11..1be4646 100644 --- a/src/load_json.rs +++ b/src/load_json.rs @@ -4,41 +4,2191 @@ use serde::Deserialize; use tracing::info; use std::{env, path::PathBuf}; +const SYNTHETIC_JSON_DATA: &str = r#" +{ + "line_list": [ + [ + 2312, + 2314 + ], + [ + 2312, + 2317 + ], + [ + 2376, + 2418 + ], + [ + 4720, + 4732 + ], + [ + 3560, + 3561 + ], + [ + 3560, + 3562 + ], + [ + 1568, + 1570 + ], + [ + 2992, + 2999 + ], + [ + 232, + 233 + ], + [ + 424, + 425 + ], + [ + 2336, + 2820 + ], + [ + 1128, + 1231 + ], + [ + 1320, + 1321 + ], + [ + 5944, + 5945 + ], + [ + 1928, + 1965 + ], + [ + 4832, + 4835 + ], + [ + 784, + 785 + ], + [ + 4960, + 4961 + ], + [ + 7432, + 7433 + ], + [ + 5504, + 5511 + ], + [ + 3800, + 3806 + ], + [ + 5952, + 5953 + ], + [ + 5504, + 5508 + ], + [ + 4200, + 4223 + ], + [ + 2672, + 2673 + ], + [ + 856, + 857 + ], + [ + 824, + 858 + ], + [ + 360, + 425 + ], + [ + 5032, + 5033 + ], + [ + 5032, + 5080 + ], + [ + 3504, + 3505 + ], + [ + 3504, + 3506 + ], + [ + 7520, + 7522 + ], + [ + 6024, + 6025 + ], + [ + 6120, + 6122 + ], + [ + 2345, + 2347 + ], + [ + 4433, + 4434 + ], + [ + 4433, + 4437 + ], + [ + 353, + 354 + ], + [ + 353, + 357 + ], + [ + 5945, + 5946 + ], + [ + 6617, + 6618 + ], + [ + 2217, + 2239 + ], + [ + 5033, + 5050 + ], + [ + 5353, + 5779 + ], + [ + 3561, + 3795 + ], + [ + 2177, + 2178 + ], + [ + 6593, + 6594 + ], + [ + 4729, + 4757 + ], + [ + 3361, + 3363 + ], + [ + 5433, + 5434 + ], + [ + 7537, + 7538 + ], + [ + 1225, + 1226 + ], + [ + 5401, + 5930 + ], + [ + 1481, + 1563 + ], + [ + 1737, + 1738 + ], + [ + 1737, + 1747 + ], + [ + 785, + 786 + ], + [ + 817, + 851 + ], + [ + 6697, + 6699 + ], + [ + 4737, + 4743 + ], + [ + 2745, + 2747 + ], + [ + 2745, + 2748 + ], + [ + 753, + 754 + ], + [ + 1201, + 1203 + ], + [ + 1201, + 1205 + ], + [ + 5953, + 5954 + ], + [ + 2417, + 2418 + ], + [ + 153, + 196 + ], + [ + 753, + 786 + ], + [ + 857, + 858 + ], + [ + 2673, + 2715 + ], + [ + 5513, + 5515 + ], + [ + 1145, + 1148 + ], + [ + 6025, + 6026 + ], + [ + 3505, + 3585 + ], + [ + 1145, + 1654 + ], + [ + 2666, + 2667 + ], + [ + 4754, + 4755 + ], + [ + 2666, + 2714 + ], + [ + 2762, + 2769 + ], + [ + 5042, + 5043 + ], + [ + 66, + 126 + ], + [ + 2314, + 2320 + ], + [ + 354, + 360 + ], + [ + 2474, + 2475 + ], + [ + 3562, + 3585 + ], + [ + 1570, + 1571 + ], + [ + 1666, + 1668 + ], + [ + 5650, + 5813 + ], + [ + 1794, + 1795 + ], + [ + 5042, + 5050 + ], + [ + 394, + 549 + ], + [ + 5082, + 5083 + ], + [ + 6194, + 6196 + ], + [ + 6578, + 6580 + ], + [ + 5658, + 5661 + ], + [ + 1738, + 1741 + ], + [ + 5658, + 5662 + ], + [ + 5946, + 5947 + ], + [ + 5434, + 5435 + ], + [ + 4738, + 4744 + ], + [ + 2714, + 2715 + ], + [ + 6026, + 6027 + ], + [ + 754, + 755 + ], + [ + 5058, + 5059 + ], + [ + 7114, + 7116 + ], + [ + 3034, + 3036 + ], + [ + 4778, + 4852 + ], + [ + 6442, + 6444 + ], + [ + 6634, + 6635 + ], + [ + 5890, + 5895 + ], + [ + 5954, + 5955 + ], + [ + 7434, + 7435 + ], + [ + 4746, + 4747 + ], + [ + 4842, + 4845 + ], + [ + 2962, + 2963 + ], + [ + 6338, + 6340 + ], + [ + 2226, + 2265 + ], + [ + 6466, + 6468 + ], + [ + 2386, + 2419 + ], + [ + 2482, + 2497 + ], + [ + 1658, + 1667 + ], + [ + 5610, + 5779 + ], + [ + 3506, + 3806 + ], + [ + 1882, + 1883 + ], + [ + 5290, + 5291 + ], + [ + 2987, + 2996 + ], + [ + 7099, + 7101 + ], + [ + 5043, + 5058 + ], + [ + 3051, + 3055 + ], + [ + 2667, + 2672 + ], + [ + 2379, + 2380 + ], + [ + 1355, + 2522 + ], + [ + 35, + 198 + ], + [ + 1827, + 1828 + ], + [ + 1795, + 1838 + ], + [ + 5651, + 6008 + ], + [ + 1667, + 1668 + ], + [ + 7515, + 7516 + ], + [ + 7419, + 7420 + ], + [ + 3371, + 3372 + ], + [ + 2787, + 2788 + ], + [ + 2787, + 2794 + ], + [ + 267, + 269 + ], + [ + 6419, + 6420 + ], + [ + 299, + 301 + ], + [ + 299, + 424 + ], + [ + 6227, + 6228 + ], + [ + 6291, + 6292 + ], + [ + 6387, + 6388 + ], + [ + 5947, + 5949 + ], + [ + 1963, + 1964 + ], + [ + 1611, + 1618 + ], + [ + 5435, + 5813 + ], + [ + 7539, + 7541 + ], + [ + 1963, + 2181 + ], + [ + 1483, + 1484 + ], + [ + 1163, + 1164 + ], + [ + 1163, + 1167 + ], + [ + 1195, + 1198 + ], + [ + 1195, + 1199 + ], + [ + 851, + 885 + ], + [ + 5059, + 5062 + ], + [ + 2427, + 2577 + ], + [ + 403, + 532 + ], + [ + 4739, + 4746 + ], + [ + 755, + 756 + ], + [ + 2459, + 2461 + ], + [ + 2459, + 2462 + ], + [ + 1747, + 1794 + ], + [ + 2155, + 2156 + ], + [ + 5955, + 5956 + ], + [ + 2747, + 3356 + ], + [ + 7403, + 7404 + ], + [ + 2963, + 2995 + ], + [ + 2803, + 2805 + ], + [ + 2475, + 2495 + ], + [ + 5515, + 5890 + ], + [ + 5899, + 5900 + ], + [ + 1883, + 1897 + ], + [ + 1851, + 1899 + ], + [ + 5899, + 6008 + ], + [ + 6027, + 6028 + ], + [ + 6259, + 6260 + ], + [ + 6091, + 6092 + ], + [ + 1563, + 1565 + ], + [ + 1179, + 1647 + ], + [ + 3795, + 3797 + ], + [ + 3379, + 3415 + ], + [ + 7067, + 7068 + ], + [ + 1147, + 1148 + ], + [ + 1147, + 1150 + ], + [ + 1179, + 1180 + ], + [ + 1124, + 1126 + ], + [ + 1124, + 1128 + ], + [ + 5268, + 5269 + ], + [ + 7548, + 7549 + ], + [ + 1636, + 1637 + ], + [ + 1604, + 1642 + ], + [ + 1828, + 1842 + ], + [ + 2540, + 2541 + ], + [ + 516, + 517 + ], + [ + 516, + 520 + ], + [ + 548, + 549 + ], + [ + 4724, + 4725 + ], + [ + 4724, + 4741 + ], + [ + 7132, + 7133 + ], + [ + 7508, + 7509 + ], + [ + 1484, + 1486 + ], + [ + 1772, + 1773 + ], + [ + 1836, + 1837 + ], + [ + 1836, + 1838 + ], + [ + 1964, + 1965 + ], + [ + 2404, + 2405 + ], + [ + 6740, + 6741 + ], + [ + 2820, + 2821 + ], + [ + 2948, + 2998 + ], + [ + 7244, + 7246 + ], + [ + 1236, + 1237 + ], + [ + 3324, + 3325 + ], + [ + 3356, + 3358 + ], + [ + 5508, + 5513 + ], + [ + 2404, + 2573 + ], + [ + 5956, + 5958 + ], + [ + 1812, + 1864 + ], + [ + 6188, + 6190 + ], + [ + 4196, + 4197 + ], + [ + 4196, + 4200 + ], + [ + 116, + 227 + ], + [ + 2364, + 2365 + ], + [ + 2428, + 2430 + ], + [ + 2492, + 2493 + ], + [ + 404, + 514 + ], + [ + 4772, + 4773 + ], + [ + 2748, + 2749 + ], + [ + 2780, + 2781 + ], + [ + 2780, + 2788 + ], + [ + 756, + 790 + ], + [ + 1180, + 1181 + ], + [ + 7396, + 7398 + ], + [ + 7428, + 7429 + ], + [ + 3380, + 3381 + ], + [ + 3380, + 3414 + ], + [ + 7524, + 7525 + ], + [ + 1564, + 1565 + ], + [ + 1564, + 1571 + ], + [ + 1596, + 1597 + ], + [ + 1596, + 1606 + ], + [ + 1884, + 1892 + ], + [ + 6436, + 6438 + ], + [ + 2548, + 2549 + ], + [ + 6692, + 6693 + ], + [ + 1636, + 1642 + ], + [ + 5036, + 5037 + ], + [ + 5036, + 5066 + ], + [ + 3373, + 3375 + ], + [ + 5429, + 5430 + ], + [ + 7485, + 7486 + ], + [ + 3405, + 3415 + ], + [ + 1477, + 1479 + ], + [ + 1477, + 1481 + ], + [ + 5349, + 5353 + ], + [ + 1157, + 1162 + ], + [ + 5941, + 5942 + ], + [ + 1797, + 1847 + ], + [ + 1861, + 1865 + ], + [ + 1925, + 1926 + ], + [ + 1605, + 1606 + ], + [ + 1605, + 1612 + ], + [ + 5941, + 5943 + ], + [ + 2349, + 2352 + ], + [ + 2381, + 2383 + ], + [ + 2381, + 2386 + ], + [ + 4437, + 4444 + ], + [ + 357, + 358 + ], + [ + 2317, + 2411 + ], + [ + 6589, + 6590 + ], + [ + 4213, + 4215 + ], + [ + 6333, + 6334 + ], + [ + 4757, + 4960 + ], + [ + 5429, + 5907 + ], + [ + 5077, + 5078 + ], + [ + 5077, + 5083 + ], + [ + 7165, + 7166 + ], + [ + 517, + 518 + ], + [ + 4725, + 4769 + ], + [ + 2765, + 2766 + ], + [ + 2309, + 3382 + ], + [ + 3365, + 3385 + ], + [ + 1773, + 1797 + ], + [ + 5661, + 5930 + ], + [ + 1837, + 1847 + ], + [ + 5949, + 5950 + ], + [ + 1741, + 1750 + ], + [ + 301, + 423 + ], + [ + 6165, + 6166 + ], + [ + 1925, + 2156 + ], + [ + 2149, + 2177 + ], + [ + 2181, + 2182 + ], + [ + 237, + 238 + ], + [ + 2821, + 2822 + ], + [ + 2981, + 2982 + ], + [ + 6709, + 6711 + ], + [ + 2749, + 3358 + ], + [ + 7533, + 7535 + ], + [ + 7253, + 7256 + ], + [ + 1205, + 1239 + ], + [ + 7405, + 7407 + ], + [ + 1813, + 1814 + ], + [ + 6021, + 6023 + ], + [ + 1621, + 1622 + ], + [ + 5349, + 5785 + ], + [ + 405, + 412 + ], + [ + 437, + 445 + ], + [ + 6253, + 6254 + ], + [ + 4197, + 4213 + ], + [ + 6317, + 6318 + ], + [ + 6381, + 6382 + ], + [ + 885, + 886 + ], + [ + 5029, + 5040 + ], + [ + 2461, + 2566 + ], + [ + 6021, + 6022 + ], + [ + 1853, + 1854 + ], + [ + 1597, + 1604 + ], + [ + 3797, + 3798 + ], + [ + 317, + 480 + ], + [ + 445, + 511 + ], + [ + 6149, + 6150 + ], + [ + 6565, + 6566 + ], + [ + 6245, + 6246 + ], + [ + 2165, + 2166 + ], + [ + 2165, + 2168 + ], + [ + 2965, + 2966 + ], + [ + 2965, + 2996 + ], + [ + 5398, + 5907 + ], + [ + 5942, + 5958 + ], + [ + 7478, + 7480 + ], + [ + 1926, + 1928 + ], + [ + 6038, + 6040 + ], + [ + 1126, + 1132 + ], + [ + 5398, + 5399 + ], + [ + 7454, + 7455 + ], + [ + 5430, + 5433 + ], + [ + 3374, + 3411 + ], + [ + 2766, + 2771 + ], + [ + 2990, + 2992 + ], + [ + 5046, + 5047 + ], + [ + 5078, + 5080 + ], + [ + 7134, + 7135 + ], + [ + 2222, + 2226 + ], + [ + 2254, + 2257 + ], + [ + 2254, + 2266 + ], + [ + 230, + 231 + ], + [ + 230, + 233 + ], + [ + 358, + 423 + ], + [ + 1486, + 1568 + ], + [ + 5662, + 5959 + ], + [ + 5150, + 5153 + ], + [ + 1198, + 1236 + ], + [ + 7414, + 7415 + ], + [ + 7446, + 7447 + ], + [ + 3366, + 3384 + ], + [ + 7510, + 7511 + ], + [ + 5950, + 5951 + ], + [ + 4734, + 4735 + ], + [ + 4766, + 4767 + ], + [ + 4766, + 4769 + ], + [ + 2790, + 2791 + ], + [ + 2758, + 2796 + ], + [ + 2982, + 3002 + ], + [ + 5054, + 5055 + ], + [ + 6902, + 7106 + ], + [ + 7126, + 7127 + ], + [ + 5086, + 5087 + ], + [ + 110, + 111 + ], + [ + 110, + 113 + ], + [ + 2214, + 2216 + ], + [ + 1622, + 1627 + ], + [ + 1654, + 1658 + ], + [ + 2966, + 2967 + ], + [ + 1750, + 1772 + ], + [ + 1814, + 1844 + ], + [ + 6022, + 6028 + ], + [ + 7470, + 7471 + ], + [ + 7502, + 7503 + ], + [ + 2462, + 2566 + ], + [ + 6734, + 6735 + ], + [ + 2750, + 2751 + ], + [ + 2750, + 2759 + ], + [ + 790, + 824 + ], + [ + 886, + 887 + ], + [ + 2942, + 2943 + ], + [ + 2942, + 2990 + ], + [ + 3006, + 3007 + ], + [ + 5062, + 5063 + ], + [ + 3006, + 3050 + ], + [ + 310, + 311 + ], + [ + 310, + 314 + ], + [ + 2238, + 2241 + ], + [ + 2302, + 2457 + ], + [ + 2790, + 2796 + ], + [ + 1630, + 1631 + ], + [ + 1630, + 1637 + ], + [ + 3798, + 3800 + ], + [ + 1854, + 1897 + ], + [ + 5262, + 5263 + ], + [ + 7430, + 7431 + ], + [ + 7462, + 7463 + ], + [ + 1310, + 1323 + ], + [ + 7494, + 7495 + ], + [ + 1374, + 1375 + ], + [ + 7526, + 7527 + ], + [ + 1374, + 1384 + ], + [ + 6662, + 6663 + ], + [ + 4750, + 4751 + ], + [ + 4750, + 4755 + ], + [ + 2774, + 2775 + ], + [ + 2774, + 2781 + ], + [ + 2998, + 2999 + ], + [ + 30, + 31 + ], + [ + 30, + 32 + ], + [ + 4142, + 4143 + ], + [ + 62, + 64 + ], + [ + 126, + 127 + ], + [ + 158, + 159 + ], + [ + 158, + 161 + ], + [ + 2230, + 2231 + ], + [ + 7542, + 7543 + ], + [ + 2230, + 2268 + ], + [ + 4142, + 4444 + ], + [ + 350, + 351 + ], + [ + 4734, + 4751 + ], + [ + 1831, + 1832 + ], + [ + 1831, + 1835 + ], + [ + 5943, + 5944 + ], + [ + 1895, + 1896 + ], + [ + 6071, + 6072 + ], + [ + 855, + 888 + ], + [ + 5399, + 5401 + ], + [ + 2943, + 2948 + ], + [ + 7487, + 7489 + ], + [ + 3375, + 3412 + ], + [ + 1479, + 1483 + ], + [ + 5143, + 5145 + ], + [ + 1159, + 1162 + ], + [ + 4951, + 4954 + ], + [ + 5047, + 5052 + ], + [ + 6399, + 6400 + ], + [ + 1167, + 2349 + ], + [ + 4215, + 4434 + ], + [ + 6559, + 6560 + ], + [ + 2455, + 2497 + ], + [ + 6623, + 6624 + ], + [ + 5063, + 5268 + ], + [ + 6303, + 6304 + ], + [ + 2223, + 2224 + ], + [ + 2255, + 2256 + ], + [ + 2255, + 2265 + ], + [ + 1871, + 1873 + ], + [ + 1871, + 1895 + ], + [ + 1615, + 1616 + ], + [ + 1647, + 1649 + ], + [ + 5087, + 5161 + ], + [ + 1199, + 1200 + ], + [ + 5951, + 5952 + ], + [ + 1231, + 1235 + ], + [ + 783, + 784 + ], + [ + 783, + 817 + ], + [ + 7159, + 7161 + ], + [ + 4735, + 4741 + ], + [ + 4767, + 4772 + ], + [ + 2759, + 2760 + ], + [ + 4831, + 4832 + ], + [ + 1159, + 2347 + ], + [ + 2375, + 2379 + ], + [ + 399, + 400 + ], + [ + 399, + 401 + ], + [ + 1375, + 1376 + ], + [ + 7111, + 7113 + ], + [ + 2215, + 2217 + ], + [ + 6359, + 6360 + ], + [ + 5511, + 5900 + ], + [ + 1815, + 1861 + ], + [ + 5895, + 5959 + ], + [ + 6023, + 6024 + ], + [ + 6055, + 6056 + ], + [ + 1623, + 1624 + ], + [ + 1623, + 1631 + ], + [ + 5607, + 5785 + ], + [ + 2375, + 2376 + ], + [ + 1303, + 1305 + ], + [ + 1303, + 1310 + ], + [ + 5607, + 5610 + ], + [ + 855, + 856 + ], + [ + 887, + 888 + ], + [ + 4775, + 4778 + ], + [ + 2751, + 2758 + ], + [ + 119, + 267 + ], + [ + 2335, + 2336 + ], + [ + 2335, + 2337 + ], + [ + 311, + 350 + ], + [ + 439, + 442 + ], + [ + 439, + 483 + ], + [ + 6639, + 6641 + ], + [ + 2495, + 2550 + ], + [ + 6287, + 6288 + ], + [ + 2239, + 2240 + ], + [ + 6063, + 6064 + ], + [ + 5647, + 5650 + ], + [ + 5647, + 5651 + ], + [ + 7239, + 7242 + ], + [ + 1247, + 1249 + ], + [ + 4975, + 4978 + ], + [ + 7079, + 7081 + ], + [ + 2967, + 3017 + ], + [ + 6727, + 6729 + ], + [ + 2359, + 2803 + ], + [ + 2231, + 2309 + ], + [ + 6407, + 6408 + ], + [ + 2359, + 2361 + ], + [ + 6471, + 6472 + ], + [ + 351, + 405 + ], + [ + 2455, + 2457 + ], + [ + 6599, + 6600 + ], + [ + 6183, + 6184 + ], + [ + 31, + 59 + ], + [ + 4143, + 4223 + ], + [ + 159, + 229 + ] + ] +} +"#; + #[derive(Deserialize, Debug)] pub struct JsonLineList { pub line_list: Vec<[u32; 2]>, } pub fn json_parse(settings: &WireframeSettings) -> Result { - let gltf_path = settings.gltf_path.as_ref() - .ok_or_else(|| anyhow::anyhow!("No gltf path provided"))?; + let json_str = r#" + { + "line_list": [ + [2312, 2314], + [2312, 2317], + // ... (rest of the JSON data) + [159, 229] + ] + } + "#; - let path = build_asset_path(&gltf_path); + // Parse the JSON string into JsonLineList + let json_line_list: JsonLineList = serde_json::from_str(SYNTHETIC_JSON_DATA)?; - if !path.exists() { - return Err(anyhow::anyhow!("JSON file not found: {}", path.display())); - } - else{ - info!("JSON file found: {}", path.display()); - } + Ok(json_line_list) +} - let json_data = std::fs::read_to_string(&path) - .with_context(|| format!("Failed to read file: {}", path.display()))?; - serde_json::from_str(&json_data) - .with_context(|| "Failed to parse JSON") -} -fn build_asset_path(gltf_path: &str) -> PathBuf { - // Try to get the assets directory from an environment variable - let assets_dir = env::var("ASSETS_DIR").unwrap_or_else(|_| "assets".to_string()); +// pub fn json_parse(settings: &WireframeSettings) -> Result { + + + +// let gltf_path = settings.gltf_path.as_ref() +// .ok_or_else(|| anyhow::anyhow!("No gltf path provided"))?; + +// let path = build_asset_path(&gltf_path); + +// if !path.exists() { +// return Err(anyhow::anyhow!("JSON file not found: {}", path.display())); +// } +// else{ +// info!("JSON file found: {}", path.display()); +// } + +// let json_data = std::fs::read_to_string(&path) +// .with_context(|| format!("Failed to read file: {}", path.display()))?; + +// serde_json::from_str(&json_data) +// .with_context(|| "Failed to parse JSON") +// } + +// fn build_asset_path(gltf_path: &str) -> PathBuf { +// // Try to get the assets directory from an environment variable +// let assets_dir = env::var("ASSETS_DIR").unwrap_or_else(|_| "assets".to_string()); + +// // Create a PathBuf for the assets directory +// let mut path = PathBuf::from(assets_dir); + +// // Append the gltf_path and change the extension to .json +// path.push(gltf_path); +// path.set_extension("json"); + +// path +// } + - // Create a PathBuf for the assets directory - let mut path = PathBuf::from(assets_dir); - // Append the gltf_path and change the extension to .json - path.push(gltf_path); - path.set_extension("json"); - path -} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 97b2ad7..e183b30 100644 --- a/src/main.rs +++ b/src/main.rs @@ -137,8 +137,8 @@ fn setup( ..default() }, WireframeSettings { - gltf_path: None, - // gltf_path: Some(String::from(ASTROPATH)), + // gltf_path: None, + gltf_path: Some(String::from(ASTROPATH)), }, ))