diff --git a/assets/car_model.obj b/assets/car_model.obj index 6cc73b2..9959ce7 100644 --- a/assets/car_model.obj +++ b/assets/car_model.obj @@ -1,127 +1,170 @@ -v -1.367492 -0.088491 0.692367 -v -0.564691 -0.088491 0.707468 -v -1.367492 -0.477689 0.853578 -v -0.564691 -0.467011 0.864257 -v -1.367492 -0.638901 1.242777 -v -0.564691 -0.623799 1.242777 -v -1.367492 -0.477689 1.631975 -v -0.564691 -0.467011 1.621297 -v -1.367492 -0.088491 1.793186 -v -0.564691 -0.088491 1.778085 -v -1.367492 0.300707 1.631975 -v -0.564692 0.290029 1.621297 -v -1.367492 0.461918 1.242777 -v -0.564692 0.446817 1.242777 -v -1.367492 0.300707 0.853578 -v -0.564692 0.290029 0.864257 -v -0.977041 -0.088491 0.593934 -v -0.977041 -0.547293 0.783975 -v -0.977041 -0.737334 1.242777 -v -0.977041 -0.547293 1.701578 -v -0.977041 -0.088491 1.891620 -v -0.977041 0.370310 1.701578 -v -0.977041 0.560352 1.242777 -v -0.977041 0.370310 0.783975 -v 1.364076 -0.088491 1.793186 -v 0.561275 -0.088491 1.778085 -v 1.364076 -0.477689 1.631975 -v 0.561276 -0.467011 1.621297 -v 1.364076 -0.638901 1.242777 -v 0.561275 -0.623800 1.242777 -v 1.364076 -0.477689 0.853578 -v 0.561275 -0.467011 0.864257 -v 1.364076 -0.088491 0.692367 -v 0.561275 -0.088491 0.707469 -v 1.364076 0.300707 0.853578 -v 0.561275 0.290029 0.864257 -v 1.364076 0.461918 1.242777 -v 0.561275 0.446817 1.242777 -v 1.364076 0.300707 1.631975 -v 0.561275 0.290029 1.621297 -v 0.973625 -0.088491 1.891620 -v 0.973625 -0.547293 1.701578 -v 0.973625 -0.737334 1.242777 -v 0.973625 -0.547293 0.783975 -v 0.973625 -0.088491 0.593934 -v 0.973625 0.370310 0.783975 -v 0.973625 0.560352 1.242777 -v 0.973625 0.370310 1.701578 -v -1.367492 -0.088491 -1.994304 -v -0.564692 -0.088491 -1.979203 -v -1.367492 -0.477690 -1.833092 -v -0.564692 -0.467011 -1.822414 -v -1.367492 -0.638901 -1.443894 -v -0.564692 -0.623800 -1.443894 -v -1.367492 -0.477690 -1.054696 -v -0.564692 -0.467011 -1.065374 -v -1.367492 -0.088491 -0.893484 -v -0.564692 -0.088491 -0.908586 -v -1.367492 0.300707 -1.054696 -v -0.564692 0.290029 -1.065374 -v -1.367492 0.461918 -1.443894 -v -0.564692 0.446817 -1.443894 -v -1.367492 0.300707 -1.833092 -v -0.564692 0.290029 -1.822414 -v -0.977042 -0.088491 -2.092737 -v -0.977042 -0.547293 -1.902696 -v -0.977042 -0.737334 -1.443894 -v -0.977042 -0.547293 -0.985093 -v -0.977042 -0.088491 -0.795051 -v -0.977042 0.370310 -0.985093 -v -0.977042 0.560352 -1.443894 -v -0.977042 0.370310 -1.902696 -v 1.364076 -0.088491 -0.893485 -v 0.561275 -0.088491 -0.908586 -v 1.364076 -0.477689 -1.054696 -v 0.561276 -0.467011 -1.065374 -v 1.364076 -0.638901 -1.443894 -v 0.561275 -0.623800 -1.443894 -v 1.364076 -0.477689 -1.833092 -v 0.561275 -0.467011 -1.822414 -v 1.364076 -0.088491 -1.994304 -v 0.561275 -0.088491 -1.979202 -v 1.364076 0.300707 -1.833092 -v 0.561275 0.290029 -1.822414 -v 1.364076 0.461918 -1.443894 -v 0.561275 0.446817 -1.443894 -v 1.364076 0.300707 -1.054696 -v 0.561275 0.290029 -1.065374 -v 0.973625 -0.088491 -0.795051 -v 0.973625 -0.547293 -0.985093 -v 0.973625 -0.737334 -1.443894 -v 0.973625 -0.547293 -1.902696 -v 0.973625 -0.088491 -2.092737 -v 0.973625 0.370310 -1.902696 -v 0.973625 0.560352 -1.443894 -v 0.973625 0.370310 -0.985093 -v -0.698782 -0.275080 0.375666 -v -0.751407 -0.372127 -0.572427 -v -0.825614 0.246449 0.476541 -v -0.937154 0.186351 -0.702220 -v -0.394348 0.933427 0.326820 -v -0.462354 0.872611 -0.590201 -v -0.415357 0.328760 -1.212920 -v -0.435391 0.239687 -1.561080 -v -0.532521 0.404681 0.902465 -v -0.453189 -0.214632 -1.655422 -v -0.479206 0.353065 1.310565 -v -0.458878 -0.129672 1.378813 -v -0.460862 -0.376587 -0.765167 -v -0.497771 -0.260484 0.546224 -v 0.710485 -0.275080 0.375666 -v 0.763109 -0.372127 -0.572427 -v 0.837320 0.246449 0.476541 -v 0.948860 0.186351 -0.702220 -v 0.406054 0.933427 0.326820 -v 0.474060 0.872611 -0.590201 -v 0.427063 0.328760 -1.212920 -v 0.447097 0.239687 -1.561080 -v 0.544227 0.404681 0.902465 -v 0.464895 -0.214632 -1.655422 -v 0.490912 0.353065 1.310565 -v 0.470584 -0.129672 1.378813 -v 0.472567 -0.376587 -0.765167 -v 0.509476 -0.260484 0.546224 +v -1.367492 -0.116281 -0.985208 +v -1.367492 -1.055889 -1.374406 +v -1.367492 -0.505479 -0.823996 +v -1.367492 0.044930 -1.374406 +v -0.977042 -0.964281 -1.833208 +v -1.367492 -0.505479 -1.924816 +v -0.977042 -0.505479 -2.023249 +v -1.367492 -0.116281 -1.763604 +v -0.977042 -0.046678 -1.833208 +v -0.564692 -0.126959 -1.752926 +v -0.564692 -0.505479 -1.909715 +v -0.564692 -0.883999 -1.752926 +v -0.564692 -1.040788 -1.374406 +v -0.977042 -1.154322 -1.374406 +v -1.367492 -0.894678 -0.985208 +v -0.977042 -0.964281 -0.915605 +v -0.564692 -0.883999 -0.995886 +v -0.564692 -0.505479 -0.839098 +v -0.977042 -0.505479 -0.725563 +v -0.564692 -0.126959 -0.995886 +v -0.977042 -0.046678 -0.915605 +v -0.977042 0.143364 -1.374406 +v -0.564692 0.029829 -1.374406 +v -1.367492 -0.894678 -1.763604 +v 1.364076 -0.116281 -1.763604 +v 1.364076 -1.055889 -1.374406 +v 1.364076 -0.505479 -1.924816 +v 1.364076 0.044930 -1.374406 +v 0.973625 -0.964281 -0.915605 +v 1.364076 -0.505479 -0.823997 +v 0.973625 -0.505479 -0.725563 +v 1.364076 -0.116281 -0.985208 +v 0.973625 -0.046678 -0.915605 +v 0.561275 -0.126959 -0.995886 +v 0.561275 -0.505479 -0.839098 +v 0.561276 -0.883999 -0.995886 +v 0.561275 -1.040788 -1.374406 +v 0.973625 -1.154322 -1.374406 +v 1.364076 -0.894677 -1.763604 +v 0.973625 -0.964281 -1.833208 +v 0.561275 -0.883999 -1.752926 +v 0.561275 -0.505479 -1.909714 +v 0.973625 -0.505479 -2.023249 +v 0.561275 -0.126959 -1.752926 +v 0.973625 -0.046678 -1.833208 +v 0.973625 0.143364 -1.374406 +v 0.561275 0.029829 -1.374406 +v 1.364076 -0.894677 -0.985208 +v -0.698782 -0.692068 0.445154 +v -0.825614 -0.170539 0.546029 +v -0.937154 -0.230637 -0.632732 +v -0.394348 0.516439 0.396308 +v -0.462354 0.455623 -0.520713 +v -0.458878 -0.546660 1.448301 +v -0.497771 -0.677472 0.615712 +v 0.470584 -0.546660 1.448301 +v 0.544227 -0.012307 0.971953 +v -0.479206 -0.063923 1.380053 +v 0.490912 -0.063923 1.380053 +v -0.415357 -0.088228 -1.143432 +v 0.406054 0.516439 0.396308 +v -0.532521 -0.012307 0.971953 +v 0.474060 0.455623 -0.520713 +v -0.435391 -0.177301 -1.491592 +v 0.447097 -0.177301 -1.491592 +v 0.464895 -0.631620 -1.585934 +v -0.453189 -0.631620 -1.585934 +v -0.460862 -0.793575 -0.695679 +v -0.751407 -0.789115 -0.502939 +v 0.427063 -0.088228 -1.143432 +v 0.472567 -0.793575 -0.695679 +v 0.509476 -0.677472 0.615712 +v 0.710485 -0.692068 0.445154 +v 0.763109 -0.789115 -0.502939 +v 0.948860 -0.230637 -0.632732 +v 0.837320 -0.170539 0.546029 +v -1.367492 -0.116281 1.701463 +v -1.367492 -1.055889 1.312265 +v -1.367492 -0.505479 1.862674 +v -1.367492 0.044930 1.312265 +v -0.977041 -0.964281 0.853463 +v -1.367492 -0.505479 0.761855 +v -0.977041 -0.505479 0.663422 +v -1.367492 -0.116281 0.923066 +v -0.977041 -0.046678 0.853463 +v -0.564692 -0.126959 0.933745 +v -0.564691 -0.505479 0.776956 +v -0.564691 -0.883999 0.933745 +v -0.564691 -1.040787 1.312265 +v -0.977041 -1.154322 1.312265 +v -1.367492 -0.894677 1.701463 +v -0.977041 -0.964281 1.771066 +v -0.564691 -0.883999 1.690785 +v -0.564691 -0.505479 1.847573 +v -0.977041 -0.505479 1.961108 +v -0.564692 -0.126959 1.690785 +v -0.977041 -0.046678 1.771066 +v -0.977041 0.143364 1.312265 +v -0.564692 0.029829 1.312265 +v -1.367492 -0.894677 0.923066 +v 1.364076 -0.116281 0.923066 +v 1.364076 -1.055889 1.312265 +v 1.364076 -0.505479 0.761855 +v 1.364076 0.044930 1.312265 +v 0.973625 -0.964281 1.771066 +v 1.364076 -0.505479 1.862674 +v 0.973625 -0.505479 1.961108 +v 1.364076 -0.116281 1.701463 +v 0.973625 -0.046678 1.771066 +v 0.561275 -0.126959 1.690785 +v 0.561275 -0.505479 1.847573 +v 0.561276 -0.883999 1.690785 +v 0.561275 -1.040788 1.312265 +v 0.973625 -1.154322 1.312265 +v 1.364076 -0.894677 0.923066 +v 0.973625 -0.964281 0.853463 +v 0.561275 -0.883999 0.933745 +v 0.561275 -0.505479 0.776957 +v 0.973625 -0.505479 0.663422 +v 0.561275 -0.126959 0.933745 +v 0.973625 -0.046678 0.853463 +v 0.973625 0.143364 1.312265 +v 0.561275 0.029829 1.312265 +v 1.364076 -0.894677 1.701463 +vt 0.209947 0.456692 +vt 0.125567 0.263214 +vt 0.241901 0.375309 +vt 0.129805 0.491643 +vt 0.124436 0.570947 +vt 0.244305 0.631444 +vt 0.124436 0.631444 +vt 0.244305 0.690874 +vt 0.124436 0.690874 +vt 0.009233 0.690874 +vt 0.009233 0.631444 +vt 0.009233 0.570947 +vt 0.009233 0.508357 +vt 0.124436 0.508357 +vt 0.244305 0.508357 +vt 0.244305 0.932575 +vt 0.124436 0.995127 +vt 0.124436 0.932575 +vt 0.009233 0.932575 +vt 0.009233 0.871660 +vt 0.124436 0.871660 +vt 0.244305 0.871660 +vt 0.009233 0.811345 +vt 0.124436 0.811345 +vt 0.244305 0.811345 +vt 0.244305 0.751007 +vt 0.124436 0.751007 +vt 0.009233 0.751007 +vt 0.206950 0.295168 +vt 0.048423 0.459689 +vt 0.013471 0.379548 +vt 0.045426 0.298165 +vt 0.048585 0.459506 +vt 0.125867 0.262680 +vt 0.130113 0.491518 +vt 0.013572 0.379222 +vt 0.045583 0.297694 +vt 0.210398 0.456504 +vt 0.242409 0.374976 +vt 0.207395 0.294691 +vt 0.244305 0.570947 +vt 0.244305 0.995127 +vt 0.009233 0.995127 vt 0.209947 0.456692 vt 0.125567 0.263214 vt 0.241901 0.375309 @@ -221,236 +264,322 @@ vt 0.957847 0.838556 vt 0.987860 0.694744 vt 0.263605 0.787894 vt 0.744476 0.273333 -s 1 -usemtl b -f 59/1 53/2 57/3 -f 53/2 59/1 61/4 -f 66/5 49/6 65/7 -f 65/7 63/8 72/9 -f 65/7 64/10 50/11 -f 65/7 52/12 66/5 -f 66/5 54/13 67/14 -f 53/15 66/5 67/14 -f 55/16 67/17 68/18 -f 67/17 56/19 68/18 -f 68/18 58/20 69/21 -f 57/22 68/18 69/21 -f 69/21 60/23 70/24 -f 59/25 69/21 70/24 -f 61/26 70/24 71/27 -f 61/26 72/9 63/8 -f 62/28 72/9 71/27 -f 71/27 60/23 62/28 -f 53/2 55/29 57/3 -f 61/4 63/30 53/2 -f 63/30 49/31 53/2 -f 49/31 51/32 53/2 -f 60/33 54/34 62/35 -f 60/33 58/36 54/34 -f 54/34 58/36 56/37 -f 62/35 54/34 64/38 -f 64/38 54/34 50/39 -f 52/40 50/39 54/34 -f 66/5 51/41 49/6 -f 65/7 49/6 63/8 -f 65/7 72/9 64/10 -f 65/7 50/11 52/12 -f 66/5 52/12 54/13 -f 53/15 51/41 66/5 -f 55/16 53/42 67/17 -f 67/17 54/43 56/19 -f 68/18 56/19 58/20 -f 57/22 55/16 68/18 -f 69/21 58/20 60/23 -f 59/25 57/22 69/21 -f 61/26 59/25 70/24 -f 61/26 71/27 72/9 -f 62/28 64/10 72/9 -f 71/27 70/24 60/23 -f 83/1 77/2 81/3 -f 77/2 83/1 85/4 -f 90/5 73/6 89/7 -f 89/7 87/8 96/9 -f 89/7 88/10 74/11 -f 89/7 76/12 90/5 -f 90/5 78/13 91/14 -f 77/15 90/5 91/14 -f 79/16 91/17 92/18 -f 91/17 80/19 92/18 -f 92/18 82/20 93/21 -f 81/22 92/18 93/21 -f 93/21 84/23 94/24 -f 83/25 93/21 94/24 -f 85/26 94/24 95/27 -f 85/26 96/9 87/8 -f 86/28 96/9 95/27 -f 95/27 84/23 86/28 -f 77/2 79/29 81/3 -f 85/4 87/30 77/2 -f 87/30 73/31 77/2 -f 73/31 75/32 77/2 -f 84/33 78/34 86/35 -f 84/33 82/36 78/34 -f 78/34 82/36 80/37 -f 86/35 78/34 88/38 -f 88/38 78/34 74/39 -f 76/40 74/39 78/34 -f 90/5 75/41 73/6 -f 89/7 73/6 87/8 -f 89/7 96/9 88/10 -f 89/7 74/11 76/12 -f 90/5 76/12 78/13 -f 77/15 75/41 90/5 -f 79/16 77/42 91/17 -f 91/17 78/43 80/19 -f 92/18 80/19 82/20 -f 81/22 79/16 92/18 -f 93/21 82/20 84/23 -f 83/25 81/22 93/21 -f 85/26 83/25 94/24 -f 85/26 95/27 96/9 -f 86/28 88/10 96/9 -f 95/27 94/24 84/23 -usemtl a -f 97/44 99/45 100/46 -f 99/45 101/47 102/48 -f 108/49 110/50 122/51 -f 119/52 107/53 121/54 -f 102/48 103/55 100/46 -f 119/52 115/56 105/57 -f 122/58 121/54 108/59 -f 101/47 99/45 105/60 -f 115/56 116/61 101/62 -f 104/63 103/64 118/65 -f 104/63 120/66 106/67 -f 110/68 108/69 105/60 -f 103/55 109/70 100/46 -f 100/46 109/70 98/71 -f 109/72 110/50 98/73 -f 104/74 106/75 103/55 -f 109/70 103/55 106/75 -f 105/60 99/45 110/68 -f 99/45 97/44 110/68 -f 107/76 105/60 108/69 -f 103/64 102/77 117/78 -f 123/79 106/80 120/81 -f 124/82 109/72 123/79 -f 97/83 98/73 110/50 -f 111/84 112/85 114/86 -f 113/87 114/86 116/88 -f 110/50 124/82 122/51 -f 107/53 119/52 105/57 -f 116/88 114/86 117/89 -f 101/62 105/57 115/56 -f 121/54 107/53 108/59 -f 115/90 119/91 113/87 -f 102/77 101/62 116/61 -f 118/65 103/64 117/78 -f 120/66 104/63 118/65 -f 124/92 119/91 122/93 -f 117/89 114/86 123/94 -f 114/86 112/85 123/94 -f 123/79 112/95 124/82 -f 118/96 117/89 120/97 -f 123/94 120/97 117/89 -f 119/91 124/92 113/87 -f 113/87 124/92 111/84 -f 121/98 122/93 119/91 -f 116/61 117/78 102/77 -f 110/50 109/72 124/82 -f 123/79 109/72 106/80 -f 111/99 124/82 112/95 -f 97/44 100/46 98/71 -f 99/45 102/48 100/46 -f 111/84 114/86 113/87 -f 113/87 116/88 115/90 -usemtl c -f 11/1 5/2 9/3 -f 5/2 11/1 13/4 -f 18/5 1/6 17/7 -f 17/7 15/8 24/9 -f 17/7 16/10 2/11 -f 17/7 4/12 18/5 -f 18/5 6/13 19/14 -f 5/15 18/5 19/14 -f 7/16 19/17 20/18 -f 19/17 8/19 20/18 -f 20/18 10/20 21/21 -f 9/22 20/18 21/21 -f 21/21 12/23 22/24 -f 11/25 21/21 22/24 -f 13/26 22/24 23/27 -f 13/26 24/9 15/8 -f 14/28 24/9 23/27 -f 23/27 12/23 14/28 -f 5/2 7/29 9/3 -f 13/4 15/30 5/2 -f 15/30 1/31 5/2 -f 1/31 3/32 5/2 -f 12/33 6/34 14/35 -f 12/33 10/36 6/34 -f 6/34 10/36 8/37 -f 14/35 6/34 16/38 -f 16/38 6/34 2/39 -f 4/40 2/39 6/34 -f 18/5 3/41 1/6 -f 17/7 1/6 15/8 -f 17/7 24/9 16/10 -f 17/7 2/11 4/12 -f 18/5 4/12 6/13 -f 5/15 3/41 18/5 -f 7/16 5/42 19/17 -f 19/17 6/43 8/19 -f 20/18 8/19 10/20 -f 9/22 7/16 20/18 -f 21/21 10/20 12/23 -f 11/25 9/22 21/21 -f 13/26 11/25 22/24 -f 13/26 23/27 24/9 -f 14/28 16/10 24/9 -f 23/27 22/24 12/23 +vt 0.209947 0.456692 +vt 0.125567 0.263214 +vt 0.241901 0.375309 +vt 0.129805 0.491643 +vt 0.124436 0.570947 +vt 0.244305 0.631444 +vt 0.124436 0.631444 +vt 0.244305 0.690874 +vt 0.124436 0.690874 +vt 0.009233 0.690874 +vt 0.009233 0.631444 +vt 0.009233 0.570947 +vt 0.009233 0.508357 +vt 0.124436 0.508357 +vt 0.244305 0.508357 +vt 0.244305 0.932575 +vt 0.124436 0.995127 +vt 0.124436 0.932575 +vt 0.009233 0.932575 +vt 0.009233 0.871660 +vt 0.124436 0.871660 +vt 0.244305 0.871660 +vt 0.009233 0.811345 +vt 0.124436 0.811345 +vt 0.244305 0.811345 +vt 0.244305 0.751007 +vt 0.124436 0.751007 +vt 0.009233 0.751007 +vt 0.206950 0.295168 +vt 0.048423 0.459689 +vt 0.013471 0.379548 +vt 0.045426 0.298165 +vt 0.048585 0.459506 +vt 0.125867 0.262680 +vt 0.130113 0.491518 +vt 0.013572 0.379222 +vt 0.045583 0.297694 +vt 0.210398 0.456504 +vt 0.242409 0.374976 +vt 0.207395 0.294691 +vt 0.244305 0.570947 +vt 0.244305 0.995127 +vt 0.009233 0.995127 +vt 0.209947 0.456692 +vt 0.125567 0.263214 +vt 0.241901 0.375309 +vt 0.129805 0.491643 +vt 0.124436 0.570947 +vt 0.244305 0.631444 +vt 0.124436 0.631444 +vt 0.244305 0.690874 +vt 0.124436 0.690874 +vt 0.009233 0.690874 +vt 0.009233 0.631444 +vt 0.009233 0.570947 +vt 0.009233 0.508357 +vt 0.124436 0.508357 +vt 0.244305 0.508357 +vt 0.244305 0.932575 +vt 0.124436 0.995127 +vt 0.124436 0.932575 +vt 0.009233 0.932575 +vt 0.009233 0.871660 +vt 0.124436 0.871660 +vt 0.244305 0.871660 +vt 0.009233 0.811345 +vt 0.124436 0.811345 +vt 0.244305 0.811345 +vt 0.244305 0.751007 +vt 0.124436 0.751007 +vt 0.009233 0.751007 +vt 0.206950 0.295168 +vt 0.048423 0.459689 +vt 0.013471 0.379548 +vt 0.045426 0.298165 +vt 0.048585 0.459506 +vt 0.125867 0.262680 +vt 0.130113 0.491518 +vt 0.013572 0.379222 +vt 0.045583 0.297694 +vt 0.210398 0.456504 +vt 0.242409 0.374976 +vt 0.207395 0.294691 +vt 0.244305 0.570947 +vt 0.244305 0.995127 +vt 0.009233 0.995127 usemtl d -f 35/1 29/2 33/3 -f 29/2 35/1 37/4 -f 42/5 25/6 41/7 -f 41/7 39/8 48/9 -f 41/7 40/10 26/11 -f 41/7 28/12 42/5 -f 42/5 30/13 43/14 -f 29/15 42/5 43/14 -f 31/16 43/17 44/18 -f 43/17 32/19 44/18 -f 44/18 34/20 45/21 -f 33/22 44/18 45/21 -f 45/21 36/23 46/24 -f 35/25 45/21 46/24 -f 37/26 46/24 47/27 -f 37/26 48/9 39/8 -f 38/28 48/9 47/27 -f 47/27 36/23 38/28 -f 29/2 31/29 33/3 -f 37/4 39/30 29/2 -f 39/30 25/31 29/2 -f 25/31 27/32 29/2 -f 36/33 30/34 38/35 -f 36/33 34/36 30/34 -f 30/34 34/36 32/37 -f 38/35 30/34 40/38 -f 40/38 30/34 26/39 -f 28/40 26/39 30/34 -f 42/5 27/41 25/6 -f 41/7 25/6 39/8 -f 41/7 48/9 40/10 -f 41/7 26/11 28/12 -f 42/5 28/12 30/13 -f 29/15 27/41 42/5 -f 31/16 29/42 43/17 -f 43/17 30/43 32/19 -f 44/18 32/19 34/20 -f 33/22 31/16 44/18 -f 45/21 34/20 36/23 -f 35/25 33/22 45/21 -f 37/26 35/25 46/24 -f 37/26 47/27 48/9 -f 38/28 40/10 48/9 -f 47/27 46/24 36/23 +s 1 +f 101/1 102/2 103/3 +f 102/2 101/1 104/4 +f 105/5 106/6 107/7 +f 107/7 108/8 109/9 +f 107/7 110/10 111/11 +f 107/7 112/12 105/5 +f 105/5 113/13 114/14 +f 102/15 105/5 114/14 +f 115/16 114/17 116/18 +f 114/17 117/19 116/18 +f 116/18 118/20 119/21 +f 103/22 116/18 119/21 +f 119/21 120/23 121/24 +f 101/25 119/21 121/24 +f 104/26 121/24 122/27 +f 104/26 109/9 108/8 +f 123/28 109/9 122/27 +f 122/27 120/23 123/28 +f 102/2 115/29 103/3 +f 104/4 108/30 102/2 +f 108/30 106/31 102/2 +f 106/31 124/32 102/2 +f 120/33 113/34 123/35 +f 120/33 118/36 113/34 +f 113/34 118/36 117/37 +f 123/35 113/34 110/38 +f 110/38 113/34 111/39 +f 112/40 111/39 113/34 +f 105/5 124/41 106/6 +f 107/7 106/6 108/8 +f 107/7 109/9 110/10 +f 107/7 111/11 112/12 +f 105/5 112/12 113/13 +f 102/15 124/41 105/5 +f 115/16 102/42 114/17 +f 114/17 113/43 117/19 +f 116/18 117/19 118/20 +f 103/22 115/16 116/18 +f 119/21 118/20 120/23 +f 101/25 103/22 119/21 +f 104/26 101/25 121/24 +f 104/26 122/27 109/9 +f 123/28 110/10 109/9 +f 122/27 121/24 120/23 +usemtl c +f 77/44 78/45 79/46 +f 78/45 77/44 80/47 +f 81/48 82/49 83/50 +f 83/50 84/51 85/52 +f 83/50 86/53 87/54 +f 83/50 88/55 81/48 +f 81/48 89/56 90/57 +f 78/58 81/48 90/57 +f 91/59 90/60 92/61 +f 90/60 93/62 92/61 +f 92/61 94/63 95/64 +f 79/65 92/61 95/64 +f 95/64 96/66 97/67 +f 77/68 95/64 97/67 +f 80/69 97/67 98/70 +f 80/69 85/52 84/51 +f 99/71 85/52 98/70 +f 98/70 96/66 99/71 +f 78/45 91/72 79/46 +f 80/47 84/73 78/45 +f 84/73 82/74 78/45 +f 82/74 100/75 78/45 +f 96/76 89/77 99/78 +f 96/76 94/79 89/77 +f 89/77 94/79 93/80 +f 99/78 89/77 86/81 +f 86/81 89/77 87/82 +f 88/83 87/82 89/77 +f 81/48 100/84 82/49 +f 83/50 82/49 84/51 +f 83/50 85/52 86/53 +f 83/50 87/54 88/55 +f 81/48 88/55 89/56 +f 78/58 100/84 81/48 +f 91/59 78/85 90/60 +f 90/60 89/86 93/62 +f 92/61 93/62 94/63 +f 79/65 91/59 92/61 +f 95/64 94/63 96/66 +f 77/68 79/65 95/64 +f 80/69 77/68 97/67 +f 80/69 98/70 85/52 +f 99/71 86/53 85/52 +f 98/70 97/67 96/66 +usemtl a +f 49/87 50/88 51/89 +f 50/88 52/90 53/91 +f 54/92 55/93 56/94 +f 57/95 58/96 59/97 +f 53/91 60/98 51/89 +f 57/95 61/99 62/100 +f 56/101 59/97 54/102 +f 52/90 50/88 62/103 +f 61/99 63/104 52/105 +f 64/106 60/107 65/108 +f 64/106 66/109 67/110 +f 55/111 54/112 62/103 +f 60/98 68/113 51/89 +f 51/89 68/113 69/114 +f 68/115 55/93 69/116 +f 64/117 67/118 60/98 +f 68/113 60/98 67/118 +f 62/103 50/88 55/111 +f 50/88 49/87 55/111 +f 58/119 62/103 54/112 +f 60/107 53/120 70/121 +f 71/122 67/123 66/124 +f 72/125 68/115 71/122 +f 49/126 69/116 55/93 +f 73/127 74/128 75/129 +f 76/130 75/129 63/131 +f 55/93 72/125 56/94 +f 58/96 57/95 62/100 +f 63/131 75/129 70/132 +f 52/105 62/100 61/99 +f 59/97 58/96 54/102 +f 61/133 57/134 76/130 +f 53/120 52/105 63/104 +f 65/108 60/107 70/121 +f 66/109 64/106 65/108 +f 72/135 57/134 56/136 +f 70/132 75/129 71/137 +f 75/129 74/128 71/137 +f 71/122 74/138 72/125 +f 65/139 70/132 66/140 +f 71/137 66/140 70/132 +f 57/134 72/135 76/130 +f 76/130 72/135 73/127 +f 59/141 56/136 57/134 +f 63/104 70/121 53/120 +f 55/93 68/115 72/125 +f 71/122 68/115 67/123 +f 73/142 72/125 74/138 +f 49/87 51/89 69/114 +f 50/88 53/91 51/89 +f 73/127 75/129 76/130 +f 76/130 63/131 61/133 +usemtl b +f 1/143 2/144 3/145 +f 2/144 1/143 4/146 +f 5/147 6/148 7/149 +f 7/149 8/150 9/151 +f 7/149 10/152 11/153 +f 7/149 12/154 5/147 +f 5/147 13/155 14/156 +f 2/157 5/147 14/156 +f 15/158 14/159 16/160 +f 14/159 17/161 16/160 +f 16/160 18/162 19/163 +f 3/164 16/160 19/163 +f 19/163 20/165 21/166 +f 1/167 19/163 21/166 +f 4/168 21/166 22/169 +f 4/168 9/151 8/150 +f 23/170 9/151 22/169 +f 22/169 20/165 23/170 +f 2/144 15/171 3/145 +f 4/146 8/172 2/144 +f 8/172 6/173 2/144 +f 6/173 24/174 2/144 +f 20/175 13/176 23/177 +f 20/175 18/178 13/176 +f 13/176 18/178 17/179 +f 23/177 13/176 10/180 +f 10/180 13/176 11/181 +f 12/182 11/181 13/176 +f 5/147 24/183 6/148 +f 7/149 6/148 8/150 +f 7/149 9/151 10/152 +f 7/149 11/153 12/154 +f 5/147 12/154 13/155 +f 2/157 24/183 5/147 +f 15/158 2/184 14/159 +f 14/159 13/185 17/161 +f 16/160 17/161 18/162 +f 3/164 15/158 16/160 +f 19/163 18/162 20/165 +f 1/167 3/164 19/163 +f 4/168 1/167 21/166 +f 4/168 22/169 9/151 +f 23/170 10/152 9/151 +f 22/169 21/166 20/165 +f 25/186 26/187 27/188 +f 26/187 25/186 28/189 +f 29/190 30/191 31/192 +f 31/192 32/193 33/194 +f 31/192 34/195 35/196 +f 31/192 36/197 29/190 +f 29/190 37/198 38/199 +f 26/200 29/190 38/199 +f 39/201 38/202 40/203 +f 38/202 41/204 40/203 +f 40/203 42/205 43/206 +f 27/207 40/203 43/206 +f 43/206 44/208 45/209 +f 25/210 43/206 45/209 +f 28/211 45/209 46/212 +f 28/211 33/194 32/193 +f 47/213 33/194 46/212 +f 46/212 44/208 47/213 +f 26/187 39/214 27/188 +f 28/189 32/215 26/187 +f 32/215 30/216 26/187 +f 30/216 48/217 26/187 +f 44/218 37/219 47/220 +f 44/218 42/221 37/219 +f 37/219 42/221 41/222 +f 47/220 37/219 34/223 +f 34/223 37/219 35/224 +f 36/225 35/224 37/219 +f 29/190 48/226 30/191 +f 31/192 30/191 32/193 +f 31/192 33/194 34/195 +f 31/192 35/196 36/197 +f 29/190 36/197 37/198 +f 26/200 48/226 29/190 +f 39/201 26/227 38/202 +f 38/202 37/228 41/204 +f 40/203 41/204 42/205 +f 27/207 39/201 40/203 +f 43/206 42/205 44/208 +f 25/210 27/207 43/206 +f 28/211 25/210 45/209 +f 28/211 46/212 33/194 +f 47/213 34/195 33/194 +f 46/212 45/209 44/208 diff --git a/game.h b/game.h index f8c4500..8dd47ca 100644 --- a/game.h +++ b/game.h @@ -21,9 +21,7 @@ COORDINATE SYSTEM AND ROTATIONS: The game itself (racing module) is independent of rendering and physics libraries, but out of convenient adopts their coordinate system (X right, Y up, Z forward) and rotations (Euler - angles, by Z, then by X, then Y). - - + angles, by Z, then by X, then Y). */ #ifndef _LCR_GAME_H @@ -206,6 +204,7 @@ LCR_GameUnit physicsInterpolationParam = LCR_GAME_UNIT - LCR_GameUnit carTransform[6]; LCR_racingGetCarTransform(carTransform,carTransform + 3, physicsInterpolationParam); + LCR_rendererSetCarTransform(carTransform,carTransform + 3); while (time >= LCR_game.nextRenderFrameTime) @@ -248,6 +247,11 @@ LCR_GameUnit physicsInterpolationParam = LCR_GAME_UNIT - else LCR_rendererCameraFollow(); +#if LCR_ANIMATE_CAR + LCR_rendererSetWheelState(LCR_racingGetWheelRotation(), + LCR_racingGetWheelSteer()); +#endif + LCR_rendererDraw(); if (LCR_game.debugDraw) diff --git a/racing.h b/racing.h index 1b0389b..90ea00c 100644 --- a/racing.h +++ b/racing.h @@ -22,10 +22,11 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit #define LCR_CAR_JOINTS 5 #define LCR_CAR_CONNECTIONS 10 -#define LCR_GRAVITY 5 +#define LCR_GRAVITY (LCR_PHYSICS_UNIT / 100) #define LCR_CAR_FORWARD_FRICTION TPE_F / 14 #define LCR_CAR_TURN_FRICTION (3 * TPE_F / 4) #define LCR_CAR_ELASTICITY (TPE_F / 100) +#define LCR_CAR_ACCELERATION (LCR_PHYSICS_UNIT / 8) struct { @@ -41,6 +42,8 @@ struct TPE_Vec3 carPositions[2]; ///* Current and previous position. + LCR_GameUnit wheelRotation; + LCR_GameUnit wheelSteer; } LCR_racing; TPE_Vec3 _LCR_TPE_vec3DividePlain(TPE_Vec3 v, TPE_Unit d) @@ -53,12 +56,22 @@ TPE_Vec3 _LCR_TPE_vec3DividePlain(TPE_Vec3 v, TPE_Unit d) TPE_Vec3 _LCR_racingEnvironmentFunction(TPE_Vec3 point, TPE_Unit maxDist) { + return TPE_envAABoxInside(point,TPE_vec3(0,0,0),TPE_vec3( LCR_PHYSICS_UNIT * LCR_MAP_SIZE_BLOCKS, (LCR_PHYSICS_UNIT * LCR_MAP_SIZE_BLOCKS) / 2, LCR_PHYSICS_UNIT * LCR_MAP_SIZE_BLOCKS)); } +LCR_GameUnit LCR_racingGetCarSpeed(void) +{ + return (TPE_vec3Len(TPE_vec3( + LCR_racing.carBody.joints[4].velocity[0], + LCR_racing.carBody.joints[4].velocity[1], + LCR_racing.carBody.joints[4].velocity[2])) * LCR_GAME_UNIT) + / LCR_PHYSICS_UNIT; +} + uint8_t _LCR_racingCollisionHandler(uint16_t b1, uint16_t j1, uint16_t b2, uint16_t j2, TPE_Vec3 p) { @@ -75,8 +88,11 @@ uint8_t _LCR_racingCollisionHandler(uint16_t b1, uint16_t j1, uint16_t b2, */ void LCR_racingRestart(void) { + TPE_bodyActivate(&(LCR_racing.carBody)); LCR_racing.wheelCollisions = 0; - TPE_bodyDeactivate(&(LCR_racing.carBody)); + + LCR_racing.wheelRotation = 0; + LCR_racing.wheelSteer = 0; // TODO } @@ -111,6 +127,7 @@ void LCR_racingInit(void) LCR_racing.carBody.friction = LCR_CAR_FORWARD_FRICTION; LCR_racing.carBody.elasticity = LCR_CAR_ELASTICITY; + LCR_racing.carBody.flags |= TPE_BODY_FLAG_ALWAYS_ACTIVE; LCR_racingRestart(); } @@ -144,7 +161,6 @@ void LCR_racingGetCarTransform(LCR_GameUnit position[3], rotation[0] = (v.x * LCR_GAME_UNIT) / TPE_F; rotation[1] = (v.y * LCR_GAME_UNIT) / TPE_F; rotation[2] = (v.z * LCR_GAME_UNIT) / TPE_F; - // TODO: also smooth out rotation? } @@ -166,48 +182,93 @@ int LCR_racingCarWheelTouchesGround(int wheel) return ((LCR_racing.wheelCollisions & (LCR_racing.wheelCollisions >> 4)) >> wheel) & 0x01; } + +LCR_GameUnit LCR_racingGetWheelRotation(void) +{ + return LCR_racing.wheelRotation; +} + +LCR_GameUnit LCR_racingGetWheelSteer(void) +{ + return LCR_racing.wheelSteer; +} + +void _LCR_racingWheelAccelerate(unsigned int wheel, TPE_Vec3 dir) +{ + LCR_racing.carBody.joints[wheel].velocity[0] += + (dir.x * LCR_CAR_ACCELERATION) / TPE_F; + LCR_racing.carBody.joints[wheel].velocity[1] += + (dir.y * LCR_CAR_ACCELERATION) / TPE_F; + LCR_racing.carBody.joints[wheel].velocity[2] += + (dir.z * LCR_CAR_ACCELERATION) / TPE_F; +} void LCR_racingStep(unsigned int input) { TPE_Vec3 carForw, carRight, carUp; - TPE_Vec3 vel = TPE_vec3(0,0,0); +// TPE_Vec3 vel = TPE_vec3(0,0,0); + + carForw = TPE_vec3Normalized(TPE_vec3Plus( + TPE_vec3Minus(LCR_racing.carBody.joints[0].position, + LCR_racing.carBody.joints[2].position), + TPE_vec3Minus(LCR_racing.carBody.joints[1].position, + LCR_racing.carBody.joints[3].position))); + + carRight = TPE_vec3Normalized(TPE_vec3Plus( + TPE_vec3Minus(LCR_racing.carBody.joints[0].position, + LCR_racing.carBody.joints[1].position), + TPE_vec3Minus(LCR_racing.carBody.joints[2].position, + LCR_racing.carBody.joints[3].position))); + + carUp = TPE_vec3Cross(carForw,carRight); if (input) { + // TODO: magic constants if (input & LCR_RACING_INPUT_FORW) - vel.y = LCR_PHYSICS_UNIT / 8; - + LCR_racing.wheelRotation = + (LCR_racing.wheelRotation + 5) % LCR_GAME_UNIT; + if (input & LCR_RACING_INPUT_BACK) - vel.z = LCR_PHYSICS_UNIT / 32; + LCR_racing.wheelRotation -= 4; + + while (LCR_racing.wheelRotation < 0) + LCR_racing.wheelRotation += LCR_GAME_UNIT; if (input & LCR_RACING_INPUT_RIGHT) - vel.x = LCR_PHYSICS_UNIT / 32; - - if (input & LCR_RACING_INPUT_LEFT) - vel.x = -1 * LCR_PHYSICS_UNIT / 32; + LCR_racing.wheelSteer = TPE_min( + LCR_racing.wheelSteer + 64,LCR_GAME_UNIT / 2); - TPE_bodyAccelerate(&(LCR_racing.carBody),vel); + if (input & LCR_RACING_INPUT_LEFT) + LCR_racing.wheelSteer = TPE_max( + LCR_racing.wheelSteer - 64,-1 * LCR_GAME_UNIT / 2); + + if ((LCR_racing.wheelCollisions & 0x03) == 0x03) // back wheels on gr.? + { + if (input & LCR_RACING_INPUT_FORW) + { + _LCR_racingWheelAccelerate(0,carForw); + _LCR_racingWheelAccelerate(1,carForw); + } + else if (input & LCR_RACING_INPUT_BACK) + { + _LCR_racingWheelAccelerate(0,TPE_vec3TimesPlain(carForw,-1)); + _LCR_racingWheelAccelerate(1,TPE_vec3TimesPlain(carForw,-1)); + } + } } - TPE_bodyApplyGravity(&(LCR_racing.carBody),LCR_GRAVITY); + if ((!(input & LCR_RACING_INPUT_LEFT)) && + (!(input & LCR_RACING_INPUT_RIGHT))) + LCR_racing.wheelSteer /= 2; + + + if ((LCR_racing.wheelCollisions & 0x0f) != 0x0f) // EXPERIMENTAL: don't apply gravity with all wheels on ground + TPE_bodyApplyGravity(&(LCR_racing.carBody),LCR_GRAVITY); LCR_racing.wheelCollisions <<= 4; TPE_worldStep(&(LCR_racing.physicsWorld)); - carForw = TPE_vec3Normalized(TPE_vec3Plus( - TPE_vec3Minus(LCR_racing.carBody.joints[2].position, - LCR_racing.carBody.joints[0].position), - TPE_vec3Minus(LCR_racing.carBody.joints[3].position, - LCR_racing.carBody.joints[1].position))); - - carRight = TPE_vec3Normalized(TPE_vec3Plus( - TPE_vec3Minus(LCR_racing.carBody.joints[1].position, - LCR_racing.carBody.joints[0].position), - TPE_vec3Minus(LCR_racing.carBody.joints[3].position, - LCR_racing.carBody.joints[2].position))); - - carUp = TPE_vec3Cross(carForw,carRight); - if (TPE_vec3Dot(carUp,TPE_vec3Minus(LCR_racing.carBody.joints[4].position, LCR_racing.carBody.joints[0].position)) < 0) { diff --git a/renderer.h b/renderer.h index 8212702..fca8474 100644 --- a/renderer.h +++ b/renderer.h @@ -74,7 +74,7 @@ struct #if LCR_ANIMATE_CAR S3L_Unit wheelRotation; - S3L_Unit wheelTurn; + S3L_Unit wheelSteer; S3L_Unit wheelRotationCenters[4]; S3L_Unit animatedCarVerts[LCR_CAR_VERTEX_COUNT * 3]; #endif @@ -828,7 +828,7 @@ LCR_renderer.ghostModel->transform.translation.x -= LCR_GAME_UNIT / 4; LCR_renderer.wheelRotationCenters[3] /= count[1]; LCR_renderer.wheelRotation = 0; - LCR_renderer.wheelTurn = 0; + LCR_renderer.wheelSteer = 0; #endif S3L_sceneInit( @@ -1280,8 +1280,8 @@ void _LCR_rendererAnimateCar(void) { if (LCR_carVertexTypes[i] > 0) { - S3L_Unit s = S3L_sin(-1 * LCR_renderer.wheelRotation), - c = S3L_cos(-1 * LCR_renderer.wheelRotation); + S3L_Unit s = S3L_sin(LCR_renderer.wheelRotation), + c = S3L_cos(LCR_renderer.wheelRotation); S3L_Unit v[2], tmp; @@ -1302,19 +1302,19 @@ void _LCR_rendererAnimateCar(void) LCR_renderer.animatedCarVerts[index + 1] = v[1] + LCR_renderer.wheelRotationCenters[offset + 1]; - if (LCR_carVertexTypes[i] > 1) + if (LCR_carVertexTypes[i] == 1) { /* Turn front wheels; this is not real turning but just a fake by skewing in Z and X directions. */ LCR_renderer.animatedCarVerts[index] = LCR_carVertices[index]; LCR_renderer.animatedCarVerts[index + 2] -= - (LCR_renderer.animatedCarVerts[index] * LCR_renderer.wheelTurn) + (LCR_renderer.animatedCarVerts[index] * LCR_renderer.wheelSteer) / (8 * S3L_F); LCR_renderer.animatedCarVerts[index] += ((LCR_renderer.animatedCarVerts[index + 2] - - LCR_renderer.wheelRotationCenters[0]) * LCR_renderer.wheelTurn) + LCR_renderer.wheelRotationCenters[2]) * LCR_renderer.wheelSteer) / (2 * S3L_F); } } @@ -1353,8 +1353,19 @@ void LCR_rendererCameraFollow(void) LCR_renderer.carModel->transform.translation.z + LCR_SETTING_CAMERA_MAX_DISTANCE * LCR_RENDERER_UNIT / 4); - S3L_lookAt(LCR_renderer.carModel->transform.translation, - &(LCR_renderer.scene.camera.transform)); + /* Hotfix for a Gimbal lock kinda issue, don't do lookAt when completely + above the car, rather shift the camera a bit (needs some tuning). */ + if (S3L_abs(LCR_renderer.scene.camera.transform.translation.x - + LCR_renderer.carModel->transform.translation.x) > 8 && + S3L_abs(LCR_renderer.scene.camera.transform.translation.z - + LCR_renderer.carModel->transform.translation.z) > 8) + S3L_lookAt(LCR_renderer.carModel->transform.translation, + &(LCR_renderer.scene.camera.transform)); + else + { + LCR_renderer.scene.camera.transform.translation.x += 4; + LCR_renderer.scene.camera.transform.translation.z -= 8; + } #if LCR_SETTING_SMOOTH_ANIMATIONS // now average with previous transform to smooth the animation out: @@ -1368,10 +1379,18 @@ void LCR_rendererCameraFollow(void) transPrev.rotation.x -= LCR_renderer.scene.camera.transform.rotation.x; transPrev.rotation.y -= LCR_renderer.scene.camera.transform.rotation.y; - if (S3L_abs(transPrev.rotation.x) < S3L_F / 4) - LCR_renderer.scene.camera.transform.rotation.x += transPrev.rotation.x / 2; + if (S3L_abs(transPrev.rotation.y) < S3L_F / 5) + LCR_renderer.scene.camera.transform.rotation.y += transPrev.rotation.y / 2; - LCR_renderer.scene.camera.transform.rotation.y += transPrev.rotation.y / 2; + LCR_renderer.scene.camera.transform.rotation.x += transPrev.rotation.x / 2; +#endif +} + +void LCR_rendererSetWheelState(LCR_GameUnit rotation, LCR_GameUnit steer) +{ +#if LCR_ANIMATE_CAR + LCR_renderer.wheelRotation = rotation; + LCR_renderer.wheelSteer = steer; #endif } @@ -1379,19 +1398,16 @@ void LCR_rendererDraw(void) { LCR_renderer.previousTriID = -1; S3L_newFrame(); + +#if LCR_ANIMATE_CAR + _LCR_rendererAnimateCar(); +#endif _LCR_rendererLoadMapChunks(); // TODO: call only once in a while? LCR_rendererDrawSky(1, LCR_renderer.scene.camera.transform.rotation.y, -4 * LCR_renderer.scene.camera.transform.rotation.x); - -#if LCR_ANIMATE_CAR -LCR_renderer.wheelRotation += 5; -LCR_renderer.wheelTurn = S3L_sin(LCR_renderer.frame * 4); - - _LCR_rendererAnimateCar(); -#endif LCR_drawLevelFloor(); LCR_rendererDrawLOD();