diff --git a/assets/models/DefaultMesh.obj b/assets/models/DefaultMesh.obj new file mode 100644 index 0000000..c786c1e --- /dev/null +++ b/assets/models/DefaultMesh.obj @@ -0,0 +1,46 @@ +# Blender v2.76 (sub 0) OBJ File: '' +# www.blender.org +mtllib cube.mtl +o Cube +v 1.000000 -1.000000 -1.000000 +v 1.000000 -1.000000 1.000000 +v -1.000000 -1.000000 1.000000 +v -1.000000 -1.000000 -1.000000 +v 1.000000 1.000000 -0.999999 +v 0.999999 1.000000 1.000001 +v -1.000000 1.000000 1.000000 +v -1.000000 1.000000 -1.000000 +vt 1.000000 0.333333 +vt 1.000000 0.666667 +vt 0.666667 0.666667 +vt 0.666667 0.333333 +vt 0.666667 0.000000 +vt 0.000000 0.333333 +vt 0.000000 0.000000 +vt 0.333333 0.000000 +vt 0.333333 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.666667 +vt 0.333333 0.333333 +vt 0.333333 0.666667 +vt 1.000000 0.000000 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 1.000000 0.000000 +vn 1.000000 0.000000 0.000000 +vn -0.000000 0.000000 1.000000 +vn -1.000000 -0.000000 -0.000000 +vn 0.000000 0.000000 -1.000000 +usemtl Material +s off +f 2/1/1 3/2/1 4/3/1 +f 8/1/2 7/4/2 6/5/2 +f 5/6/3 6/7/3 2/8/3 +f 6/8/4 7/5/4 3/4/4 +f 3/9/5 7/10/5 8/11/5 +f 1/12/6 4/13/6 8/11/6 +f 1/4/1 2/1/1 4/3/1 +f 5/14/2 8/1/2 6/5/2 +f 1/12/3 5/6/3 2/8/3 +f 2/12/4 6/8/4 3/4/4 +f 4/13/5 3/9/5 8/11/5 +f 5/6/6 1/12/6 8/11/6 \ No newline at end of file diff --git a/assets/models/kenney_mini-market.zip b/assets/models/kenney_mini-market.zip new file mode 100644 index 0000000..b8b8e05 Binary files /dev/null and b/assets/models/kenney_mini-market.zip differ diff --git a/assets/models/p8tjioka3rwg-OutSidePlant.rar b/assets/models/p8tjioka3rwg-OutSidePlant.rar deleted file mode 100644 index 0237d81..0000000 Binary files a/assets/models/p8tjioka3rwg-OutSidePlant.rar and /dev/null differ diff --git a/assets/models/shopping-cart.mtl b/assets/models/shopping-cart.mtl new file mode 100644 index 0000000..8935e47 --- /dev/null +++ b/assets/models/shopping-cart.mtl @@ -0,0 +1,6 @@ +# Created by Kenney (www.kenney.nl) + +newmtl colormap +Kd 1 1 1 +map_Kd variation-a.png + diff --git a/assets/models/shopping-cart.obj b/assets/models/shopping-cart.obj new file mode 100644 index 0000000..a1da2f8 --- /dev/null +++ b/assets/models/shopping-cart.obj @@ -0,0 +1,1092 @@ +# Created by Kenney (www.kenney.nl) + +mtllib shopping-cart.mtl + +g shopping-cart + +v 0.075 0.072 0.125 1 1 1 +v 0.075 0.072 -0.175 1 1 1 +v -0.075 0.072 0.125 1 1 1 +v -0.075 0.072 -0.175 1 1 1 +v -0.075 0.122 -0.175 1 1 1 +v -0.075 0.122 -0.125 1 1 1 +v -0.075 0.122 0.125 1 1 1 +v -0.075 0.222 -0.15 1 1 1 +v -0.075 0.222 -0.125 1 1 1 +v 0.075 0.122 -0.175 1 1 1 +v 0.075 0.222 -0.15 1 1 1 +v 0.075 0.122 -0.125 1 1 1 +v 0.075 0.222 -0.125 1 1 1 +v 0.075 0.122 0.125 1 1 1 +v 0.125 0.05688 0.06812 1 1 1 +v 0.125 0.01665977 0.08477977 1 1 1 +v 0.125 0.09710023 0.08477977 1 1 1 +v 0.125 0.1029673 0.09894404 1 1 1 +v 0.125 1.001853E-32 0.125 1 1 1 +v 0.125 0.11376 0.125 1 1 1 +v 0.125 0.1029673 0.151056 1 1 1 +v 0.125 0.01665977 0.1652202 1 1 1 +v 0.125 0.09710023 0.1652202 1 1 1 +v 0.125 0.05688 0.18188 1 1 1 +v 0.1 0.172 -0.075 1 1 1 +v 0.1 0.172 0.1650544 1 1 1 +v -0.1 0.172 -0.075 1 1 1 +v 0.09005439 0.172 0.175 1 1 1 +v -0.09005439 0.172 0.175 1 1 1 +v -0.1 0.172 0.1650544 1 1 1 +v 0.125 0.05688 -0.175 1 1 1 +v 0.125 0.01665977 -0.1583402 1 1 1 +v 0.125 0.09710023 -0.1583402 1 1 1 +v 0.125 0.1029673 -0.144176 1 1 1 +v 0.125 1.001853E-32 -0.11812 1 1 1 +v 0.125 0.11376 -0.11812 1 1 1 +v 0.125 0.1029673 -0.09206405 1 1 1 +v 0.125 0.01665977 -0.07789977 1 1 1 +v 0.125 0.09710023 -0.07789977 1 1 1 +v 0.125 0.05688 -0.06124001 1 1 1 +v -0.125 0.05688 -0.175 1 1 1 +v -0.125 0.09710023 -0.1583402 1 1 1 +v -0.125 0.01665977 -0.1583402 1 1 1 +v -0.125 1.336664E-17 -0.11812 1 1 1 +v -0.125 0.11376 -0.11812 1 1 1 +v -0.125 0.01665977 -0.07789977 1 1 1 +v -0.125 0.09710023 -0.07789977 1 1 1 +v -0.125 0.05688 -0.06124001 1 1 1 +v -0.125 0.05688 0.06812 1 1 1 +v -0.125 0.09710023 0.08477977 1 1 1 +v -0.125 0.01665977 0.08477977 1 1 1 +v -0.125 1.336664E-17 0.125 1 1 1 +v -0.125 0.11376 0.125 1 1 1 +v -0.125 0.01665977 0.1652202 1 1 1 +v -0.125 0.09710023 0.1652202 1 1 1 +v -0.125 0.05688 0.18188 1 1 1 +v 0.09999999 0.222 0.225 1 1 1 +v 0.05 0.222 0.225 1 1 1 +v 0.09999999 0.297 0.225 1 1 1 +v 0.05 0.297 0.225 1 1 1 +v 0.15 0.222 0.175 1 1 1 +v 0.15 0.297 0.175 1 1 1 +v 0.15 0.222 0.125 1 1 1 +v 0.15 0.297 0.125 1 1 1 +v 0.09999999 0.222 0.125 1 1 1 +v 0.09999999 0.297 0.125 1 1 1 +v 0.09999999 0.297 0.1650544 1 1 1 +v 0.09999999 0.222 0.1650544 1 1 1 +v 0.05 0.297 0.175 1 1 1 +v 0.05 0.222 0.175 1 1 1 +v 0.09005438 0.222 0.175 1 1 1 +v 0.09005438 0.297 0.175 1 1 1 +v 0.1353553 0.222 0.2103553 1 1 1 +v 0.1353553 0.297 0.2103553 1 1 1 +v -0.15 0.222 0.175 1 1 1 +v -0.15 0.222 0.125 1 1 1 +v -0.15 0.297 0.175 1 1 1 +v -0.15 0.297 0.125 1 1 1 +v -0.09999999 0.222 0.225 1 1 1 +v -0.09999999 0.297 0.225 1 1 1 +v -0.04999998 0.222 0.225 1 1 1 +v -0.04999998 0.297 0.225 1 1 1 +v -0.04999999 0.222 0.175 1 1 1 +v -0.04999999 0.297 0.175 1 1 1 +v -0.09005438 0.297 0.175 1 1 1 +v -0.09005438 0.222 0.175 1 1 1 +v -0.1 0.297 0.125 1 1 1 +v -0.1 0.222 0.125 1 1 1 +v -0.09999999 0.222 0.1650544 1 1 1 +v -0.09999999 0.297 0.1650544 1 1 1 +v -0.1353553 0.222 0.2103553 1 1 1 +v -0.1353553 0.297 0.2103553 1 1 1 +v 0.15 0.222 -0.125 1 1 1 +v 0.15 0.222 -0.02499998 1 1 1 +v 0.15 0.297 -0.125 1 1 1 +v 0.15 0.297 -0.02499998 1 1 1 +v 0.05 0.222 -0.125 1 1 1 +v 0.05 0.297 -0.125 1 1 1 +v 0.04999999 0.222 -0.075 1 1 1 +v 0.04999999 0.297 -0.075 1 1 1 +v 0.09999999 0.297 -0.075 1 1 1 +v 0.09999999 0.222 -0.075 1 1 1 +v 0.09999999 0.297 -0.02499999 1 1 1 +v 0.09999999 0.222 -0.02499999 1 1 1 +v -0.15 0.222 -0.125 1 1 1 +v -0.05 0.222 -0.125 1 1 1 +v -0.15 0.297 -0.125 1 1 1 +v -0.05 0.297 -0.125 1 1 1 +v -0.15 0.222 -0.025 1 1 1 +v -0.15 0.297 -0.025 1 1 1 +v -0.05 0.297 -0.075 1 1 1 +v -0.05 0.222 -0.075 1 1 1 +v -0.09999999 0.222 -0.075 1 1 1 +v -0.09999999 0.297 -0.075 1 1 1 +v -0.09999999 0.222 -0.025 1 1 1 +v -0.09999999 0.297 -0.025 1 1 1 +v -0.15 0.172 -0.125 1 1 1 +v -0.15 0.222 -0.125 1 1 1 +v -0.15 0.172 0.175 1 1 1 +v -0.15 0.222 0.175 1 1 1 +v 0.15 0.172 -0.125 1 1 1 +v 0.15 0.222 -0.125 1 1 1 +v 0.15 0.222 0.175 1 1 1 +v 0.15 0.172 0.175 1 1 1 +v 0.1 0.172 0.225 1 1 1 +v -0.1 0.172 0.225 1 1 1 +v 0.1 0.222 0.225 1 1 1 +v -0.1 0.222 0.225 1 1 1 +v 0.1353553 0.172 0.2103553 1 1 1 +v 0.1353553 0.222 0.2103553 1 1 1 +v -0.1353553 0.172 0.2103553 1 1 1 +v -0.1353553 0.222 0.2103553 1 1 1 +v 0.09005438 0.172 0.175 1 1 1 +v -0.09005438 0.172 0.175 1 1 1 +v -0.1 0.222 0.1650544 1 1 1 +v -0.09005438 0.222 0.175 1 1 1 +v -0.1 0.222 -0.075 1 1 1 +v 0.09005438 0.222 0.175 1 1 1 +v 0.1 0.222 -0.075 1 1 1 +v 0.1 0.222 0.1650544 1 1 1 +v -0.15 0.347 -0.125 1 1 1 +v -0.15 0.347 0.175 1 1 1 +v 0.15 0.347 -0.125 1 1 1 +v 0.15 0.347 0.175 1 1 1 +v 0.1 0.297 0.225 1 1 1 +v -0.1 0.297 0.225 1 1 1 +v 0.1 0.347 0.225 1 1 1 +v -0.1 0.347 0.225 1 1 1 +v 0.1353553 0.347 0.2103553 1 1 1 +v -0.1353553 0.347 0.2103553 1 1 1 +v 0.1 0.297 -0.075 1 1 1 +v 0.1 0.297 0.1650544 1 1 1 +v -0.1 0.297 0.1650544 1 1 1 +v -0.1 0.297 -0.075 1 1 1 +v -0.1 0.347 0.1650544 1 1 1 +v -0.09005438 0.347 0.175 1 1 1 +v -0.1 0.347 -0.075 1 1 1 +v 0.09005438 0.347 0.175 1 1 1 +v 0.1 0.347 -0.075 1 1 1 +v 0.1 0.347 0.1650544 1 1 1 +v 0.075 0.05688 0.06812 1 1 1 +v 0.075 0.09710023 0.08477977 1 1 1 +v 0.075 0.01665977 0.08477977 1 1 1 +v 0.075 1.336664E-17 0.125 1 1 1 +v 0.075 0.11376 0.125 1 1 1 +v 0.075 0.01665977 0.1652202 1 1 1 +v 0.075 0.09710023 0.1652202 1 1 1 +v 0.075 0.05688 0.18188 1 1 1 +v 0.075 0.05688 -0.175 1 1 1 +v 0.075 0.09710023 -0.1583402 1 1 1 +v 0.075 0.01665977 -0.1583402 1 1 1 +v 0.075 1.336664E-17 -0.11812 1 1 1 +v 0.075 0.11376 -0.11812 1 1 1 +v 0.075 0.01665977 -0.07789977 1 1 1 +v 0.075 0.09710023 -0.07789977 1 1 1 +v 0.075 0.05688 -0.06124001 1 1 1 +v -0.075 0.01665977 -0.1583402 1 1 1 +v -0.075 0.05688 -0.175 1 1 1 +v -0.075 0 -0.11812 1 1 1 +v -0.075 0.01665977 -0.07789977 1 1 1 +v -0.075 0.05688 -0.06124001 1 1 1 +v -0.075 0.09710023 -0.07789977 1 1 1 +v -0.075 0.11376 -0.11812 1 1 1 +v -0.075 0.1029673 -0.09206405 1 1 1 +v -0.075 0.09710023 -0.1583402 1 1 1 +v -0.075 0.1029673 -0.144176 1 1 1 +v -0.075 0.01665977 0.08477977 1 1 1 +v -0.075 0.05688 0.06812 1 1 1 +v -0.075 0 0.125 1 1 1 +v -0.075 0.01665977 0.1652202 1 1 1 +v -0.075 0.05688 0.18188 1 1 1 +v -0.075 0.09710023 0.1652202 1 1 1 +v -0.075 0.11376 0.125 1 1 1 +v -0.075 0.1029673 0.151056 1 1 1 +v -0.075 0.09710023 0.08477977 1 1 1 +v -0.075 0.1029673 0.09894404 1 1 1 +v 0.1 0.3905596 -0.2409739 1 1 1 +v 0.1 0.3776186 -0.1926777 1 1 1 +v -0.1 0.3905596 -0.2409739 1 1 1 +v -0.1 0.3776186 -0.1926777 1 1 1 +v 0.1 0.3293223 -0.2056186 1 1 1 +v -0.1 0.3293223 -0.2056186 1 1 1 +v 0.1 0.3422633 -0.2539149 1 1 1 +v -0.1 0.3422633 -0.2539149 1 1 1 +v -0.15 0.3422633 -0.2539149 1 1 1 +v -0.15 0.3905596 -0.2409739 1 1 1 +v -0.15 0.3163814 -0.1573223 1 1 1 +v -0.15 0.3646776 -0.1443814 1 1 1 +v 0.15 0.3422633 -0.2539149 1 1 1 +v 0.1 0.3905596 -0.2409739 1 1 1 +v 0.15 0.3905596 -0.2409739 1 1 1 +v -0.1 0.3905596 -0.2409739 1 1 1 +v -0.1 0.3646776 -0.1443814 1 1 1 +v -0.1 0.3163814 -0.1573223 1 1 1 +v 0.1 0.3163814 -0.1573223 1 1 1 +v 0.1 0.3646776 -0.1443814 1 1 1 +v 0.15 0.3646776 -0.1443814 1 1 1 +v 0.15 0.3163814 -0.1573223 1 1 1 +v -0.1353553 0.3072307 -0.1231717 1 1 1 +v -0.1353553 0.355527 -0.1102307 1 1 1 +v -0.1 0.3034404 -0.109026 1 1 1 +v -0.1 0.3517367 -0.09608509 1 1 1 +v 0.1353553 0.355527 -0.1102307 1 1 1 +v 0.1353553 0.3072307 -0.1231717 1 1 1 +v 0.1 0.3034404 -0.109026 1 1 1 +v 0.1 0.3517367 -0.09608509 1 1 1 + +vn 0 -1 0 +vn -1 0 0 +vn 0 0 -1 +vn 1 0 0 +vn 0 0 1 +vn 0 0.2425356 -0.9701425 +vn 0 0.7882054 -0.6154122 +vn 0 1 0 +vn 0.1950904 0 0.9807853 +vn 2.980235E-08 0 1 +vn 0.9807853 0 0.1950903 +vn 1 0 -2.980235E-08 +vn -2.980235E-08 0 -1 +vn -0.9238795 0 -0.3826834 +vn -1 0 2.980235E-08 +vn -0.3826835 0 -0.9238795 +vn 0.7071067 0 0.7071068 +vn -0.9807854 0 0.1950905 +vn -1 0 1.192093E-07 +vn -0.1950903 0 0.9807854 +vn 1.192093E-07 0 1 +vn 1 0 -1.192093E-07 +vn 0.3826834 0 -0.9238797 +vn -1.192093E-07 0 -1 +vn 0.9238796 0 -0.3826837 +vn -0.7071068 0 0.7071068 +vn 1 0 1.192093E-07 +vn 1.192093E-07 0 -1 +vn -1 0 -1.192093E-07 +vn -1.192093E-07 0 1 +vn -0.9807853 0 0.1950903 +vn 0.1950903 0 0.9807853 +vn -0.1950903 0 0.9807853 +vn 0.7071068 0 0.7071068 +vn -0.7071068 0 0.7071068 +vn 0.3826834 0 -0.9238795 +vn -0.3826834 0 -0.9238795 +vn -0.9238795 0 -0.3826834 +vn 0.9238795 0 -0.3826834 +vn 0 -0.7071068 -0.7071068 +vn 0 -0.7071068 0.7071068 +vn 0 0.7071068 0.7071068 +vn 0 0.9238795 0.3826834 +vn 0 0.7071068 -0.7071068 +vn 0 0.9238795 -0.3826834 +vn 0 0.8660253 -0.5 +vn 0 0.5 0.8660253 +vn 0 -0.8660253 0.5 +vn 0 -0.5 -0.8660253 +vn -0.9807853 -0.05049309 0.1884428 +vn 0 0.258819 -0.9659258 +vn 0.9807853 -0.05049309 0.1884428 +vn -0.7071068 -0.1830127 0.6830127 +vn -0.1950903 -0.2538459 0.9473658 +vn 0.7071068 -0.1830127 0.6830127 +vn 0.1950903 -0.2538459 0.9473658 +vn 0 0.9659258 0.258819 +vn 0 -0.9659258 -0.258819 + +vt 0.46875 0.025 +vt 0.46875 0.09166666 +vt 0.46875 0.225 +vt 0.46875 0.125 +vt 0.46875 0.05428932 +vt 0.46875 0.1957107 +vt 0.46875 0.2060254 +vt 0.40625 0.125 +vt 0.46875 0.075 +vt 0.46875 0.175 +vt 0.09375 0.125 +vt 0.09375 0.1957107 +vt 0.09375 0.05428932 +vt 0.09375 0.025 +vt 0.09375 0.225 +vt 0.09375 0.2060254 +vt 0.59375 0.475 +vt 0.59375 0.275 +vt 0.21875 0.025 +vt 0.21875 0.225 + +usemtl colormap + +f 3/1/1 2/1/1 1/1/1 +f 2/1/1 3/1/1 4/1/1 +f 3/1/2 5/2/2 4/1/2 +f 5/2/2 3/1/2 6/2/2 +f 6/2/2 3/1/2 7/2/2 +f 5/2/2 6/2/2 8/3/2 +f 9/3/2 8/3/2 6/2/2 +f 5/2/3 2/1/3 4/1/3 +f 2/1/3 5/2/3 10/2/3 +f 11/3/4 2/1/4 10/2/4 +f 2/1/4 11/3/4 12/2/4 +f 12/2/4 11/3/4 13/3/4 +f 2/1/4 12/2/4 1/1/4 +f 1/1/4 12/2/4 14/2/4 +f 14/2/5 3/1/5 1/1/5 +f 3/1/5 14/2/5 7/2/5 +f 13/3/5 6/2/5 12/2/5 +f 6/2/5 13/3/5 9/3/5 +f 8/3/7 10/2/6 5/2/6 +f 10/2/6 8/3/7 11/3/7 +f 8/3/7 13/3/8 11/3/7 +f 13/3/8 8/3/7 9/3/8 +f 6/2/8 14/2/8 12/2/8 +f 14/2/8 6/2/8 7/2/8 +f 17/6/4 16/5/4 15/4/4 +f 16/5/4 17/6/4 18/7/4 +f 16/5/4 18/7/4 19/1/4 +f 19/1/4 18/7/4 20/3/4 +f 19/1/4 20/3/4 21/7/4 +f 19/1/4 21/7/4 22/5/4 +f 22/5/4 21/7/4 23/6/4 +f 22/5/4 23/6/4 24/4/4 +f 27/1/8 26/1/8 25/1/8 +f 26/1/8 27/1/8 28/1/8 +f 28/1/8 27/1/8 29/1/8 +f 29/1/8 27/1/8 30/1/8 +f 25/1/1 26/1/1 27/1/1 +f 28/1/1 27/1/1 26/1/1 +f 29/1/1 27/1/1 28/1/1 +f 30/1/1 27/1/1 29/1/1 +f 33/6/4 32/5/4 31/4/4 +f 32/5/4 33/6/4 34/7/4 +f 32/5/4 34/7/4 35/1/4 +f 35/1/4 34/7/4 36/3/4 +f 35/1/4 36/3/4 37/7/4 +f 35/1/4 37/7/4 38/5/4 +f 38/5/4 37/7/4 39/6/4 +f 38/5/4 39/6/4 40/4/4 +f 43/5/2 42/6/2 41/4/2 +f 42/6/2 43/5/2 44/1/2 +f 42/6/2 44/1/2 45/3/2 +f 45/3/2 44/1/2 46/5/2 +f 45/3/2 46/5/2 47/6/2 +f 47/6/2 46/5/2 48/4/2 +f 51/5/2 50/6/2 49/4/2 +f 50/6/2 51/5/2 52/1/2 +f 50/6/2 52/1/2 53/3/2 +f 53/3/2 52/1/2 54/5/2 +f 53/3/2 54/5/2 55/6/2 +f 55/6/2 54/5/2 56/4/2 +f 59/8/9 58/8/10 57/8/9 +f 58/8/10 59/8/9 60/8/10 +f 63/8/12 62/8/11 61/8/11 +f 62/8/11 63/8/12 64/8/12 +f 66/8/13 63/8/13 65/8/13 +f 63/8/13 66/8/13 64/8/13 +f 66/8/15 68/8/14 67/8/14 +f 68/8/14 66/8/15 65/8/15 +f 69/8/15 58/8/15 60/8/15 +f 58/8/15 69/8/15 70/8/15 +f 69/8/13 71/8/16 70/8/13 +f 71/8/16 69/8/13 72/8/16 +f 61/8/11 74/8/17 73/8/17 +f 74/8/17 61/8/11 62/8/11 +f 74/8/17 57/8/9 73/8/17 +f 57/8/9 74/8/17 59/8/9 +f 72/8/16 68/8/14 71/8/16 +f 68/8/14 72/8/16 67/8/14 +f 77/8/18 76/8/19 75/8/18 +f 76/8/19 77/8/18 78/8/19 +f 81/8/21 80/8/20 79/8/20 +f 80/8/20 81/8/21 82/8/21 +f 84/8/22 81/8/22 83/8/22 +f 81/8/22 84/8/22 82/8/22 +f 84/8/24 86/8/23 85/8/23 +f 86/8/23 84/8/24 83/8/24 +f 87/8/24 76/8/24 78/8/24 +f 76/8/24 87/8/24 88/8/24 +f 87/8/22 89/8/25 88/8/22 +f 89/8/25 87/8/22 90/8/25 +f 79/8/20 92/8/26 91/8/26 +f 92/8/26 79/8/20 80/8/20 +f 92/8/26 75/8/18 91/8/26 +f 75/8/18 92/8/26 77/8/18 +f 90/8/25 86/8/23 89/8/25 +f 86/8/23 90/8/25 85/8/23 +f 95/8/27 94/8/27 93/8/27 +f 94/8/27 95/8/27 96/8/27 +f 97/8/28 95/8/28 93/8/28 +f 95/8/28 97/8/28 98/8/28 +f 100/8/29 97/8/29 99/8/29 +f 97/8/29 100/8/29 98/8/29 +f 100/8/30 102/8/30 101/8/30 +f 102/8/30 100/8/30 99/8/30 +f 103/8/30 94/8/30 96/8/30 +f 94/8/30 103/8/30 104/8/30 +f 103/8/29 102/8/29 104/8/29 +f 102/8/29 103/8/29 101/8/29 +f 107/8/3 106/8/3 105/8/3 +f 106/8/3 107/8/3 108/8/3 +f 109/8/2 107/8/2 105/8/2 +f 107/8/2 109/8/2 110/8/2 +f 111/8/4 106/8/4 108/8/4 +f 106/8/4 111/8/4 112/8/4 +f 111/8/5 113/8/5 112/8/5 +f 113/8/5 111/8/5 114/8/5 +f 116/8/5 109/8/5 115/8/5 +f 109/8/5 116/8/5 110/8/5 +f 116/8/4 113/8/4 114/8/4 +f 113/8/4 116/8/4 115/8/4 +f 119/9/31 118/10/2 117/9/2 +f 118/10/2 119/9/31 120/10/31 +f 118/10/3 121/9/3 117/9/3 +f 121/9/3 118/10/3 122/10/3 +f 123/10/11 121/9/4 122/10/4 +f 121/9/4 123/10/11 124/9/11 +f 127/10/32 126/9/33 125/9/32 +f 126/9/33 127/10/32 128/10/33 +f 130/10/34 125/9/32 129/9/34 +f 125/9/32 130/10/34 127/10/32 +f 131/9/35 120/10/31 119/9/31 +f 120/10/31 131/9/35 132/10/35 +f 128/10/33 131/9/35 126/9/33 +f 131/9/35 128/10/33 132/10/35 +f 130/10/34 124/9/11 123/10/11 +f 124/9/11 130/10/34 129/9/34 +f 129/9/1 121/9/1 124/9/1 +f 121/9/1 129/9/1 25/9/1 +f 121/9/1 25/9/1 117/9/1 +f 25/9/1 129/9/1 125/9/1 +f 25/9/1 125/9/1 26/9/1 +f 125/9/1 133/9/1 26/9/1 +f 133/9/1 125/9/1 126/9/1 +f 133/9/1 126/9/1 134/9/1 +f 134/9/1 126/9/1 30/9/1 +f 30/9/1 126/9/1 27/9/1 +f 117/9/1 25/9/1 27/9/1 +f 117/9/1 27/9/1 126/9/1 +f 117/9/1 126/9/1 131/9/1 +f 117/9/1 131/9/1 119/9/1 +f 132/10/8 118/10/8 120/10/8 +f 128/10/8 118/10/8 132/10/8 +f 135/10/8 118/10/8 128/10/8 +f 128/10/8 136/10/8 135/10/8 +f 137/10/8 118/10/8 135/10/8 +f 128/10/8 138/10/8 136/10/8 +f 139/10/8 118/10/8 137/10/8 +f 127/10/8 138/10/8 128/10/8 +f 127/10/8 140/10/8 138/10/8 +f 127/10/8 139/10/8 140/10/8 +f 139/10/8 122/10/8 118/10/8 +f 139/10/8 127/10/8 130/10/8 +f 122/10/8 139/10/8 123/10/8 +f 123/10/8 139/10/8 130/10/8 +f 136/10/36 133/9/37 134/9/36 +f 133/9/37 136/10/36 138/10/37 +f 133/9/37 140/10/38 26/9/38 +f 140/10/38 133/9/37 138/10/37 +f 26/9/38 139/10/2 25/9/2 +f 139/10/2 26/9/38 140/10/38 +f 139/10/5 27/9/5 25/9/5 +f 27/9/5 139/10/5 137/10/5 +f 135/10/39 27/9/4 137/10/4 +f 27/9/4 135/10/39 30/9/39 +f 136/10/36 30/9/39 135/10/39 +f 30/9/39 136/10/36 134/9/36 +f 77/9/31 141/10/2 107/9/2 +f 141/10/2 77/9/31 142/10/31 +f 141/10/3 95/9/3 107/9/3 +f 95/9/3 141/10/3 143/10/3 +f 144/10/11 95/9/4 143/10/4 +f 95/9/4 144/10/11 62/9/11 +f 147/10/32 146/9/33 145/9/32 +f 146/9/33 147/10/32 148/10/33 +f 149/10/34 145/9/32 74/9/34 +f 145/9/32 149/10/34 147/10/32 +f 92/9/35 142/10/31 77/9/31 +f 142/10/31 92/9/35 150/10/35 +f 148/10/33 92/9/35 146/9/33 +f 92/9/35 148/10/33 150/10/35 +f 149/10/34 62/9/11 144/10/11 +f 62/9/11 149/10/34 74/9/34 +f 74/9/1 95/9/1 62/9/1 +f 95/9/1 74/9/1 151/9/1 +f 95/9/1 151/9/1 107/9/1 +f 151/9/1 74/9/1 145/9/1 +f 151/9/1 145/9/1 152/9/1 +f 145/9/1 72/9/1 152/9/1 +f 72/9/1 145/9/1 146/9/1 +f 72/9/1 146/9/1 85/9/1 +f 85/9/1 146/9/1 153/9/1 +f 153/9/1 146/9/1 154/9/1 +f 107/9/1 151/9/1 154/9/1 +f 107/9/1 154/9/1 146/9/1 +f 107/9/1 146/9/1 92/9/1 +f 107/9/1 92/9/1 77/9/1 +f 150/10/8 141/10/8 142/10/8 +f 148/10/8 141/10/8 150/10/8 +f 155/10/8 141/10/8 148/10/8 +f 148/10/8 156/10/8 155/10/8 +f 157/10/8 141/10/8 155/10/8 +f 148/10/8 158/10/8 156/10/8 +f 159/10/8 141/10/8 157/10/8 +f 147/10/8 158/10/8 148/10/8 +f 147/10/8 160/10/8 158/10/8 +f 147/10/8 159/10/8 160/10/8 +f 159/10/8 143/10/8 141/10/8 +f 159/10/8 147/10/8 149/10/8 +f 143/10/8 159/10/8 144/10/8 +f 144/10/8 159/10/8 149/10/8 +f 156/10/36 72/9/37 85/9/36 +f 72/9/37 156/10/36 158/10/37 +f 72/9/37 160/10/38 152/9/38 +f 160/10/38 72/9/37 158/10/37 +f 152/9/38 159/10/2 151/9/2 +f 159/10/2 152/9/38 160/10/38 +f 159/10/5 154/9/5 151/9/5 +f 154/9/5 159/10/5 157/10/5 +f 155/10/39 154/9/4 157/10/4 +f 154/9/4 155/10/39 153/9/39 +f 156/10/36 153/9/39 155/10/39 +f 153/9/39 156/10/36 85/9/36 +f 163/13/2 162/12/2 161/11/2 +f 162/12/2 163/13/2 164/14/2 +f 162/12/2 164/14/2 165/15/2 +f 165/15/2 164/14/2 166/13/2 +f 165/15/2 166/13/2 167/12/2 +f 167/12/2 166/13/2 168/11/2 +f 163/13/40 15/11/3 16/13/40 +f 15/11/3 163/13/40 161/11/3 +f 164/14/1 16/13/40 19/14/1 +f 16/13/40 164/14/1 163/13/40 +f 166/13/41 19/14/1 22/13/41 +f 19/14/1 166/13/41 164/14/1 +f 24/11/5 166/13/41 22/13/41 +f 166/13/41 24/11/5 168/11/5 +f 23/12/42 168/11/5 24/11/5 +f 168/11/5 23/12/42 167/12/42 +f 165/15/8 21/16/43 20/15/8 +f 21/16/43 165/15/8 23/12/42 +f 23/12/42 165/15/8 167/12/42 +f 162/12/44 18/16/45 17/12/44 +f 18/16/45 162/12/44 20/15/8 +f 20/15/8 162/12/44 165/15/8 +f 161/11/3 17/12/44 15/11/3 +f 17/12/44 161/11/3 162/12/44 +f 171/13/2 170/12/2 169/11/2 +f 170/12/2 171/13/2 172/14/2 +f 170/12/2 172/14/2 173/15/2 +f 173/15/2 172/14/2 174/13/2 +f 173/15/2 174/13/2 175/12/2 +f 175/12/2 174/13/2 176/11/2 +f 171/13/40 31/11/3 32/13/40 +f 31/11/3 171/13/40 169/11/3 +f 172/14/1 32/13/40 35/14/1 +f 32/13/40 172/14/1 171/13/40 +f 174/13/41 35/14/1 38/13/41 +f 35/14/1 174/13/41 172/14/1 +f 40/11/5 174/13/41 38/13/41 +f 174/13/41 40/11/5 176/11/5 +f 39/12/42 176/11/5 40/11/5 +f 176/11/5 39/12/42 175/12/42 +f 173/15/8 37/16/43 36/15/8 +f 37/16/43 173/15/8 39/12/42 +f 39/12/42 173/15/8 175/12/42 +f 170/12/44 34/16/45 33/12/44 +f 34/16/45 170/12/44 36/15/8 +f 36/15/8 170/12/44 173/15/8 +f 169/11/3 33/12/44 31/11/3 +f 33/12/44 169/11/3 170/12/44 +f 43/13/40 178/11/3 177/13/40 +f 178/11/3 43/13/40 41/11/3 +f 44/14/1 177/13/40 179/14/1 +f 177/13/40 44/14/1 43/13/40 +f 46/13/41 179/14/1 180/13/41 +f 179/14/1 46/13/41 44/14/1 +f 181/11/5 46/13/41 180/13/41 +f 46/13/41 181/11/5 48/11/5 +f 182/12/42 48/11/5 181/11/5 +f 48/11/5 182/12/42 47/12/42 +f 45/15/8 184/16/43 183/15/8 +f 184/16/43 45/15/8 182/12/42 +f 182/12/42 45/15/8 47/12/42 +f 42/12/44 186/16/45 185/12/44 +f 186/16/45 42/12/44 183/15/8 +f 183/15/8 42/12/44 45/15/8 +f 41/11/3 185/12/44 178/11/3 +f 185/12/44 41/11/3 42/12/44 +f 185/12/4 177/13/4 178/11/4 +f 177/13/4 185/12/4 186/16/4 +f 177/13/4 186/16/4 179/14/4 +f 179/14/4 186/16/4 183/15/4 +f 179/14/4 183/15/4 184/16/4 +f 179/14/4 184/16/4 180/13/4 +f 180/13/4 184/16/4 182/12/4 +f 180/13/4 182/12/4 181/11/4 +f 51/13/40 188/11/3 187/13/40 +f 188/11/3 51/13/40 49/11/3 +f 52/14/1 187/13/40 189/14/1 +f 187/13/40 52/14/1 51/13/40 +f 54/13/41 189/14/1 190/13/41 +f 189/14/1 54/13/41 52/14/1 +f 191/11/5 54/13/41 190/13/41 +f 54/13/41 191/11/5 56/11/5 +f 192/12/42 56/11/5 191/11/5 +f 56/11/5 192/12/42 55/12/42 +f 53/15/8 194/16/43 193/15/8 +f 194/16/43 53/15/8 192/12/42 +f 192/12/42 53/15/8 55/12/42 +f 50/12/44 196/16/45 195/12/44 +f 196/16/45 50/12/44 193/15/8 +f 193/15/8 50/12/44 53/15/8 +f 49/11/3 195/12/44 188/11/3 +f 195/12/44 49/11/3 50/12/44 +f 195/12/4 187/13/4 188/11/4 +f 187/13/4 195/12/4 196/16/4 +f 187/13/4 196/16/4 189/14/4 +f 189/14/4 196/16/4 193/15/4 +f 189/14/4 193/15/4 194/16/4 +f 189/14/4 194/16/4 190/13/4 +f 190/13/4 194/16/4 192/12/4 +f 190/13/4 192/12/4 191/11/4 +f 199/17/46 198/17/47 197/17/46 +f 198/17/47 199/17/46 200/17/47 +f 198/17/47 202/18/48 201/18/48 +f 202/18/48 198/17/47 200/17/47 +f 202/18/48 203/18/49 201/18/48 +f 203/18/49 202/18/48 204/18/49 +f 204/18/49 197/17/46 203/18/49 +f 197/17/46 204/18/49 199/17/46 +f 207/19/50 206/20/2 205/19/2 +f 206/20/2 207/19/50 208/20/50 +f 210/20/51 209/19/51 203/19/51 +f 209/19/51 210/20/51 211/20/51 +f 213/20/4 204/19/4 212/20/4 +f 204/19/4 213/20/4 214/19/4 +f 215/19/2 210/20/2 203/19/2 +f 210/20/2 215/19/2 216/20/2 +f 206/20/51 204/19/51 205/19/51 +f 204/19/51 206/20/51 212/20/51 +f 217/20/52 209/19/4 211/20/4 +f 209/19/4 217/20/52 218/19/52 +f 219/19/53 208/20/50 207/19/50 +f 208/20/50 219/19/53 220/20/53 +f 222/20/54 219/19/53 221/19/54 +f 219/19/53 222/20/54 220/20/53 +f 223/20/55 218/19/52 217/20/52 +f 218/19/52 223/20/55 224/19/55 +f 223/20/55 225/19/56 224/19/55 +f 225/19/56 223/20/55 226/20/56 +f 206/20/57 213/20/57 212/20/57 +f 213/20/57 206/20/57 222/20/57 +f 222/20/57 216/20/57 213/20/57 +f 222/20/57 206/20/57 220/20/57 +f 220/20/57 206/20/57 208/20/57 +f 226/20/57 216/20/57 222/20/57 +f 226/20/57 210/20/57 216/20/57 +f 223/20/57 210/20/57 226/20/57 +f 217/20/57 210/20/57 223/20/57 +f 210/20/57 217/20/57 211/20/57 +f 205/19/58 219/19/58 207/19/58 +f 205/19/58 221/19/58 219/19/58 +f 204/19/58 221/19/58 205/19/58 +f 214/19/58 221/19/58 204/19/58 +f 215/19/58 221/19/58 214/19/58 +f 221/19/58 215/19/58 225/19/58 +f 203/19/58 225/19/58 215/19/58 +f 203/19/58 224/19/58 225/19/58 +f 209/19/58 224/19/58 203/19/58 +f 224/19/58 209/19/58 218/19/58 +f 226/20/56 221/19/54 225/19/56 +f 221/19/54 226/20/56 222/20/54 +f 213/20/51 215/19/51 214/19/51 +f 215/19/51 213/20/51 216/20/51 + +g shopping-cart + + + + +usemtl colormap + +f 3/1/1 2/1/1 1/1/1 +f 2/1/1 3/1/1 4/1/1 +f 3/1/2 5/2/2 4/1/2 +f 5/2/2 3/1/2 6/2/2 +f 6/2/2 3/1/2 7/2/2 +f 5/2/2 6/2/2 8/3/2 +f 9/3/2 8/3/2 6/2/2 +f 5/2/3 2/1/3 4/1/3 +f 2/1/3 5/2/3 10/2/3 +f 11/3/4 2/1/4 10/2/4 +f 2/1/4 11/3/4 12/2/4 +f 12/2/4 11/3/4 13/3/4 +f 2/1/4 12/2/4 1/1/4 +f 1/1/4 12/2/4 14/2/4 +f 14/2/5 3/1/5 1/1/5 +f 3/1/5 14/2/5 7/2/5 +f 13/3/5 6/2/5 12/2/5 +f 6/2/5 13/3/5 9/3/5 +f 8/3/7 10/2/6 5/2/6 +f 10/2/6 8/3/7 11/3/7 +f 8/3/7 13/3/8 11/3/7 +f 13/3/8 8/3/7 9/3/8 +f 6/2/8 14/2/8 12/2/8 +f 14/2/8 6/2/8 7/2/8 +f 17/6/4 16/5/4 15/4/4 +f 16/5/4 17/6/4 18/7/4 +f 16/5/4 18/7/4 19/1/4 +f 19/1/4 18/7/4 20/3/4 +f 19/1/4 20/3/4 21/7/4 +f 19/1/4 21/7/4 22/5/4 +f 22/5/4 21/7/4 23/6/4 +f 22/5/4 23/6/4 24/4/4 +f 27/1/8 26/1/8 25/1/8 +f 26/1/8 27/1/8 28/1/8 +f 28/1/8 27/1/8 29/1/8 +f 29/1/8 27/1/8 30/1/8 +f 25/1/1 26/1/1 27/1/1 +f 28/1/1 27/1/1 26/1/1 +f 29/1/1 27/1/1 28/1/1 +f 30/1/1 27/1/1 29/1/1 +f 33/6/4 32/5/4 31/4/4 +f 32/5/4 33/6/4 34/7/4 +f 32/5/4 34/7/4 35/1/4 +f 35/1/4 34/7/4 36/3/4 +f 35/1/4 36/3/4 37/7/4 +f 35/1/4 37/7/4 38/5/4 +f 38/5/4 37/7/4 39/6/4 +f 38/5/4 39/6/4 40/4/4 +f 43/5/2 42/6/2 41/4/2 +f 42/6/2 43/5/2 44/1/2 +f 42/6/2 44/1/2 45/3/2 +f 45/3/2 44/1/2 46/5/2 +f 45/3/2 46/5/2 47/6/2 +f 47/6/2 46/5/2 48/4/2 +f 51/5/2 50/6/2 49/4/2 +f 50/6/2 51/5/2 52/1/2 +f 50/6/2 52/1/2 53/3/2 +f 53/3/2 52/1/2 54/5/2 +f 53/3/2 54/5/2 55/6/2 +f 55/6/2 54/5/2 56/4/2 +f 59/8/9 58/8/10 57/8/9 +f 58/8/10 59/8/9 60/8/10 +f 63/8/12 62/8/11 61/8/11 +f 62/8/11 63/8/12 64/8/12 +f 66/8/13 63/8/13 65/8/13 +f 63/8/13 66/8/13 64/8/13 +f 66/8/15 68/8/14 67/8/14 +f 68/8/14 66/8/15 65/8/15 +f 69/8/15 58/8/15 60/8/15 +f 58/8/15 69/8/15 70/8/15 +f 69/8/13 71/8/16 70/8/13 +f 71/8/16 69/8/13 72/8/16 +f 61/8/11 74/8/17 73/8/17 +f 74/8/17 61/8/11 62/8/11 +f 74/8/17 57/8/9 73/8/17 +f 57/8/9 74/8/17 59/8/9 +f 72/8/16 68/8/14 71/8/16 +f 68/8/14 72/8/16 67/8/14 +f 77/8/18 76/8/19 75/8/18 +f 76/8/19 77/8/18 78/8/19 +f 81/8/21 80/8/20 79/8/20 +f 80/8/20 81/8/21 82/8/21 +f 84/8/22 81/8/22 83/8/22 +f 81/8/22 84/8/22 82/8/22 +f 84/8/24 86/8/23 85/8/23 +f 86/8/23 84/8/24 83/8/24 +f 87/8/24 76/8/24 78/8/24 +f 76/8/24 87/8/24 88/8/24 +f 87/8/22 89/8/25 88/8/22 +f 89/8/25 87/8/22 90/8/25 +f 79/8/20 92/8/26 91/8/26 +f 92/8/26 79/8/20 80/8/20 +f 92/8/26 75/8/18 91/8/26 +f 75/8/18 92/8/26 77/8/18 +f 90/8/25 86/8/23 89/8/25 +f 86/8/23 90/8/25 85/8/23 +f 95/8/27 94/8/27 93/8/27 +f 94/8/27 95/8/27 96/8/27 +f 97/8/28 95/8/28 93/8/28 +f 95/8/28 97/8/28 98/8/28 +f 100/8/29 97/8/29 99/8/29 +f 97/8/29 100/8/29 98/8/29 +f 100/8/30 102/8/30 101/8/30 +f 102/8/30 100/8/30 99/8/30 +f 103/8/30 94/8/30 96/8/30 +f 94/8/30 103/8/30 104/8/30 +f 103/8/29 102/8/29 104/8/29 +f 102/8/29 103/8/29 101/8/29 +f 107/8/3 106/8/3 105/8/3 +f 106/8/3 107/8/3 108/8/3 +f 109/8/2 107/8/2 105/8/2 +f 107/8/2 109/8/2 110/8/2 +f 111/8/4 106/8/4 108/8/4 +f 106/8/4 111/8/4 112/8/4 +f 111/8/5 113/8/5 112/8/5 +f 113/8/5 111/8/5 114/8/5 +f 116/8/5 109/8/5 115/8/5 +f 109/8/5 116/8/5 110/8/5 +f 116/8/4 113/8/4 114/8/4 +f 113/8/4 116/8/4 115/8/4 +f 119/9/31 118/10/2 117/9/2 +f 118/10/2 119/9/31 120/10/31 +f 118/10/3 121/9/3 117/9/3 +f 121/9/3 118/10/3 122/10/3 +f 123/10/11 121/9/4 122/10/4 +f 121/9/4 123/10/11 124/9/11 +f 127/10/32 126/9/33 125/9/32 +f 126/9/33 127/10/32 128/10/33 +f 130/10/34 125/9/32 129/9/34 +f 125/9/32 130/10/34 127/10/32 +f 131/9/35 120/10/31 119/9/31 +f 120/10/31 131/9/35 132/10/35 +f 128/10/33 131/9/35 126/9/33 +f 131/9/35 128/10/33 132/10/35 +f 130/10/34 124/9/11 123/10/11 +f 124/9/11 130/10/34 129/9/34 +f 129/9/1 121/9/1 124/9/1 +f 121/9/1 129/9/1 25/9/1 +f 121/9/1 25/9/1 117/9/1 +f 25/9/1 129/9/1 125/9/1 +f 25/9/1 125/9/1 26/9/1 +f 125/9/1 133/9/1 26/9/1 +f 133/9/1 125/9/1 126/9/1 +f 133/9/1 126/9/1 134/9/1 +f 134/9/1 126/9/1 30/9/1 +f 30/9/1 126/9/1 27/9/1 +f 117/9/1 25/9/1 27/9/1 +f 117/9/1 27/9/1 126/9/1 +f 117/9/1 126/9/1 131/9/1 +f 117/9/1 131/9/1 119/9/1 +f 132/10/8 118/10/8 120/10/8 +f 128/10/8 118/10/8 132/10/8 +f 135/10/8 118/10/8 128/10/8 +f 128/10/8 136/10/8 135/10/8 +f 137/10/8 118/10/8 135/10/8 +f 128/10/8 138/10/8 136/10/8 +f 139/10/8 118/10/8 137/10/8 +f 127/10/8 138/10/8 128/10/8 +f 127/10/8 140/10/8 138/10/8 +f 127/10/8 139/10/8 140/10/8 +f 139/10/8 122/10/8 118/10/8 +f 139/10/8 127/10/8 130/10/8 +f 122/10/8 139/10/8 123/10/8 +f 123/10/8 139/10/8 130/10/8 +f 136/10/36 133/9/37 134/9/36 +f 133/9/37 136/10/36 138/10/37 +f 133/9/37 140/10/38 26/9/38 +f 140/10/38 133/9/37 138/10/37 +f 26/9/38 139/10/2 25/9/2 +f 139/10/2 26/9/38 140/10/38 +f 139/10/5 27/9/5 25/9/5 +f 27/9/5 139/10/5 137/10/5 +f 135/10/39 27/9/4 137/10/4 +f 27/9/4 135/10/39 30/9/39 +f 136/10/36 30/9/39 135/10/39 +f 30/9/39 136/10/36 134/9/36 +f 77/9/31 141/10/2 107/9/2 +f 141/10/2 77/9/31 142/10/31 +f 141/10/3 95/9/3 107/9/3 +f 95/9/3 141/10/3 143/10/3 +f 144/10/11 95/9/4 143/10/4 +f 95/9/4 144/10/11 62/9/11 +f 147/10/32 146/9/33 145/9/32 +f 146/9/33 147/10/32 148/10/33 +f 149/10/34 145/9/32 74/9/34 +f 145/9/32 149/10/34 147/10/32 +f 92/9/35 142/10/31 77/9/31 +f 142/10/31 92/9/35 150/10/35 +f 148/10/33 92/9/35 146/9/33 +f 92/9/35 148/10/33 150/10/35 +f 149/10/34 62/9/11 144/10/11 +f 62/9/11 149/10/34 74/9/34 +f 74/9/1 95/9/1 62/9/1 +f 95/9/1 74/9/1 151/9/1 +f 95/9/1 151/9/1 107/9/1 +f 151/9/1 74/9/1 145/9/1 +f 151/9/1 145/9/1 152/9/1 +f 145/9/1 72/9/1 152/9/1 +f 72/9/1 145/9/1 146/9/1 +f 72/9/1 146/9/1 85/9/1 +f 85/9/1 146/9/1 153/9/1 +f 153/9/1 146/9/1 154/9/1 +f 107/9/1 151/9/1 154/9/1 +f 107/9/1 154/9/1 146/9/1 +f 107/9/1 146/9/1 92/9/1 +f 107/9/1 92/9/1 77/9/1 +f 150/10/8 141/10/8 142/10/8 +f 148/10/8 141/10/8 150/10/8 +f 155/10/8 141/10/8 148/10/8 +f 148/10/8 156/10/8 155/10/8 +f 157/10/8 141/10/8 155/10/8 +f 148/10/8 158/10/8 156/10/8 +f 159/10/8 141/10/8 157/10/8 +f 147/10/8 158/10/8 148/10/8 +f 147/10/8 160/10/8 158/10/8 +f 147/10/8 159/10/8 160/10/8 +f 159/10/8 143/10/8 141/10/8 +f 159/10/8 147/10/8 149/10/8 +f 143/10/8 159/10/8 144/10/8 +f 144/10/8 159/10/8 149/10/8 +f 156/10/36 72/9/37 85/9/36 +f 72/9/37 156/10/36 158/10/37 +f 72/9/37 160/10/38 152/9/38 +f 160/10/38 72/9/37 158/10/37 +f 152/9/38 159/10/2 151/9/2 +f 159/10/2 152/9/38 160/10/38 +f 159/10/5 154/9/5 151/9/5 +f 154/9/5 159/10/5 157/10/5 +f 155/10/39 154/9/4 157/10/4 +f 154/9/4 155/10/39 153/9/39 +f 156/10/36 153/9/39 155/10/39 +f 153/9/39 156/10/36 85/9/36 +f 163/13/2 162/12/2 161/11/2 +f 162/12/2 163/13/2 164/14/2 +f 162/12/2 164/14/2 165/15/2 +f 165/15/2 164/14/2 166/13/2 +f 165/15/2 166/13/2 167/12/2 +f 167/12/2 166/13/2 168/11/2 +f 163/13/40 15/11/3 16/13/40 +f 15/11/3 163/13/40 161/11/3 +f 164/14/1 16/13/40 19/14/1 +f 16/13/40 164/14/1 163/13/40 +f 166/13/41 19/14/1 22/13/41 +f 19/14/1 166/13/41 164/14/1 +f 24/11/5 166/13/41 22/13/41 +f 166/13/41 24/11/5 168/11/5 +f 23/12/42 168/11/5 24/11/5 +f 168/11/5 23/12/42 167/12/42 +f 165/15/8 21/16/43 20/15/8 +f 21/16/43 165/15/8 23/12/42 +f 23/12/42 165/15/8 167/12/42 +f 162/12/44 18/16/45 17/12/44 +f 18/16/45 162/12/44 20/15/8 +f 20/15/8 162/12/44 165/15/8 +f 161/11/3 17/12/44 15/11/3 +f 17/12/44 161/11/3 162/12/44 +f 171/13/2 170/12/2 169/11/2 +f 170/12/2 171/13/2 172/14/2 +f 170/12/2 172/14/2 173/15/2 +f 173/15/2 172/14/2 174/13/2 +f 173/15/2 174/13/2 175/12/2 +f 175/12/2 174/13/2 176/11/2 +f 171/13/40 31/11/3 32/13/40 +f 31/11/3 171/13/40 169/11/3 +f 172/14/1 32/13/40 35/14/1 +f 32/13/40 172/14/1 171/13/40 +f 174/13/41 35/14/1 38/13/41 +f 35/14/1 174/13/41 172/14/1 +f 40/11/5 174/13/41 38/13/41 +f 174/13/41 40/11/5 176/11/5 +f 39/12/42 176/11/5 40/11/5 +f 176/11/5 39/12/42 175/12/42 +f 173/15/8 37/16/43 36/15/8 +f 37/16/43 173/15/8 39/12/42 +f 39/12/42 173/15/8 175/12/42 +f 170/12/44 34/16/45 33/12/44 +f 34/16/45 170/12/44 36/15/8 +f 36/15/8 170/12/44 173/15/8 +f 169/11/3 33/12/44 31/11/3 +f 33/12/44 169/11/3 170/12/44 +f 43/13/40 178/11/3 177/13/40 +f 178/11/3 43/13/40 41/11/3 +f 44/14/1 177/13/40 179/14/1 +f 177/13/40 44/14/1 43/13/40 +f 46/13/41 179/14/1 180/13/41 +f 179/14/1 46/13/41 44/14/1 +f 181/11/5 46/13/41 180/13/41 +f 46/13/41 181/11/5 48/11/5 +f 182/12/42 48/11/5 181/11/5 +f 48/11/5 182/12/42 47/12/42 +f 45/15/8 184/16/43 183/15/8 +f 184/16/43 45/15/8 182/12/42 +f 182/12/42 45/15/8 47/12/42 +f 42/12/44 186/16/45 185/12/44 +f 186/16/45 42/12/44 183/15/8 +f 183/15/8 42/12/44 45/15/8 +f 41/11/3 185/12/44 178/11/3 +f 185/12/44 41/11/3 42/12/44 +f 185/12/4 177/13/4 178/11/4 +f 177/13/4 185/12/4 186/16/4 +f 177/13/4 186/16/4 179/14/4 +f 179/14/4 186/16/4 183/15/4 +f 179/14/4 183/15/4 184/16/4 +f 179/14/4 184/16/4 180/13/4 +f 180/13/4 184/16/4 182/12/4 +f 180/13/4 182/12/4 181/11/4 +f 51/13/40 188/11/3 187/13/40 +f 188/11/3 51/13/40 49/11/3 +f 52/14/1 187/13/40 189/14/1 +f 187/13/40 52/14/1 51/13/40 +f 54/13/41 189/14/1 190/13/41 +f 189/14/1 54/13/41 52/14/1 +f 191/11/5 54/13/41 190/13/41 +f 54/13/41 191/11/5 56/11/5 +f 192/12/42 56/11/5 191/11/5 +f 56/11/5 192/12/42 55/12/42 +f 53/15/8 194/16/43 193/15/8 +f 194/16/43 53/15/8 192/12/42 +f 192/12/42 53/15/8 55/12/42 +f 50/12/44 196/16/45 195/12/44 +f 196/16/45 50/12/44 193/15/8 +f 193/15/8 50/12/44 53/15/8 +f 49/11/3 195/12/44 188/11/3 +f 195/12/44 49/11/3 50/12/44 +f 195/12/4 187/13/4 188/11/4 +f 187/13/4 195/12/4 196/16/4 +f 187/13/4 196/16/4 189/14/4 +f 189/14/4 196/16/4 193/15/4 +f 189/14/4 193/15/4 194/16/4 +f 189/14/4 194/16/4 190/13/4 +f 190/13/4 194/16/4 192/12/4 +f 190/13/4 192/12/4 191/11/4 +f 199/17/46 198/17/47 197/17/46 +f 198/17/47 199/17/46 200/17/47 +f 198/17/47 202/18/48 201/18/48 +f 202/18/48 198/17/47 200/17/47 +f 202/18/48 203/18/49 201/18/48 +f 203/18/49 202/18/48 204/18/49 +f 204/18/49 197/17/46 203/18/49 +f 197/17/46 204/18/49 199/17/46 +f 207/19/50 206/20/2 205/19/2 +f 206/20/2 207/19/50 208/20/50 +f 210/20/51 209/19/51 203/19/51 +f 209/19/51 210/20/51 211/20/51 +f 213/20/4 204/19/4 212/20/4 +f 204/19/4 213/20/4 214/19/4 +f 215/19/2 210/20/2 203/19/2 +f 210/20/2 215/19/2 216/20/2 +f 206/20/51 204/19/51 205/19/51 +f 204/19/51 206/20/51 212/20/51 +f 217/20/52 209/19/4 211/20/4 +f 209/19/4 217/20/52 218/19/52 +f 219/19/53 208/20/50 207/19/50 +f 208/20/50 219/19/53 220/20/53 +f 222/20/54 219/19/53 221/19/54 +f 219/19/53 222/20/54 220/20/53 +f 223/20/55 218/19/52 217/20/52 +f 218/19/52 223/20/55 224/19/55 +f 223/20/55 225/19/56 224/19/55 +f 225/19/56 223/20/55 226/20/56 +f 206/20/57 213/20/57 212/20/57 +f 213/20/57 206/20/57 222/20/57 +f 222/20/57 216/20/57 213/20/57 +f 222/20/57 206/20/57 220/20/57 +f 220/20/57 206/20/57 208/20/57 +f 226/20/57 216/20/57 222/20/57 +f 226/20/57 210/20/57 216/20/57 +f 223/20/57 210/20/57 226/20/57 +f 217/20/57 210/20/57 223/20/57 +f 210/20/57 217/20/57 211/20/57 +f 205/19/58 219/19/58 207/19/58 +f 205/19/58 221/19/58 219/19/58 +f 204/19/58 221/19/58 205/19/58 +f 214/19/58 221/19/58 204/19/58 +f 215/19/58 221/19/58 214/19/58 +f 221/19/58 215/19/58 225/19/58 +f 203/19/58 225/19/58 215/19/58 +f 203/19/58 224/19/58 225/19/58 +f 209/19/58 224/19/58 203/19/58 +f 224/19/58 209/19/58 218/19/58 +f 226/20/56 221/19/54 225/19/56 +f 221/19/54 226/20/56 222/20/54 +f 213/20/51 215/19/51 214/19/51 +f 215/19/51 213/20/51 216/20/51 + diff --git a/assets/models/variation-a.png b/assets/models/variation-a.png new file mode 100644 index 0000000..c4d7dcf Binary files /dev/null and b/assets/models/variation-a.png differ diff --git a/assets/models/vegetation_tree_bark_40.png b/assets/textures/vegetation_tree_bark_40.png similarity index 100% rename from assets/models/vegetation_tree_bark_40.png rename to assets/textures/vegetation_tree_bark_40.png diff --git a/imgui.ini b/imgui.ini index 7704601..6372310 100644 --- a/imgui.ini +++ b/imgui.ini @@ -44,6 +44,12 @@ Size=364,1142 Collapsed=0 DockId=0x00000009,0 +[Window][Editor] +Pos=374,27 +Size=1212,770 +Collapsed=0 +DockId=0x00000003,0 + [Docking][Data] DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=8,27 Size=1904,1142 Split=X Selected=0xF7365A5A DockNode ID=0x00000009 Parent=0x14621557 SizeRef=364,1142 HiddenTabBar=1 Selected=0x3DC5AC3F @@ -51,7 +57,7 @@ DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=8,27 Size=1904,1142 Split= DockNode ID=0x00000007 Parent=0x0000000A SizeRef=357,1142 Selected=0x7737E8B2 DockNode ID=0x00000008 Parent=0x0000000A SizeRef=1545,1142 Split=X DockNode ID=0x00000001 Parent=0x00000008 SizeRef=1212,1142 Split=Y Selected=0xF7365A5A - DockNode ID=0x00000003 Parent=0x00000001 SizeRef=1578,770 CentralNode=1 HiddenTabBar=1 Selected=0xF7365A5A + DockNode ID=0x00000003 Parent=0x00000001 SizeRef=1578,770 CentralNode=1 HiddenTabBar=1 Selected=0xDF0EC458 DockNode ID=0x00000004 Parent=0x00000001 SizeRef=1578,370 HiddenTabBar=1 Selected=0x9DD4E196 DockNode ID=0x00000002 Parent=0x00000008 SizeRef=324,1142 Split=Y Selected=0x36DC96AB DockNode ID=0x00000005 Parent=0x00000002 SizeRef=324,748 HiddenTabBar=1 Selected=0x36DC96AB diff --git a/scenes/Cart.scene b/scenes/Cart.scene new file mode 100644 index 0000000..267b0f2 --- /dev/null +++ b/scenes/Cart.scene @@ -0,0 +1,25 @@ +Entities: + - ID: 0 + Name: Default + Components: + Mesh: + vao: 3 + indexCount: 2304 + textureID: 1 + MeshPath: assets/models/DefaultMesh.obj + Transform: + Position: [0, 0.400000006, 3.5] + Rotation: [-179.5, -135.5, 0] + Scale: [1, 1, 1] + - ID: 1 + Name: New GameObject 1 + Components: + Mesh: + vao: 1 + indexCount: 36 + textureID: 5 + MeshPath: assets/models/DefaultMesh.obj + Transform: + Position: [0, -2.9000001, -100] + Rotation: [0, 0, 0] + Scale: [100, 100, 400] \ No newline at end of file diff --git a/scenes/Default.scene b/scenes/Default.scene index 058ab86..88cfd19 100644 --- a/scenes/Default.scene +++ b/scenes/Default.scene @@ -1,122 +1,121 @@ Entities: - ID: 0 - Name: Car + Name: Carrrrr Yeaaa Components: - Mesh: - vao: 2 - indexCount: 200000 - textureID: 1 Transform: Position: [0, 2.79999995, -12.6000004] Rotation: [149.699997, -137.899994, -39.2999992] Scale: [1, 1, 1] + Mesh: + vao: 2 + indexCount: 200000 + textureID: 1 + MeshPath: assets/models/DefaultMesh.obj - ID: 1 - Name: Left Cube + Name: Cube Yay Components: + Transform: + Position: [-11.8999996, -2, -21.7999992] + Rotation: [-9, -18.6000004, -28.1000004] + Scale: [1, 1, 1] Mesh: vao: 1 indexCount: 36 textureID: 2 - Transform: - Position: [-11.6999998, -2, -21.7999992] - Rotation: [-9, -18.6000004, -28.1000004] - Scale: [1, 1, 1] + MeshPath: assets/models/DefaultMesh.obj - ID: 2 - Name: Right Cube Top + Name: Cube Yay 2 Components: + Transform: + Position: [7.80000019, -8.10000038, -20.6000004] + Rotation: [-86.3000031, 0, -66] + Scale: [1, 1, 1] Mesh: vao: 1 indexCount: 36 textureID: 3 - Transform: - Position: [8, -8.10000038, -20.6000004] - Rotation: [-86.3000031, 0, -66] - Scale: [1, 1, 1] + MeshPath: assets/models/DefaultMesh.obj - ID: 3 - Name: Center Grass + Name: Cube Yay 3 Components: + Transform: + Position: [-1.20000005, -3.4000001, -17.7000008] + Rotation: [-23.5, 15.8999996, -59.9000015] + Scale: [1, 1, 1] Mesh: vao: 1 indexCount: 36 textureID: 4 - Transform: - Position: [-0.600000024, -3.4000001, -17.7000008] - Rotation: [-23.5, 15.8999996, -59.9000015] - Scale: [1, 1, 1] + MeshPath: assets/models/DefaultMesh.obj - ID: 4 - Name: Right Most + Name: Cube Yay 4 Components: + Transform: + Position: [8.10000038, 0.800000012, -12] + Rotation: [-17.2999992, -16.1000004, -19.2999992] + Scale: [1, 1, 1] Mesh: vao: 1 indexCount: 36 textureID: 5 - Transform: - Position: [8.10000038, 0.5, -12] - Rotation: [-17.2999992, -16.1000004, -19.2999992] - Scale: [1, 1, 1] + MeshPath: assets/models/DefaultMesh.obj - ID: 5 - Name: Left Screen Mirror + Name: Colormap Components: - Transform: - Position: [-6.80000019, 2.29999995, -13.8000002] - Rotation: [-39.7000008, 0, -33.2000008] - Scale: [1, 1, 1] Mesh: vao: 1 indexCount: 36 textureID: 6 + MeshPath: assets/models/DefaultMesh.obj + Transform: + Position: [-6.80000019, 2.70000005, -13.8000002] + Rotation: [-39.7000008, 0, -33.2000008] + Scale: [1, 1, 1] - ID: 6 - Name: Top Left + Name: Cube Yay 6 Components: + Transform: + Position: [-6.5, -6, -18] + Rotation: [15.8000002, -18.2000008, -11.1000004] + Scale: [1, 1, 1] Mesh: vao: 1 indexCount: 36 textureID: 3 - Transform: - Position: [-6.9000001, -6, -18] - Rotation: [15.8000002, -18.2000008, -11.1000004] - Scale: [1, 1, 1] + MeshPath: assets/models/DefaultMesh.obj - ID: 7 - Name: Bottom Grass + Name: Cube Yay 7 Components: - Mesh: - vao: 1 - indexCount: 36 - textureID: 4 Transform: Position: [6.5, 1.79999995, -23.8999996] Rotation: [-16.1000004, -15.8999996, -35] Scale: [1, 1, 1] + Mesh: + vao: 1 + indexCount: 36 + textureID: 4 + MeshPath: assets/models/DefaultMesh.obj - ID: 8 - Name: Back Wood + Name: Cube Yay 8 Components: + Transform: + Position: [-7.80000019, 0.200000003, -29.7999992] + Rotation: [22.5, -32.7999992, 0] + Scale: [1, 1, 1] Mesh: vao: 1 indexCount: 36 textureID: 1 - Transform: - Position: [-7.80000019, -1, -29.7999992] - Rotation: [22.5, -34.2999992, 0] - Scale: [1, 1, 1] + MeshPath: assets/models/DefaultMesh.obj - ID: 9 - Name: Right Brick + Name: Cube Yay 9 Components: + Transform: + Position: [5.5, -2.9000001, -19.5] + Rotation: [-41.4000015, -22.6000004, -52.2999992] + Scale: [1, 1, 1] Mesh: vao: 1 indexCount: 36 textureID: 2 - Transform: - Position: [5.5, -3.20000005, -19.5] - Rotation: [-41.4000015, -24.8999996, -52.2999992] - Scale: [1, 1, 1] - - ID: 10 - Name: Plant - Components: - Mesh: - vao: 3 - indexCount: 589632 - textureID: 5 - Transform: - Position: [0, 1.29999995, -2] - Rotation: [-180, -58.5999985, 0] - Scale: [0.5, 0.5, 0.5] \ No newline at end of file + MeshPath: assets/models/DefaultMesh.obj \ No newline at end of file diff --git a/src/Componenets/GameObject.cpp b/src/Componenets/GameObject.cpp index b0cd515..2dc9a25 100644 --- a/src/Componenets/GameObject.cpp +++ b/src/Componenets/GameObject.cpp @@ -103,6 +103,7 @@ void GameObject::Deserialize(const YAML::Node &node) + //} //else if (compName == MeshComponent::GetStaticName()) //{ diff --git a/src/Componenets/Mesh.cpp b/src/Componenets/Mesh.cpp index d9200a5..42d304d 100644 --- a/src/Componenets/Mesh.cpp +++ b/src/Componenets/Mesh.cpp @@ -1,5 +1,12 @@ #include "Mesh.h" +#include "Engine/AssetManager.h" +#include "gcml.h" + +#include "../Engine/AssetManager.h" + + +extern AssetManager *g_AssetManager; //TODO: Make this have a OBJ path, make indexCount derive from AssetManager //TODO: and make texture id also get from AssetManager @@ -8,7 +15,7 @@ const std::string MeshComponent::name = "Mesh"; MeshComponent::MeshComponent() - : vao(0), indexCount(0), textureID(0) + : vao(0), indexCount(0), textureID(0), MeshPath("assets/models/DefaultMesh.obj") { } @@ -30,6 +37,12 @@ YAML::Node MeshComponent::Serialize() node["indexCount"] = static_cast(indexCount); node["textureID"] = static_cast(textureID); + node["MeshPath"] = static_cast(MeshPath); + + + + + return node; @@ -49,4 +62,24 @@ void MeshComponent::Deserialize(const YAML::Node& node) { textureID = static_cast(node["textureID"].as()); } + + + if (node["MeshPath"]) + { + MeshPath = static_cast(node["MeshPath"].as()); + g_AssetManager->DebugAssetMap(); + + #if 1 + + DEBUG_PRINT("Loading Mesh: >%s<", MeshPath.c_str()); + + Model* model = g_AssetManager->loadAsset(AssetType::MODEL, MeshPath.c_str()); + DEBUG_PRINT("Model loaded successfully with %lld vertices and %lld indices.", model->vertices.size(), model->indices.size()); + + #else + + DEBUG_PRINT("Automatic Mesh Loading Disabled."); + + #endif + } } diff --git a/src/Componenets/Mesh.h b/src/Componenets/Mesh.h index 8ededa3..6351776 100644 --- a/src/Componenets/Mesh.h +++ b/src/Componenets/Mesh.h @@ -15,6 +15,9 @@ public: GLuint indexCount = 0; // Number of indices to draw GLuint textureID = 0; // The texture handle + + std::string MeshPath; + MeshComponent(); virtual const std::string& GetName() const override; static const std::string& GetStaticName(); diff --git a/src/Engine.cpp b/src/Engine.cpp index 47e4387..82d4a36 100644 --- a/src/Engine.cpp +++ b/src/Engine.cpp @@ -150,7 +150,7 @@ void MyEngine::Run() // printf("Got Valid Mesh Component\n"); mesh->vao = CreateCubeVAO(); mesh->indexCount = 36; - mesh->textureID = static_cast(reinterpret_cast(g_AssetManager.loadAsset(AssetType::TEXTURE, "assets/textures/wood.png"))); + mesh->textureID = g_AssetManager.loadAsset(AssetType::TEXTURE, "assets/textures/wood.png"); } else { @@ -171,12 +171,14 @@ void MyEngine::Run() DEBUG_PRINT("Could not find Transform Component"); } - g_AssetManager.loadAsset(AssetType::TEXTURE, "assets/textures/bricks.png"); - g_AssetManager.loadAsset(AssetType::TEXTURE, "assets/textures/default.png"); - g_AssetManager.loadAsset(AssetType::TEXTURE, "assets/textures/lush_grass.png"); + g_AssetManager.loadAsset(AssetType::TEXTURE, "assets/textures/bricks.png"); + g_AssetManager.loadAsset(AssetType::TEXTURE, "assets/textures/default.png"); + g_AssetManager.loadAsset(AssetType::TEXTURE, "assets/textures/lush_grass.png"); + g_AssetManager.loadAsset(AssetType::TEXTURE, "assets/textures/vegetation_tree_bark_40.png"); + // Load a model - void* modelPtr = g_AssetManager.loadAsset(AssetType::MODEL, "assets/models/LowPolyFiatUNO.obj"); + Model* modelPtr = g_AssetManager.loadAsset(AssetType::MODEL, "assets/models/LowPolyFiatUNO.obj"); if (modelPtr == nullptr) { DEBUG_PRINT("Failed to load model."); @@ -188,18 +190,11 @@ void MyEngine::Run() } -// Load a model - void* modelPtr2 = g_AssetManager.loadAsset(AssetType::MODEL, "assets/models/OutSidePlant.obj"); - if (modelPtr2 == nullptr) - { - DEBUG_PRINT("Failed to load model."); - } - else - { - Model* model2 = reinterpret_cast(modelPtr2); - DEBUG_PRINT("Model loaded successfully with %lld vertices and %lld indices.", model2->vertices.size(), model2->indices.size()); - } + Model* modelPtr4 = g_AssetManager.loadAsset(AssetType::MODEL, "assets/models/shopping-cart.obj"); + Model* model4 = reinterpret_cast(modelPtr4); + + DEBUG_PRINT("Model loaded successfully with %lld vertices and %lld indices.", model4->vertices.size(), model4->indices.size()); g_GameObjects.push_back(newGameObject); diff --git a/src/Engine/AssetManager.cpp b/src/Engine/AssetManager.cpp index f1e950a..1883ad5 100644 --- a/src/Engine/AssetManager.cpp +++ b/src/Engine/AssetManager.cpp @@ -6,66 +6,65 @@ #include #include #include + +#include +#include + #define STB_IMAGE_IMPLEMENTATION #include "stb/stb_image.h" #include "imgui.h" +#include "gcml.h" #include "Windows/LoggerWindow.h" #include "Rendering/Shader.h" -#include "gcml.h" +GLuint LoadTextureFromList(const std::string &path); +Shader *LoadShaderFromList(const std::string &path); +Model *LoadModelFromList(const std::string &path); -#include - -int LoaddedAssets = 0; +int LoadedAssets = 0; extern LoggerWindow *g_LoggerWindow; - -std::string getDirectoryPath(const std::string& fullPath) { +std::string getDirectoryPath(const std::string &fullPath) +{ std::filesystem::path pathObj(fullPath); std::filesystem::path dir = pathObj.parent_path(); return dir.string(); } - - -void *AssetManager::loadAsset(AssetType type, const std::string &path) +void AssetManager::DebugAssetMap() { - // 1) Create a unique key for cache lookup - std::string key = generateKey(type, path); - - // 2) Check if it’s already loaded - auto it = m_AssetMap.find(key); - if (it != m_AssetMap.end()) + std::cout << "[AssetManager] Debugging m_AssetMap:" << std::endl; + int i = 0; + for (const auto &[key, value] : m_AssetMap) { - // Return existing pointer - return it->second.data; + std::cout << " Key: " << key << ", Type Index: " << value.index() << std::endl; + i++; } - - // 3) Not loaded yet, load from disk - void *assetData = loadAssetFromDisk(type, path); - if (!assetData) + if (i == 0) { - - DEBUG_PRINT("[AssetManager] Failed to load asset: %s", path.c_str()); - g_LoggerWindow->AddLog("[AsseetManager] Failed to load asset: %s", ImVec4(1.0f, 0.0f, 0.0f, 1.0f), path.c_str()); - - return nullptr; + DEBUG_PRINT("No Cashed Assets"); } +} - // 4) Store in cache - GenericAsset newAsset; - newAsset.data = assetData; - m_AssetMap[key] = newAsset; - - LoaddedAssets += 1; - - g_LoggerWindow->AddLog("[AsseetManager] Loadded Asset: %s", path.c_str()); - - // 5) Return pointer - return assetData; +// Implementation of AssetManager::loadAssetFromDisk +AssetManager::AssetVariant AssetManager::loadAssetFromDisk(AssetType type, const std::string &path) +{ + switch (type) + { + case AssetType::TEXTURE: + return LoadTextureFromList(path); // Returns GLuint + case AssetType::SHADER: + return LoadShaderFromList(path); // Returns Shader* + case AssetType::SOUND: + return std::string("Loaded sound: " + path); // Example placeholder for sound + case AssetType::MODEL: + return LoadModelFromList(path); // Returns Model* + default: + throw std::invalid_argument("Unknown AssetType"); + } } std::string AssetManager::generateKey(AssetType type, const std::string &path) @@ -73,375 +72,361 @@ std::string AssetManager::generateKey(AssetType type, const std::string &path) return std::to_string(static_cast(type)) + ":" + path; } -void *AssetManager::loadAssetFromDisk(AssetType type, const std::string &path) +GLuint LoadTextureFromList(const std::string &path) { - switch (type) + // -------------------------------------------- + // Load a texture with stb_image + // -------------------------------------------- + std::cout << "[AssetManager] Loading TEXTURE from: " << path << std::endl; + + int width, height, channels; + unsigned char *data = stbi_load(path.c_str(), &width, &height, &channels, 0); + if (!data) { - case AssetType::TEXTURE: - { - // -------------------------------------------- - // Load a texture with stb_image - // -------------------------------------------- - std::cout << "[AssetManager] Loading TEXTURE from: " << path << std::endl; - - int width, height, channels; - unsigned char *data = stbi_load(path.c_str(), &width, &height, &channels, 0); - if (!data) - { - std::cerr << "[AssetManager] stb_image failed for: " << path << std::endl; - return nullptr; - } - - GLenum format = GL_RGBA; - if (channels == 1) - format = GL_RED; - else if (channels == 3) - format = GL_RGB; - // if channels == 4, already GL_RGBA - - GLuint texID = 0; - glGenTextures(1, &texID); - glBindTexture(GL_TEXTURE_2D, texID); - - glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, - format, GL_UNSIGNED_BYTE, data); - glGenerateMipmap(GL_TEXTURE_2D); - - // Set texture params - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - // Cleanup - glBindTexture(GL_TEXTURE_2D, 0); - stbi_image_free(data); - - // Return as void* - return reinterpret_cast(static_cast(texID)); + std::cerr << "[AssetManager] stb_image failed for: " << path << std::endl; + return 0; } - case AssetType::SHADER: + GLenum format = GL_RGBA; + if (channels == 1) + format = GL_RED; + else if (channels == 3) + format = GL_RGB; + // if channels == 4, already GL_RGBA + + GLuint texID = 0; + glGenTextures(1, &texID); + glBindTexture(GL_TEXTURE_2D, texID); + + glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, + format, GL_UNSIGNED_BYTE, data); + glGenerateMipmap(GL_TEXTURE_2D); + + // Set texture params + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + // Cleanup + glBindTexture(GL_TEXTURE_2D, 0); + stbi_image_free(data); + + // Return as void* + return texID; +} + +Shader *LoadShaderFromList(const std::string &path) +{ + // -------------------------------------------- + // Load a shader using your existing "Shader" class + // -------------------------------------------- + // Example usage: path = "shaders/UnlitMaterial" => + // loads "shaders/UnlitMaterial.vert" and "shaders/UnlitMaterial.frag" + std::cout << "[AssetManager] Loading SHADER from: " << path << std::endl; + + // Create a new Shader object on the heap + Shader *newShader = new Shader(); + + // Build actual paths from the base path + std::string vertPath = path + ".vert"; + std::string fragPath = path + ".frag"; + + // Attempt to load + if (!newShader->Load(vertPath, fragPath)) { - // -------------------------------------------- - // Load a shader using your existing "Shader" class - // -------------------------------------------- - // Example usage: path = "shaders/UnlitMaterial" => - // loads "shaders/UnlitMaterial.vert" and "shaders/UnlitMaterial.frag" - std::cout << "[AssetManager] Loading SHADER from: " << path << std::endl; - - // Create a new Shader object on the heap - Shader *newShader = new Shader(); - - // Build actual paths from the base path - std::string vertPath = path + ".vert"; - std::string fragPath = path + ".frag"; - - // Attempt to load - if (!newShader->Load(vertPath, fragPath)) - { - std::cerr << "[AssetManager] Could not load shader: " - << vertPath << " / " << fragPath << std::endl; - delete newShader; // Cleanup - return nullptr; - } - - // Return as void* - return reinterpret_cast(newShader); - } - - case AssetType::SOUND: - { - std::cout << "[AssetManager] Loading SOUND from: " << path << std::endl; - // Stub or real code to load .wav / .ogg - return (void *)0xAAAA8888; // placeholder - } - case AssetType::MODEL: - { - // -------------------------------------------- - // Load an OBJ model - // -------------------------------------------- - std::cout << "[AssetManager] Loading MODEL from: " << path << std::endl; - - std::ifstream objFile(path); - if (!objFile.is_open()) - { - DEBUG_PRINT("[AssetManager] Failed to open OBJ file: %s\n", path.c_str()); - return nullptr; - } - - std::vector temp_positions; - std::vector temp_texCoords; - std::vector temp_normals; - std::vector vertexIndices, texCoordIndices, normalIndices; - - std::string directory; - size_t lastSlash = path.find_last_of("/\\"); - if (lastSlash != std::string::npos) - directory = path.substr(0, lastSlash + 1); - else - directory = ""; - - - DEBUG_PRINT("[AssetManager] Asset Directory: %s", directory.c_str()); - - std::string line; - std::string mtlFileName; - while (std::getline(objFile, line)) - { - std::istringstream iss(line); - std::string prefix; - iss >> prefix; - if (prefix == "v") - { - float x, y, z; - iss >> x >> y >> z; - temp_positions.push_back(x); - temp_positions.push_back(y); - temp_positions.push_back(z); - } - else if (prefix == "vt") - { - float u, v; - iss >> u >> v; - temp_texCoords.push_back(u); - temp_texCoords.push_back(v); - } - else if (prefix == "vn") - { - float nx, ny, nz; - iss >> nx >> ny >> nz; - temp_normals.push_back(nx); - temp_normals.push_back(ny); - temp_normals.push_back(nz); - } - else if (prefix == "f") - { - std::string vertexStr; - std::vector> faceVertices; - while (iss >> vertexStr) - { - unsigned int vIdx = 0, tIdx = 0, nIdx = 0; - size_t firstSlash = vertexStr.find('/'); - size_t secondSlash = vertexStr.find('/', firstSlash + 1); - - if (firstSlash == std::string::npos) - { - // Format: f v1 v2 v3 - vIdx = std::stoi(vertexStr); - } - else if (secondSlash == std::string::npos) - { - // Format: f v1/vt1 v2/vt2 v3/vt3 - vIdx = std::stoi(vertexStr.substr(0, firstSlash)); - tIdx = std::stoi(vertexStr.substr(firstSlash + 1)); - } - else if (secondSlash > firstSlash + 1) - { - // Format: f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 - vIdx = std::stoi(vertexStr.substr(0, firstSlash)); - tIdx = std::stoi(vertexStr.substr(firstSlash + 1, secondSlash - firstSlash - 1)); - nIdx = std::stoi(vertexStr.substr(secondSlash + 1)); - } - else - { - // Format: f v1//vn1 v2//vn2 v3//vn3 - vIdx = std::stoi(vertexStr.substr(0, firstSlash)); - nIdx = std::stoi(vertexStr.substr(secondSlash + 1)); - } - - faceVertices.emplace_back(vIdx, tIdx, nIdx); - } - - // Triangulate if the face has more than 3 vertices (optional) - for (size_t i = 1; i + 1 < faceVertices.size(); ++i) - { - vertexIndices.push_back(std::get<0>(faceVertices[0])); - texCoordIndices.push_back(std::get<1>(faceVertices[0])); - normalIndices.push_back(std::get<2>(faceVertices[0])); - - vertexIndices.push_back(std::get<0>(faceVertices[i])); - texCoordIndices.push_back(std::get<1>(faceVertices[i])); - normalIndices.push_back(std::get<2>(faceVertices[i])); - - vertexIndices.push_back(std::get<0>(faceVertices[i + 1])); - texCoordIndices.push_back(std::get<1>(faceVertices[i + 1])); - normalIndices.push_back(std::get<2>(faceVertices[i + 1])); - } - } - - else if (prefix == "mtllib") - { - iss >> mtlFileName; - } - } - - objFile.close(); - - // Load MTL file if specified - std::string texturePath; - if (!mtlFileName.empty()) - { - std::ifstream mtlFile(directory + mtlFileName); - if (mtlFile.is_open()) - { - while (std::getline(mtlFile, line)) - { - std::istringstream mtlIss(line); - std::string mtlPrefix; - mtlIss >> mtlPrefix; - if (mtlPrefix == "map_Kd") - { - mtlIss >> texturePath; - break; // Assuming only one texture map for simplicity - } - } - mtlFile.close(); - } - else - { - DEBUG_PRINT("[AssetManager] Failed to open MTL file: %s", mtlFileName.c_str()); - } - } - - if (texturePath.empty()) - { - DEBUG_PRINT("[AssetManager] No texture found for OBJ: %s", path.c_str()); - - } - else - { - DEBUG_PRINT("[AssetManager] Texture for OBJ: %s%s", directory.c_str(), texturePath.c_str()); - - } - - // Create Model object - Model *model = new Model(); - - // Populate vertices - std::unordered_map uniqueVertices; - for (size_t i = 0; i < vertexIndices.size(); ++i) - { - std::ostringstream keyStream; - keyStream << vertexIndices[i] << "/" << texCoordIndices[i] << "/" << normalIndices[i]; - std::string key = keyStream.str(); - - if (uniqueVertices.find(key) == uniqueVertices.end()) - { - Vertex vertex; - // OBJ indices are 1-based - vertex.position[0] = temp_positions[(vertexIndices[i] - 1) * 3]; - vertex.position[1] = temp_positions[(vertexIndices[i] - 1) * 3 + 1]; - vertex.position[2] = temp_positions[(vertexIndices[i] - 1) * 3 + 2]; - - if (!temp_texCoords.empty()) - { - vertex.texCoord[0] = temp_texCoords[(texCoordIndices[i] - 1) * 2]; - vertex.texCoord[1] = temp_texCoords[(texCoordIndices[i] - 1) * 2 + 1]; - } - else - { - vertex.texCoord[0] = 0.0f; - vertex.texCoord[1] = 0.0f; - } - - if (!temp_normals.empty()) - { - vertex.normal[0] = temp_normals[(normalIndices[i] - 1) * 3]; - vertex.normal[1] = temp_normals[(normalIndices[i] - 1) * 3 + 1]; - vertex.normal[2] = temp_normals[(normalIndices[i] - 1) * 3 + 2]; - } - else - { - vertex.normal[0] = 0.0f; - vertex.normal[1] = 0.0f; - vertex.normal[2] = 0.0f; - } - - model->vertices.push_back(vertex); - unsigned int newIndex = static_cast(model->vertices.size() - 1); - uniqueVertices[key] = newIndex; - model->indices.push_back(newIndex); - } - else - { - model->indices.push_back(uniqueVertices[key]); - } - } - - // Generate OpenGL buffers - glGenVertexArrays(1, &model->vao); - glGenBuffers(1, &model->vbo); - glGenBuffers(1, &model->ebo); - - glBindVertexArray(model->vao); - - glBindBuffer(GL_ARRAY_BUFFER, model->vbo); - glBufferData(GL_ARRAY_BUFFER, model->vertices.size() * sizeof(Vertex), model->vertices.data(), GL_STATIC_DRAW); - - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, model->ebo); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, model->indices.size() * sizeof(unsigned int), model->indices.data(), GL_STATIC_DRAW); - - // Vertex positions - glEnableVertexAttribArray(0); - glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)0); - // Texture coordinates - glEnableVertexAttribArray(1); - glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)(3 * sizeof(float))); - // Normals - glEnableVertexAttribArray(2); - glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)(5 * sizeof(float))); - - glBindVertexArray(0); - - // Load texture if available - if (!texturePath.empty()) - { - int width, height, channels; - unsigned char *data = stbi_load((directory + texturePath).c_str(), &width, &height, &channels, 0); - if (!data) - { - DEBUG_PRINT("[AssetManager] stb_image failed to load texture: %s", (directory + texturePath).c_str()); - } - else - { - GLenum format = GL_RGBA; - if (channels == 1) - format = GL_RED; - else if (channels == 3) - format = GL_RGB; - // if channels == 4, already GL_RGBA - - glGenTextures(1, &model->textureID); - glBindTexture(GL_TEXTURE_2D, model->textureID); - - glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, - format, GL_UNSIGNED_BYTE, data); - glGenerateMipmap(GL_TEXTURE_2D); - - // Set texture params - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - glBindTexture(GL_TEXTURE_2D, 0); - stbi_image_free(data); - } - } - else - { - model->textureID = 0; // No texture - } - - // Return the Model pointer as void* - return reinterpret_cast(model); - } - - default: - { - std::cerr << "[AssetManager] Unknown asset type for: " << path << std::endl; + std::cerr << "[AssetManager] Could not load shader: " + << vertPath << " / " << fragPath << std::endl; + delete newShader; // Cleanup return nullptr; } - } + + // Return as void* + return newShader; +} + +// case AssetType::SOUND: +//{ +// std::cout << "[AssetManager] Loading SOUND from: " << path << std::endl; +// // Stub or real code to load .wav / .ogg +// return (void *)0xAAAA8888; // placeholder +// } + +Model *LoadModelFromList(const std::string &path) +{ + // -------------------------------------------- + // Load an OBJ model + // -------------------------------------------- + std::cout << "[AssetManager] Loading MODEL from: " << path << std::endl; + + std::ifstream objFile(path); + if (!objFile.is_open()) + { + DEBUG_PRINT("[AssetManager] Failed to open OBJ file: %s\n", path.c_str()); + return nullptr; + } + + std::vector temp_positions; + std::vector temp_texCoords; + std::vector temp_normals; + std::vector vertexIndices, texCoordIndices, normalIndices; + + std::string directory; + size_t lastSlash = path.find_last_of("/\\"); + if (lastSlash != std::string::npos) + directory = path.substr(0, lastSlash + 1); + else + directory = ""; + + DEBUG_PRINT("[AssetManager] Asset Directory: %s", directory.c_str()); + + std::string line; + std::string mtlFileName; + while (std::getline(objFile, line)) + { + std::istringstream iss(line); + std::string prefix; + iss >> prefix; + if (prefix == "v") + { + float x, y, z; + iss >> x >> y >> z; + temp_positions.push_back(x); + temp_positions.push_back(y); + temp_positions.push_back(z); + } + else if (prefix == "vt") + { + float u, v; + iss >> u >> v; + temp_texCoords.push_back(u); + temp_texCoords.push_back(v); + } + else if (prefix == "vn") + { + float nx, ny, nz; + iss >> nx >> ny >> nz; + temp_normals.push_back(nx); + temp_normals.push_back(ny); + temp_normals.push_back(nz); + } + else if (prefix == "f") + { + std::string vertexStr; + std::vector> faceVertices; + while (iss >> vertexStr) + { + unsigned int vIdx = 0, tIdx = 0, nIdx = 0; + size_t firstSlash = vertexStr.find('/'); + size_t secondSlash = vertexStr.find('/', firstSlash + 1); + + if (firstSlash == std::string::npos) + { + // Format: f v1 v2 v3 + vIdx = std::stoi(vertexStr); + } + else if (secondSlash == std::string::npos) + { + // Format: f v1/vt1 v2/vt2 v3/vt3 + vIdx = std::stoi(vertexStr.substr(0, firstSlash)); + tIdx = std::stoi(vertexStr.substr(firstSlash + 1)); + } + else if (secondSlash > firstSlash + 1) + { + // Format: f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 + vIdx = std::stoi(vertexStr.substr(0, firstSlash)); + tIdx = std::stoi(vertexStr.substr(firstSlash + 1, secondSlash - firstSlash - 1)); + nIdx = std::stoi(vertexStr.substr(secondSlash + 1)); + } + else + { + // Format: f v1//vn1 v2//vn2 v3//vn3 + vIdx = std::stoi(vertexStr.substr(0, firstSlash)); + nIdx = std::stoi(vertexStr.substr(secondSlash + 1)); + } + + faceVertices.emplace_back(vIdx, tIdx, nIdx); + } + + // Triangulate if the face has more than 3 vertices (optional) + for (size_t i = 1; i + 1 < faceVertices.size(); ++i) + { + vertexIndices.push_back(std::get<0>(faceVertices[0])); + texCoordIndices.push_back(std::get<1>(faceVertices[0])); + normalIndices.push_back(std::get<2>(faceVertices[0])); + + vertexIndices.push_back(std::get<0>(faceVertices[i])); + texCoordIndices.push_back(std::get<1>(faceVertices[i])); + normalIndices.push_back(std::get<2>(faceVertices[i])); + + vertexIndices.push_back(std::get<0>(faceVertices[i + 1])); + texCoordIndices.push_back(std::get<1>(faceVertices[i + 1])); + normalIndices.push_back(std::get<2>(faceVertices[i + 1])); + } + } + + else if (prefix == "mtllib") + { + iss >> mtlFileName; + } + } + + objFile.close(); + + // Load MTL file if specified + std::string texturePath; + if (!mtlFileName.empty()) + { + std::ifstream mtlFile(directory + mtlFileName); + if (mtlFile.is_open()) + { + while (std::getline(mtlFile, line)) + { + std::istringstream mtlIss(line); + std::string mtlPrefix; + mtlIss >> mtlPrefix; + if (mtlPrefix == "map_Kd") + { + mtlIss >> texturePath; + break; // Assuming only one texture map for simplicity + } + } + mtlFile.close(); + } + else + { + DEBUG_PRINT("[AssetManager] Failed to open MTL file: %s", mtlFileName.c_str()); + } + } + + if (texturePath.empty()) + { + DEBUG_PRINT("[AssetManager] No texture found for OBJ: %s", path.c_str()); + } + else + { + DEBUG_PRINT("[AssetManager] Texture for OBJ: %s%s", directory.c_str(), texturePath.c_str()); + } + + // Create Model object + Model *model = new Model(); + + // Populate vertices + std::unordered_map uniqueVertices; + for (size_t i = 0; i < vertexIndices.size(); ++i) + { + std::ostringstream keyStream; + keyStream << vertexIndices[i] << "/" << texCoordIndices[i] << "/" << normalIndices[i]; + std::string key = keyStream.str(); + + if (uniqueVertices.find(key) == uniqueVertices.end()) + { + Vertex vertex; + // OBJ indices are 1-based + vertex.position[0] = temp_positions[(vertexIndices[i] - 1) * 3]; + vertex.position[1] = temp_positions[(vertexIndices[i] - 1) * 3 + 1]; + vertex.position[2] = temp_positions[(vertexIndices[i] - 1) * 3 + 2]; + + if (!temp_texCoords.empty()) + { + vertex.texCoord[0] = temp_texCoords[(texCoordIndices[i] - 1) * 2]; + vertex.texCoord[1] = temp_texCoords[(texCoordIndices[i] - 1) * 2 + 1]; + } + else + { + vertex.texCoord[0] = 0.0f; + vertex.texCoord[1] = 0.0f; + } + + if (!temp_normals.empty()) + { + vertex.normal[0] = temp_normals[(normalIndices[i] - 1) * 3]; + vertex.normal[1] = temp_normals[(normalIndices[i] - 1) * 3 + 1]; + vertex.normal[2] = temp_normals[(normalIndices[i] - 1) * 3 + 2]; + } + else + { + vertex.normal[0] = 0.0f; + vertex.normal[1] = 0.0f; + vertex.normal[2] = 0.0f; + } + + model->vertices.push_back(vertex); + unsigned int newIndex = static_cast(model->vertices.size() - 1); + uniqueVertices[key] = newIndex; + model->indices.push_back(newIndex); + } + else + { + model->indices.push_back(uniqueVertices[key]); + } + } + + // Generate OpenGL buffers + glGenVertexArrays(1, &model->vao); + glGenBuffers(1, &model->vbo); + glGenBuffers(1, &model->ebo); + + glBindVertexArray(model->vao); + + glBindBuffer(GL_ARRAY_BUFFER, model->vbo); + glBufferData(GL_ARRAY_BUFFER, model->vertices.size() * sizeof(Vertex), model->vertices.data(), GL_STATIC_DRAW); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, model->ebo); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, model->indices.size() * sizeof(unsigned int), model->indices.data(), GL_STATIC_DRAW); + + // Vertex positions + glEnableVertexAttribArray(0); + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)0); + // Texture coordinates + glEnableVertexAttribArray(1); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)(3 * sizeof(float))); + // Normals + glEnableVertexAttribArray(2); + glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)(5 * sizeof(float))); + + glBindVertexArray(0); + + // Load texture if available + if (!texturePath.empty()) + { + int width, height, channels; + unsigned char *data = stbi_load((directory + texturePath).c_str(), &width, &height, &channels, 0); + if (!data) + { + DEBUG_PRINT("[AssetManager] stb_image failed to load texture: %s", (directory + texturePath).c_str()); + } + else + { + GLenum format = GL_RGBA; + if (channels == 1) + format = GL_RED; + else if (channels == 3) + format = GL_RGB; + // if channels == 4, already GL_RGBA + + glGenTextures(1, &model->textureID); + glBindTexture(GL_TEXTURE_2D, model->textureID); + + glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, + format, GL_UNSIGNED_BYTE, data); + glGenerateMipmap(GL_TEXTURE_2D); + + // Set texture params + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + glBindTexture(GL_TEXTURE_2D, 0); + stbi_image_free(data); + } + } + else + { + model->textureID = 0; // No texture + } + + // Return the Model pointer as void* + return model; } diff --git a/src/Engine/AssetManager.h b/src/Engine/AssetManager.h index 9c95832..61cda3c 100644 --- a/src/Engine/AssetManager.h +++ b/src/Engine/AssetManager.h @@ -4,6 +4,10 @@ #include #include #include +#include +#include "gcml.h" +#include "stdexcept" +#include // Forward-declare your Shader class class Shader; @@ -20,18 +24,18 @@ enum class AssetType // A simple struct to hold the generic pointer struct GenericAsset { - void* data = nullptr; + void *data = nullptr; }; - -struct Vertex { +struct Vertex +{ float position[3]; float texCoord[2]; float normal[3]; }; - -struct Model { +struct Model +{ std::vector vertices; std::vector indices; GLuint vao; @@ -47,23 +51,74 @@ struct Model { class AssetManager { public: - AssetManager() = default; + AssetManager() = default; ~AssetManager() = default; + using AssetVariant = std::variant; + // Load an asset from disk (texture, shader, etc.) // Returns a void* pointer to the loaded resource. - // - For TEXTURE, cast to (GLuint) - // - For SHADER, cast to (Shader*) + // - For TEXTURE, cast to (GLuint) + // - For SHADER, cast to (Shader*) // - For SOUND, cast to whatever you store - void* loadAsset(AssetType type, const std::string& path); + + // Template function to load an asset + // Template function to load an asset + template + T loadAsset(AssetType type, const std::string &path) + { + // 1) Create a unique key for cache lookup + std::string key = generateKey(type, path); + + // 2) Check if it’s already loaded + auto it = m_AssetMap.find(key); + if (it != m_AssetMap.end()) + { + // Debug: Log the variant type + std::cout << "[AssetManager] Found asset in map." << std::endl; + if (std::holds_alternative(it->second)) + { + return std::get(it->second); + } + else + { + throw std::runtime_error("Asset type mismatch for key: " + key); + } + } + + // 3) Not loaded yet, load from disk + AssetVariant assetData = loadAssetFromDisk(type, path); + + if (assetData.index() == std::variant_npos) + { + DEBUG_PRINT("[AssetManager] Failed to load asset: %s", path.c_str()); + // Replace NULL with 0 for non-pointer types + if constexpr (std::is_pointer_v) + { + return nullptr; // For pointers + } + else + { + return 0; // For non-pointer types + } + } + + // 4) Store in cache + m_AssetMap[key] = assetData; + + DEBUG_PRINT("[AssetManager] Loaded Asset: %s", path.c_str()); + + // 5) Return the loaded asset + return std::get(assetData); + } + + void DebugAssetMap(); private: // Cache of already loaded assets: key = "type + path" - std::unordered_map m_AssetMap; + std::unordered_map m_AssetMap; + AssetVariant loadAssetFromDisk(AssetType type, const std::string &path); // Generate the unique key - std::string generateKey(AssetType type, const std::string& path); - - // Actual loading from disk - void* loadAssetFromDisk(AssetType type, const std::string& path); + std::string generateKey(AssetType type, const std::string &path); }; diff --git a/src/Windows/InspectorWindow.cpp b/src/Windows/InspectorWindow.cpp index 7c4813a..67b3afa 100644 --- a/src/Windows/InspectorWindow.cpp +++ b/src/Windows/InspectorWindow.cpp @@ -320,6 +320,18 @@ void InspectorWindow::Show() { mesh->textureID = static_cast(textureID); } + // Define a maximum buffer size + const size_t BUFFER_SIZE = 256; + // Allocate a buffer and initialize it with the current string + char buffer[BUFFER_SIZE]; + strncpy(buffer, mesh->MeshPath.c_str(), BUFFER_SIZE - 1); + buffer[BUFFER_SIZE - 1] = '\0'; // Ensure null-termination + // Render the InputText widget + if (ImGui::InputText(mesh->MeshPath.c_str(), buffer, BUFFER_SIZE)) + { + // Update the string if user made changes + mesh->MeshPath = buffer; + } } } ImGui::Spacing(); diff --git a/src/Windows/PerformanceWindow.cpp b/src/Windows/PerformanceWindow.cpp index 8f91591..c3c4990 100644 --- a/src/Windows/PerformanceWindow.cpp +++ b/src/Windows/PerformanceWindow.cpp @@ -6,7 +6,7 @@ -extern int LoaddedAssets; +extern int LoadedAssets; extern int g_GPU_Triangles_drawn_to_screen; const char* polygonModeOptions[] = { "Fill", "Wireframe", "Points" }; @@ -160,7 +160,7 @@ void PerformanceWindow::Show(float fps, float ms) ImGui::Separator(); // Show asset count - ImGui::TextColored(ImVec4(0.4f, 1.0f, 0.4f, 1.0f), "Assets: %d", LoaddedAssets); + ImGui::TextColored(ImVec4(0.4f, 1.0f, 0.4f, 1.0f), "Assets: %d", LoadedAssets); ImGui::Separator(); diff --git a/src/Windows/RenderWindow.cpp b/src/Windows/RenderWindow.cpp index 947166a..54b22b6 100644 --- a/src/Windows/RenderWindow.cpp +++ b/src/Windows/RenderWindow.cpp @@ -231,7 +231,7 @@ void RenderWindow::InitGLResources() // ---------------------------------------------------- { - void *shaderAsset = g_AssetManager.loadAsset(AssetType::SHADER, "assets/shaders/UnlitMaterial"); + Shader* shaderAsset = g_AssetManager.loadAsset(AssetType::SHADER, "assets/shaders/UnlitMaterial"); if (!shaderAsset) { fprintf(stderr, "[RenderWindow] Failed to load shader via AssetManager.\n"); @@ -270,7 +270,7 @@ void RenderWindow::InitGLResources() // 3) Load TEXTURE from the asset manager // ---------------------------------------------------- { - void *texAsset = g_AssetManager.loadAsset(AssetType::TEXTURE, "assets/textures/wood.png"); + GLuint texAsset = g_AssetManager.loadAsset(AssetType::TEXTURE, "assets/textures/wood.png"); if (!texAsset) { fprintf(stderr, "[RenderWindow] Failed to load texture.\n"); @@ -278,7 +278,7 @@ void RenderWindow::InitGLResources() else { // Cast from void* to GLuint - m_TextureID = static_cast(reinterpret_cast(texAsset)); + m_TextureID = texAsset; } } diff --git a/src/Windows/SceneWindow.cpp b/src/Windows/SceneWindow.cpp index 922f84a..99f6564 100644 --- a/src/Windows/SceneWindow.cpp +++ b/src/Windows/SceneWindow.cpp @@ -31,7 +31,7 @@ std::shared_ptr CreateDefaultCube() mesh->vao = CreateCubeVAO(); mesh->indexCount = 36; - mesh->textureID = static_cast(reinterpret_cast(g_AssetManager.loadAsset(AssetType::TEXTURE, "assets/textures/wood.png"))); + mesh->textureID = g_AssetManager.loadAsset(AssetType::TEXTURE, "assets/textures/wood.png"); return newGameObject; }