diff --git a/$tmpPly.polys b/$tmpPly.polys index 68f7606..1ee440b 100644 --- a/$tmpPly.polys +++ b/$tmpPly.polys @@ -20,7 +20,7 @@ Entities: Name: Cube Components: Transform: - Position: [-1.21370173, -0.400000006, -8.60000038] + Position: [-1.21370173, 1.20000005, 0] Rotation: [1.34287302e-05, -41.9440002, 1.62548586e-05] Scale: [1, 1, 1] Render: diff --git a/assets/colormap.png b/assets/colormap.png new file mode 100644 index 0000000..c6646e2 Binary files /dev/null and b/assets/colormap.png differ diff --git a/assets/conveyor-bars.obj b/assets/conveyor-bars.obj new file mode 100644 index 0000000..644a88a --- /dev/null +++ b/assets/conveyor-bars.obj @@ -0,0 +1,452 @@ +# Created by Kenney (www.kenney.nl) + +mtllib conveyor-bars.mtl + +g conveyor-bars + +v -0.4375 0 -0.5 1 1 1 +v -0.3125 0 -0.5 1 1 1 +v -0.5 0.0625 -0.5 1 1 1 +v -0.3125 0.0625 -0.5 1 1 1 +v -0.25 0.0625 -0.5 1 1 1 +v -0.4375 0.0625 -0.5 1 1 1 +v -0.4375 0.1875 -0.5 1 1 1 +v -0.5 0.1875 -0.5 1 1 1 +v -0.4375 0.25 -0.5 1 1 1 +v -0.3125 0.1875 -0.5 1 1 1 +v -0.25 0.1875 -0.5 1 1 1 +v -0.3125 0.25 -0.5 1 1 1 +v -0.1875 0.1875 -0.5 1 1 1 +v -0.1875 0.25 -0.5 1 1 1 +v -0.0625 0.1875 -0.5 1 1 1 +v -0.0625 0.25 -0.5 1 1 1 +v -0.1875 0.0625 -0.5 1 1 1 +v 0 0.1875 -0.5 1 1 1 +v 0 0.0625 -0.5 1 1 1 +v -0.0625 0.0625 -0.5 1 1 1 +v -0.0625 0 -0.5 1 1 1 +v -0.1875 0 -0.5 1 1 1 +v 0.0625 0.1875 -0.5 1 1 1 +v 0.0625 0.25 -0.5 1 1 1 +v 0.0625 0.0625 -0.5 1 1 1 +v 0.1875 0.1875 -0.5 1 1 1 +v 0.1875 0.0625 -0.5 1 1 1 +v 0.25 0.0625 -0.5 1 1 1 +v 0.1875 0 -0.5 1 1 1 +v 0.0625 0 -0.5 1 1 1 +v 0.25 0.1875 -0.5 1 1 1 +v 0.1875 0.25 -0.5 1 1 1 +v 0.3125 0.1875 -0.5 1 1 1 +v 0.3125 0.25 -0.5 1 1 1 +v 0.3125 0.0625 -0.5 1 1 1 +v 0.4375 0.1875 -0.5 1 1 1 +v 0.4375 0.0625 -0.5 1 1 1 +v 0.5 0.1875 -0.5 1 1 1 +v 0.4375 0.25 -0.5 1 1 1 +v 0.5 0.0625 -0.5 1 1 1 +v 0.4375 0 -0.5 1 1 1 +v 0.3125 0 -0.5 1 1 1 +v -0.0625 0.25 0.5 1 1 1 +v -0.1875 0.25 0.5 1 1 1 +v 0 0.0625 0.5 1 1 1 +v -0.0625 0 0.5 1 1 1 +v -0.1875 0 0.5 1 1 1 +v -0.0625 0.0625 0.5 1 1 1 +v -0.1875 0.0625 0.5 1 1 1 +v -0.25 0.0625 0.5 1 1 1 +v -0.0625 0.1875 0.5 1 1 1 +v -0.1875 0.1875 0.5 1 1 1 +v -0.25 0.1875 0.5 1 1 1 +v 0 0.1875 0.5 1 1 1 +v -0.3125 0.1875 0.5 1 1 1 +v -0.3125 0.25 0.5 1 1 1 +v -0.4375 0.1875 0.5 1 1 1 +v -0.4375 0.25 0.5 1 1 1 +v -0.5 0.1875 0.5 1 1 1 +v -0.5 0.0625 0.5 1 1 1 +v -0.4375 0.0625 0.5 1 1 1 +v -0.3125 0.0625 0.5 1 1 1 +v -0.4375 0 0.5 1 1 1 +v -0.3125 0 0.5 1 1 1 +v 0.0625 0.1875 0.5 1 1 1 +v 0.0625 0.25 0.5 1 1 1 +v 0.1875 0.25 0.5 1 1 1 +v 0.0625 0.0625 0.5 1 1 1 +v 0.1875 0.1875 0.5 1 1 1 +v 0.1875 0.0625 0.5 1 1 1 +v 0.25 0.0625 0.5 1 1 1 +v 0.0625 0 0.5 1 1 1 +v 0.1875 0 0.5 1 1 1 +v 0.25 0.1875 0.5 1 1 1 +v 0.3125 0.1875 0.5 1 1 1 +v 0.3125 0.0625 0.5 1 1 1 +v 0.4375 0.0625 0.5 1 1 1 +v 0.3125 0 0.5 1 1 1 +v 0.4375 0.25 0.5 1 1 1 +v 0.3125 0.25 0.5 1 1 1 +v 0.4375 0.1875 0.5 1 1 1 +v 0.5 0.1875 0.5 1 1 1 +v 0.5 0.0625 0.5 1 1 1 +v 0.4375 0 0.5 1 1 1 + +vn 0 0 -1 +vn 0.3826834 0.9238795 0 +vn -0.3826834 0.9238795 0 +vn 0.7071068 -0.7071068 0 +vn 0.3826834 -0.9238795 0 +vn 0 0 1 +vn 0.7071068 0.7071068 0 +vn -0.3826834 -0.9238795 0 +vn -0.7071068 -0.7071068 0 +vn -0.9238795 -0.3826834 0 +vn -0.7071068 0.7071068 0 +vn 0.9238795 -0.3826834 0 +vn -0.9238795 0.3826834 0 +vn 0.9238795 0.3826834 0 + +vt 0.21875 0.025 +vt 0.21875 0.075 +vt 0.21875 0.175 +vt 0.21875 0.225 +vt 0.09375 0.025 +vt 0.09375 0.225 + +usemtl colormap + +f 3/2/1 2/1/1 1/1/1 +f 2/1/1 3/2/1 4/2/1 +f 4/2/1 5/2/1 2/1/1 +f 4/2/1 3/2/1 6/2/1 +f 6/2/1 3/2/1 7/3/1 +f 7/3/1 3/2/1 8/3/1 +f 7/3/1 8/3/1 9/4/1 +f 7/3/1 9/4/1 10/3/1 +f 5/2/1 4/2/1 10/3/1 +f 10/3/1 9/4/1 11/3/1 +f 5/2/1 10/3/1 11/3/1 +f 11/3/1 9/4/1 12/4/1 +f 13/3/1 5/2/1 11/3/1 +f 13/3/1 11/3/1 14/4/1 +f 13/3/1 14/4/1 15/3/1 +f 16/4/1 15/3/1 14/4/1 +f 17/2/1 5/2/1 13/3/1 +f 18/3/1 15/3/1 16/4/1 +f 19/2/1 15/3/1 18/3/1 +f 19/2/1 20/2/1 15/3/1 +f 21/1/1 5/2/1 17/2/1 +f 21/1/1 17/2/1 20/2/1 +f 20/2/1 19/2/1 21/1/1 +f 5/2/1 21/1/1 22/1/1 +f 23/3/1 19/2/1 18/3/1 +f 23/3/1 18/3/1 24/4/1 +f 25/2/1 19/2/1 23/3/1 +f 23/3/1 24/4/1 26/3/1 +f 27/2/1 19/2/1 25/2/1 +f 28/2/1 27/2/1 26/3/1 +f 29/1/1 19/2/1 27/2/1 +f 27/2/1 28/2/1 29/1/1 +f 19/2/1 29/1/1 30/1/1 +f 26/3/1 24/4/1 31/3/1 +f 28/2/1 26/3/1 31/3/1 +f 31/3/1 24/4/1 32/4/1 +f 33/3/1 28/2/1 31/3/1 +f 33/3/1 31/3/1 34/4/1 +f 35/2/1 28/2/1 33/3/1 +f 33/3/1 34/4/1 36/3/1 +f 37/2/1 28/2/1 35/2/1 +f 36/3/1 34/4/1 38/3/1 +f 38/3/1 34/4/1 39/4/1 +f 40/2/1 36/3/1 38/3/1 +f 40/2/1 37/2/1 36/3/1 +f 37/2/1 40/2/1 41/1/1 +f 41/1/1 28/2/1 37/2/1 +f 28/2/1 41/1/1 42/1/1 +f 14/4/3 43/4/2 16/4/2 +f 43/4/2 14/4/3 44/4/3 +f 46/1/5 19/2/4 45/2/4 +f 19/2/4 46/1/5 21/1/5 +f 45/2/6 47/1/6 46/1/6 +f 47/1/6 45/2/6 48/2/6 +f 49/2/6 47/1/6 48/2/6 +f 47/1/6 49/2/6 50/2/6 +f 48/2/6 45/2/6 51/3/6 +f 50/2/6 49/2/6 52/3/6 +f 51/3/6 43/4/6 52/3/6 +f 52/3/6 43/4/6 53/3/6 +f 50/2/6 52/3/6 53/3/6 +f 53/3/6 43/4/6 44/4/6 +f 51/3/6 54/3/6 43/4/6 +f 51/3/6 45/2/6 54/3/6 +f 55/3/6 50/2/6 53/3/6 +f 55/3/6 53/3/6 56/4/6 +f 55/3/6 56/4/6 57/3/6 +f 58/4/6 57/3/6 56/4/6 +f 59/3/6 57/3/6 58/4/6 +f 60/2/6 57/3/6 59/3/6 +f 60/2/6 61/2/6 57/3/6 +f 60/2/6 62/2/6 61/2/6 +f 62/2/6 50/2/6 55/3/6 +f 62/2/6 60/2/6 63/1/6 +f 63/1/6 50/2/6 62/2/6 +f 50/2/6 63/1/6 64/1/6 +f 45/2/6 65/3/6 54/3/6 +f 54/3/6 65/3/6 66/4/6 +f 66/4/6 65/3/6 67/4/6 +f 45/2/6 68/2/6 65/3/6 +f 69/3/6 67/4/6 65/3/6 +f 45/2/6 70/2/6 68/2/6 +f 70/2/6 71/2/6 69/3/6 +f 70/2/6 45/2/6 72/1/6 +f 72/1/6 71/2/6 70/2/6 +f 71/2/6 72/1/6 73/1/6 +f 69/3/6 74/3/6 67/4/6 +f 69/3/6 71/2/6 74/3/6 +f 71/2/6 75/3/6 74/3/6 +f 71/2/6 76/2/6 75/3/6 +f 71/2/6 77/2/6 76/2/6 +f 77/2/6 71/2/6 78/1/6 +f 75/3/6 79/4/6 74/3/6 +f 74/3/6 79/4/6 80/4/6 +f 81/3/6 79/4/6 75/3/6 +f 81/3/6 82/3/6 79/4/6 +f 81/3/6 83/2/6 82/3/6 +f 77/2/6 83/2/6 81/3/6 +f 78/1/6 83/2/6 77/2/6 +f 83/2/6 78/1/6 84/1/6 +f 43/4/2 18/3/7 16/4/2 +f 18/3/7 43/4/2 54/3/7 +f 72/1/8 19/2/9 30/1/8 +f 19/2/9 72/1/8 45/2/9 +f 63/1/8 3/2/10 1/1/8 +f 3/2/10 63/1/8 60/2/10 +f 53/3/11 14/4/3 11/3/11 +f 14/4/3 53/3/11 44/4/3 +f 83/2/12 41/1/5 40/2/12 +f 41/1/5 83/2/12 84/1/5 +f 56/4/2 11/3/7 12/4/2 +f 11/3/7 56/4/2 53/3/7 +f 73/1/5 28/2/4 71/2/4 +f 28/2/4 73/1/5 29/1/5 +f 63/1/8 2/1/5 64/1/5 +f 2/1/5 63/1/8 1/1/8 +f 47/1/8 21/1/5 46/1/5 +f 21/1/5 47/1/8 22/1/8 +f 50/2/9 22/1/8 47/1/8 +f 22/1/8 50/2/9 5/2/9 +f 72/1/8 29/1/5 73/1/5 +f 29/1/5 72/1/8 30/1/8 +f 64/1/5 5/2/4 50/2/4 +f 5/2/4 64/1/5 2/1/5 +f 54/3/11 24/4/3 18/3/11 +f 24/4/3 54/3/11 66/4/3 +f 60/2/10 8/3/13 3/2/10 +f 8/3/13 60/2/10 59/3/13 +f 67/4/2 31/3/7 32/4/2 +f 31/3/7 67/4/2 74/3/7 +f 59/3/13 9/4/3 8/3/13 +f 9/4/3 59/3/13 58/4/3 +f 24/4/3 67/4/2 32/4/2 +f 67/4/2 24/4/3 66/4/3 +f 9/4/3 56/4/2 12/4/2 +f 56/4/2 9/4/3 58/4/3 +f 78/1/8 41/1/5 84/1/5 +f 41/1/5 78/1/8 42/1/8 +f 34/4/3 79/4/2 39/4/2 +f 79/4/2 34/4/3 80/4/3 +f 31/3/11 80/4/3 34/4/3 +f 80/4/3 31/3/11 74/3/11 +f 82/3/14 40/2/12 38/3/14 +f 40/2/12 82/3/14 83/2/12 +f 79/4/2 38/3/14 39/4/2 +f 38/3/14 79/4/2 82/3/14 +f 71/2/9 42/1/8 78/1/8 +f 42/1/8 71/2/9 28/2/9 +f 35/5/1 36/6/1 37/5/1 +f 36/6/1 35/5/1 33/6/1 +f 55/6/6 61/5/6 62/5/6 +f 61/5/6 55/6/6 57/6/6 +f 17/5/1 15/6/1 20/5/1 +f 15/6/1 17/5/1 13/6/1 +f 81/6/6 76/5/6 77/5/6 +f 76/5/6 81/6/6 75/6/6 +f 51/6/6 49/5/6 48/5/6 +f 49/5/6 51/6/6 52/6/6 +f 69/6/6 68/5/6 70/5/6 +f 68/5/6 69/6/6 65/6/6 +f 25/5/1 26/6/1 27/5/1 +f 26/6/1 25/5/1 23/6/1 +f 6/5/1 10/6/1 4/5/1 +f 10/6/1 6/5/1 7/6/1 + +g conveyor-bars + + + + +usemtl colormap + +f 3/2/1 2/1/1 1/1/1 +f 2/1/1 3/2/1 4/2/1 +f 4/2/1 5/2/1 2/1/1 +f 4/2/1 3/2/1 6/2/1 +f 6/2/1 3/2/1 7/3/1 +f 7/3/1 3/2/1 8/3/1 +f 7/3/1 8/3/1 9/4/1 +f 7/3/1 9/4/1 10/3/1 +f 5/2/1 4/2/1 10/3/1 +f 10/3/1 9/4/1 11/3/1 +f 5/2/1 10/3/1 11/3/1 +f 11/3/1 9/4/1 12/4/1 +f 13/3/1 5/2/1 11/3/1 +f 13/3/1 11/3/1 14/4/1 +f 13/3/1 14/4/1 15/3/1 +f 16/4/1 15/3/1 14/4/1 +f 17/2/1 5/2/1 13/3/1 +f 18/3/1 15/3/1 16/4/1 +f 19/2/1 15/3/1 18/3/1 +f 19/2/1 20/2/1 15/3/1 +f 21/1/1 5/2/1 17/2/1 +f 21/1/1 17/2/1 20/2/1 +f 20/2/1 19/2/1 21/1/1 +f 5/2/1 21/1/1 22/1/1 +f 23/3/1 19/2/1 18/3/1 +f 23/3/1 18/3/1 24/4/1 +f 25/2/1 19/2/1 23/3/1 +f 23/3/1 24/4/1 26/3/1 +f 27/2/1 19/2/1 25/2/1 +f 28/2/1 27/2/1 26/3/1 +f 29/1/1 19/2/1 27/2/1 +f 27/2/1 28/2/1 29/1/1 +f 19/2/1 29/1/1 30/1/1 +f 26/3/1 24/4/1 31/3/1 +f 28/2/1 26/3/1 31/3/1 +f 31/3/1 24/4/1 32/4/1 +f 33/3/1 28/2/1 31/3/1 +f 33/3/1 31/3/1 34/4/1 +f 35/2/1 28/2/1 33/3/1 +f 33/3/1 34/4/1 36/3/1 +f 37/2/1 28/2/1 35/2/1 +f 36/3/1 34/4/1 38/3/1 +f 38/3/1 34/4/1 39/4/1 +f 40/2/1 36/3/1 38/3/1 +f 40/2/1 37/2/1 36/3/1 +f 37/2/1 40/2/1 41/1/1 +f 41/1/1 28/2/1 37/2/1 +f 28/2/1 41/1/1 42/1/1 +f 14/4/3 43/4/2 16/4/2 +f 43/4/2 14/4/3 44/4/3 +f 46/1/5 19/2/4 45/2/4 +f 19/2/4 46/1/5 21/1/5 +f 45/2/6 47/1/6 46/1/6 +f 47/1/6 45/2/6 48/2/6 +f 49/2/6 47/1/6 48/2/6 +f 47/1/6 49/2/6 50/2/6 +f 48/2/6 45/2/6 51/3/6 +f 50/2/6 49/2/6 52/3/6 +f 51/3/6 43/4/6 52/3/6 +f 52/3/6 43/4/6 53/3/6 +f 50/2/6 52/3/6 53/3/6 +f 53/3/6 43/4/6 44/4/6 +f 51/3/6 54/3/6 43/4/6 +f 51/3/6 45/2/6 54/3/6 +f 55/3/6 50/2/6 53/3/6 +f 55/3/6 53/3/6 56/4/6 +f 55/3/6 56/4/6 57/3/6 +f 58/4/6 57/3/6 56/4/6 +f 59/3/6 57/3/6 58/4/6 +f 60/2/6 57/3/6 59/3/6 +f 60/2/6 61/2/6 57/3/6 +f 60/2/6 62/2/6 61/2/6 +f 62/2/6 50/2/6 55/3/6 +f 62/2/6 60/2/6 63/1/6 +f 63/1/6 50/2/6 62/2/6 +f 50/2/6 63/1/6 64/1/6 +f 45/2/6 65/3/6 54/3/6 +f 54/3/6 65/3/6 66/4/6 +f 66/4/6 65/3/6 67/4/6 +f 45/2/6 68/2/6 65/3/6 +f 69/3/6 67/4/6 65/3/6 +f 45/2/6 70/2/6 68/2/6 +f 70/2/6 71/2/6 69/3/6 +f 70/2/6 45/2/6 72/1/6 +f 72/1/6 71/2/6 70/2/6 +f 71/2/6 72/1/6 73/1/6 +f 69/3/6 74/3/6 67/4/6 +f 69/3/6 71/2/6 74/3/6 +f 71/2/6 75/3/6 74/3/6 +f 71/2/6 76/2/6 75/3/6 +f 71/2/6 77/2/6 76/2/6 +f 77/2/6 71/2/6 78/1/6 +f 75/3/6 79/4/6 74/3/6 +f 74/3/6 79/4/6 80/4/6 +f 81/3/6 79/4/6 75/3/6 +f 81/3/6 82/3/6 79/4/6 +f 81/3/6 83/2/6 82/3/6 +f 77/2/6 83/2/6 81/3/6 +f 78/1/6 83/2/6 77/2/6 +f 83/2/6 78/1/6 84/1/6 +f 43/4/2 18/3/7 16/4/2 +f 18/3/7 43/4/2 54/3/7 +f 72/1/8 19/2/9 30/1/8 +f 19/2/9 72/1/8 45/2/9 +f 63/1/8 3/2/10 1/1/8 +f 3/2/10 63/1/8 60/2/10 +f 53/3/11 14/4/3 11/3/11 +f 14/4/3 53/3/11 44/4/3 +f 83/2/12 41/1/5 40/2/12 +f 41/1/5 83/2/12 84/1/5 +f 56/4/2 11/3/7 12/4/2 +f 11/3/7 56/4/2 53/3/7 +f 73/1/5 28/2/4 71/2/4 +f 28/2/4 73/1/5 29/1/5 +f 63/1/8 2/1/5 64/1/5 +f 2/1/5 63/1/8 1/1/8 +f 47/1/8 21/1/5 46/1/5 +f 21/1/5 47/1/8 22/1/8 +f 50/2/9 22/1/8 47/1/8 +f 22/1/8 50/2/9 5/2/9 +f 72/1/8 29/1/5 73/1/5 +f 29/1/5 72/1/8 30/1/8 +f 64/1/5 5/2/4 50/2/4 +f 5/2/4 64/1/5 2/1/5 +f 54/3/11 24/4/3 18/3/11 +f 24/4/3 54/3/11 66/4/3 +f 60/2/10 8/3/13 3/2/10 +f 8/3/13 60/2/10 59/3/13 +f 67/4/2 31/3/7 32/4/2 +f 31/3/7 67/4/2 74/3/7 +f 59/3/13 9/4/3 8/3/13 +f 9/4/3 59/3/13 58/4/3 +f 24/4/3 67/4/2 32/4/2 +f 67/4/2 24/4/3 66/4/3 +f 9/4/3 56/4/2 12/4/2 +f 56/4/2 9/4/3 58/4/3 +f 78/1/8 41/1/5 84/1/5 +f 41/1/5 78/1/8 42/1/8 +f 34/4/3 79/4/2 39/4/2 +f 79/4/2 34/4/3 80/4/3 +f 31/3/11 80/4/3 34/4/3 +f 80/4/3 31/3/11 74/3/11 +f 82/3/14 40/2/12 38/3/14 +f 40/2/12 82/3/14 83/2/12 +f 79/4/2 38/3/14 39/4/2 +f 38/3/14 79/4/2 82/3/14 +f 71/2/9 42/1/8 78/1/8 +f 42/1/8 71/2/9 28/2/9 +f 35/5/1 36/6/1 37/5/1 +f 36/6/1 35/5/1 33/6/1 +f 55/6/6 61/5/6 62/5/6 +f 61/5/6 55/6/6 57/6/6 +f 17/5/1 15/6/1 20/5/1 +f 15/6/1 17/5/1 13/6/1 +f 81/6/6 76/5/6 77/5/6 +f 76/5/6 81/6/6 75/6/6 +f 51/6/6 49/5/6 48/5/6 +f 49/5/6 51/6/6 52/6/6 +f 69/6/6 68/5/6 70/5/6 +f 68/5/6 69/6/6 65/6/6 +f 25/5/1 26/6/1 27/5/1 +f 26/6/1 25/5/1 23/6/1 +f 6/5/1 10/6/1 4/5/1 +f 10/6/1 6/5/1 7/6/1 + diff --git a/build/game_engine.exe b/build/game_engine.exe index 062f8d2..67db067 100644 Binary files a/build/game_engine.exe and b/build/game_engine.exe differ diff --git a/build/main.o b/build/main.o index 53b3ebc..f674c27 100644 Binary files a/build/main.o and b/build/main.o differ diff --git a/imgui.ini b/imgui.ini index 5d09055..f579d45 100644 --- a/imgui.ini +++ b/imgui.ini @@ -22,7 +22,7 @@ DockId=0x00000009,0 [Window][Asset Panel] Pos=311,734 -Size=625,455 +Size=700,455 Collapsed=0 DockId=0x00000007,0 @@ -39,8 +39,8 @@ Collapsed=0 DockId=0x00000001,0 [Window][Info] -Pos=938,734 -Size=587,455 +Pos=1013,734 +Size=512,455 Collapsed=0 DockId=0x00000008,0 @@ -57,8 +57,8 @@ Collapsed=0 DockId=0x00000009,1 [Window][Drop Target] -Pos=938,734 -Size=587,455 +Pos=1013,734 +Size=512,455 Collapsed=0 DockId=0x00000008,1 @@ -77,8 +77,8 @@ DockSpace ID=0xC746EC7D Window=0x9DF47A72 Pos=8,28 Size=1904,1161 Spli DockNode ID=0x00000006 Parent=0x00000003 SizeRef=1035,1161 Split=Y Selected=0x642CEEBB DockNode ID=0x00000009 Parent=0x00000006 SizeRef=1266,704 CentralNode=1 Selected=0x642CEEBB DockNode ID=0x0000000A Parent=0x00000006 SizeRef=1266,455 Split=X Selected=0x9D571615 - DockNode ID=0x00000007 Parent=0x0000000A SizeRef=625,479 Selected=0x9D571615 - DockNode ID=0x00000008 Parent=0x0000000A SizeRef=587,479 Selected=0xE534E588 + DockNode ID=0x00000007 Parent=0x0000000A SizeRef=700,479 Selected=0x9D571615 + DockNode ID=0x00000008 Parent=0x0000000A SizeRef=512,479 Selected=0xE534E588 DockNode ID=0x00000004 Parent=0x00000002 SizeRef=385,1161 Split=Y Selected=0xE7039252 DockNode ID=0x0000000B Parent=0x00000004 SizeRef=385,700 Selected=0xE7039252 DockNode ID=0x0000000C Parent=0x00000004 SizeRef=385,459 Split=Y Selected=0x54723243 diff --git a/scene.polys b/scene.polys index e69de29..d297cf4 100644 --- a/scene.polys +++ b/scene.polys @@ -0,0 +1,62 @@ +Entities: + - ID: 0 + Name: Light + Components: + Light: + Type: 0 + Intensity: 1 + Color: [1, 0, 0] + Constant: 1 + Linear: 0.0900000036 + Quadratic: 0.0320000015 + cutOff: 0 + outerCutOff: 39.7900009 + Direction: [-0.200000003, -1, -0.300000012] + Transform: + Position: [-8.23400021, -0.379575908, 0.520573974] + Rotation: [1.5, 2.70000005, 342.5] + Scale: [1, 1, 1] + - ID: 1 + Name: Cube + Components: + Render: + MeshName: shelf + Color: [1, 1, 1] + Transform: + Position: [-1.21370173, 1.20000005, 0] + Rotation: [1.34287302e-05, -41.9440002, 1.62548586e-05] + Scale: [1, 1, 1] + - ID: 2 + Name: Light + Components: + Transform: + Position: [0, -2.21429968, 4.51696587] + Rotation: [0, 0, 0] + Scale: [1, 1, 1] + Light: + Type: 0 + Intensity: 1 + Color: [0.186046124, 0, 1] + Constant: 1 + Linear: 0.0900000036 + Quadratic: 0.0320000015 + cutOff: 12.5 + outerCutOff: 17.5 + Direction: [-0.200000003, -1, -0.300000012] + - ID: 3 + Name: Light + Components: + Transform: + Position: [-4.97912979, 7.21913528, 4.91323614] + Rotation: [0, 0, 0] + Scale: [1, 1, 1] + Light: + Type: 0 + Intensity: 1 + Color: [0, 1, 0] + Constant: 1 + Linear: 0.0900000036 + Quadratic: 0.0320000015 + cutOff: 12.5 + outerCutOff: 17.5 + Direction: [-0.200000003, -1, -0.300000012] \ No newline at end of file diff --git a/shaders/cube_shader.fs b/shaders/cube_shader.fs index f0e5820..ea252de 100644 --- a/shaders/cube_shader.fs +++ b/shaders/cube_shader.fs @@ -1,198 +1,163 @@ -// cube_fragment_shader.fs #version 330 core +out vec4 color; -// Outputs -out vec4 FragColor; +in vec3 FragPos; +in vec3 Normal; -// Inputs from Vertex Shader -in VS_OUT { - vec3 FragPos; // Fragment position in world space - vec3 Normal; // Fragment normal in world space - vec2 TexCoords; // Texture coordinates - vec4 FragPosLightSpace; // Fragment position in light space -} fs_in; - -// Structures for different light types -struct DirLight { - vec3 direction; // Direction of the light - vec3 color; // Color/intensity of the light -}; - -struct PointLight { - vec3 position; // Position of the light - vec3 color; // Color/intensity of the light - - float constant; // Attenuation constant - float linear; // Attenuation linear factor - float quadratic; // Attenuation quadratic factor -}; - -struct SpotLight { - vec3 position; // Position of the light - vec3 direction; // Direction the spotlight is pointing - vec3 color; // Color/intensity of the light - - float cutOff; // Inner cutoff angle (in degrees) - float outerCutOff; // Outer cutoff angle (in degrees) - - float constant; // Attenuation constant - float linear; // Attenuation linear factor - float quadratic; // Attenuation quadratic factor -}; - -// Maximum number of each light type -#define MAX_POINT_LIGHTS 10 -#define MAX_DIR_LIGHTS 10 -#define MAX_SPOT_LIGHTS 10 - -// Uniforms for lights -uniform DirLight dirLights[MAX_DIR_LIGHTS]; -uniform int numDirLights; - -uniform PointLight pointLights[MAX_POINT_LIGHTS]; -uniform int numPointLights; - -uniform SpotLight spotLights[MAX_SPOT_LIGHTS]; -uniform int numSpotLights; - -// Camera position uniform vec3 viewPos; -// Shadow map -uniform sampler2D shadowMap; +// Point Lights +struct PointLight { + vec3 position; + vec3 color; -// Texture samplers -uniform sampler2D diffuseMap; -uniform sampler2D specularMap; + float constant; + float linear; + float quadratic; +}; -// Function to calculate shadow with PCF -float ShadowCalculation(vec4 fragPosLightSpace) +#define MAX_POINT_LIGHTS 256 +uniform int numPointLights; +uniform PointLight pointLights[MAX_POINT_LIGHTS]; + +// Directional Lights +struct DirLight { + vec3 direction; + vec3 color; +}; + +#define MAX_DIR_LIGHTS 10 +uniform int numDirLights; +uniform DirLight dirLights[MAX_DIR_LIGHTS]; + +// Spotlights +struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + + float cutOff; // Cosine of the inner cutoff angle + float outerCutOff; // Cosine of the outer cutoff angle + + float constant; + float linear; + float quadratic; +}; + +#define MAX_SPOT_LIGHTS 64 +uniform int numSpotLights; +uniform SpotLight spotLights[MAX_SPOT_LIGHTS]; + +uniform vec3 objectColor; // Fallback color +uniform sampler2D texture1; // Texture sampler +uniform bool useTexture; // Flag to determine if a texture is used + +in vec2 TexCoords; + +// Function to calculate lighting for a Point Light +vec3 CalcPointLight(PointLight light, vec3 normal, vec3 viewDir, vec3 fragPos) { - // Perform perspective divide - vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w; - - // Transform to [0,1] range - projCoords = projCoords * 0.5 + 0.5; - - // Get closest depth value from light's perspective (using [0,1] range fragPos as coords) - float closestDepth = texture(shadowMap, projCoords.xy).r; - - // Get depth of current fragment from light's perspective - float currentDepth = projCoords.z; - - // Bias to prevent shadow acne - float bias = 0.005; - - // PCF parameters - float shadow = 0.0; - vec2 texelSize = 1.0 / textureSize(shadowMap, 0); - int samples = 2; // Number of samples per axis (total samples = (2*samples +1)^2) - - for(int x = -samples; x <= samples; ++x) - { - for(int y = -samples; y <= samples; ++y) - { - float pcfDepth = texture(shadowMap, projCoords.xy + vec2(x, y) * texelSize).r; - shadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0; - } - } - shadow /= float((2 * samples + 1) * (2 * samples + 1)); + // Ambient + float ambientStrength = 0.1; + vec3 ambient = ambientStrength * light.color; - // Keep the shadow at 0.0 when outside the far_plane region of light's orthographic projection - if(projCoords.z > 1.0) - shadow = 0.0; - - return shadow; + // Diffuse + vec3 lightDir = normalize(light.position - fragPos); + float diff = max(dot(normal, lightDir), 0.0); + vec3 diffuse = diff * light.color; + + // Specular + float specularStrength = 0.5; + vec3 reflectDir = reflect(-lightDir, normal); + float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32); + vec3 specular = specularStrength * spec * light.color; + + // Attenuation + float distance = length(light.position - fragPos); + float attenuation = 1.0 / (light.constant + light.linear * distance + + light.quadratic * (distance * distance)); + + return (ambient + diffuse + specular) * attenuation; +} + +// Function to calculate lighting for a Directional Light +vec3 CalcDirLight(DirLight light, vec3 normal, vec3 viewDir) +{ + // Ambient + float ambientStrength = 0.1; + vec3 ambient = ambientStrength * light.color; + + // Diffuse + vec3 lightDir = normalize(-light.direction); // Directional light direction + float diff = max(dot(normal, lightDir), 0.0); + vec3 diffuse = diff * light.color; + + // Specular + float specularStrength = 0.5; + vec3 reflectDir = reflect(-lightDir, normal); + float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32); + vec3 specular = specularStrength * spec * light.color; + + return (ambient + diffuse + specular); +} + +// Function to calculate lighting for a Spotlight +vec3 CalcSpotLight(SpotLight light, vec3 normal, vec3 viewDir, vec3 fragPos) +{ + // Ambient + float ambientStrength = 0.1; + vec3 ambient = ambientStrength * light.color; + + // Diffuse + vec3 lightDir = normalize(light.position - fragPos); + float diff = max(dot(normal, lightDir), 0.0); + vec3 diffuse = diff * light.color; + + // Specular + float specularStrength = 0.5; + vec3 reflectDir = reflect(-lightDir, normal); + float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32); + vec3 specular = specularStrength * spec * light.color; + + // Attenuation + float distance = length(light.position - fragPos); + float attenuation = 1.0 / (light.constant + light.linear * distance + + light.quadratic * (distance * distance)); + + // Spotlight intensity + vec3 spotDir = normalize(light.direction); + float theta = dot(lightDir, spotDir); + float epsilon = light.cutOff - light.outerCutOff; + float intensity = clamp((theta - light.outerCutOff) / epsilon, 0.0, 1.0); + + return (ambient + diffuse + specular) * attenuation * intensity; } void main() { - // Sample textures - vec3 diffuseColor = texture(diffuseMap, fs_in.TexCoords).rgb; - vec3 specularColor = texture(specularMap, fs_in.TexCoords).rgb; - - // Properties - vec3 color = diffuseColor; // Use texture color - vec3 normal = normalize(fs_in.Normal); - vec3 viewDir = normalize(viewPos - fs_in.FragPos); + vec3 norm = normalize(Normal); + vec3 viewDir = normalize(viewPos - FragPos); + vec3 result = vec3(0.0); - // Initialize ambient component - vec3 ambient = 0.1 * color; // Adjust ambient strength as needed - vec3 lighting = ambient; - - // Iterate over directional lights - for(int i = 0; i < numDirLights; ++i) + // Calculate Point Lights + for (int i = 0; i < numPointLights; ++i) { - // Directional light properties - vec3 lightDir = normalize(-dirLights[i].direction); - - // Diffuse shading - float diff = max(dot(normal, lightDir), 0.0); - vec3 diffuse = diff * dirLights[i].color * color; - - // Specular shading - vec3 reflectDir = reflect(-lightDir, normal); - float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32.0); // Shininess factor - vec3 specular = spec * specularColor * dirLights[i].color; - - // Calculate shadow - float shadow = ShadowCalculation(fs_in.FragPosLightSpace); - - // Accumulate lighting with shadow influence - lighting += (1.0 - shadow) * (diffuse + specular); + result += CalcPointLight(pointLights[i], norm, viewDir, FragPos); } - // Iterate over point lights - for(int i = 0; i < numPointLights; ++i) + // Calculate Directional Lights + for (int i = 0; i < numDirLights; ++i) { - // Point light properties - vec3 lightDir = normalize(pointLights[i].position - fs_in.FragPos); - - // Diffuse shading - float diff = max(dot(normal, lightDir), 0.0); - vec3 diffuse = diff * pointLights[i].color * color; - - // Specular shading - vec3 reflectDir = reflect(-lightDir, normal); - float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32.0); - vec3 specular = spec * specularColor * pointLights[i].color; - - // Attenuation - float distance = length(pointLights[i].position - fs_in.FragPos); - float attenuation = 1.0 / (pointLights[i].constant + pointLights[i].linear * distance + - pointLights[i].quadratic * (distance * distance)); - - // Accumulate lighting with attenuation - lighting += attenuation * (diffuse + specular); + result += CalcDirLight(dirLights[i], norm, viewDir); } - // Iterate over spotlights - for(int i = 0; i < numSpotLights; ++i) + // Calculate Spotlights + for (int i = 0; i < numSpotLights; ++i) { - // Spotlight properties - vec3 lightDir = normalize(spotLights[i].position - fs_in.FragPos); - float theta = dot(lightDir, normalize(-spotLights[i].direction)); - float epsilon = spotLights[i].cutOff - spotLights[i].outerCutOff; - float intensity = clamp((theta - spotLights[i].outerCutOff) / epsilon, 0.0, 1.0); - - // Diffuse shading - float diff = max(dot(normal, lightDir), 0.0); - vec3 diffuse = diff * spotLights[i].color * color; - - // Specular shading - vec3 reflectDir = reflect(-lightDir, normal); - float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32.0); - vec3 specular = spec * specularColor * spotLights[i].color; - - // Attenuation - float distance = length(spotLights[i].position - fs_in.FragPos); - float attenuation = 1.0 / (spotLights[i].constant + spotLights[i].linear * distance + - spotLights[i].quadratic * (distance * distance)); - - // Accumulate lighting with attenuation and spotlight intensity - lighting += attenuation * intensity * (diffuse + specular); + result += CalcSpotLight(spotLights[i], norm, viewDir, FragPos); } - // Final fragment color - FragColor = vec4(lighting, 1.0); + // Combine lighting with object color or texture + vec3 baseColor = useTexture ? texture(texture1, TexCoords).rgb : objectColor; + color = vec4(result * baseColor, 1.0); } diff --git a/shaders/cube_shader.vs b/shaders/cube_shader.vs index 1f5f658..0a6f1e9 100644 --- a/shaders/cube_shader.vs +++ b/shaders/cube_shader.vs @@ -1,39 +1,20 @@ -// cube_vertex_shader.vs #version 330 core +layout(location = 0) in vec3 position; +layout(location = 1) in vec3 normal; +layout(location = 2) in vec2 texCoords; -// Vertex Attributes -layout(location = 0) in vec3 aPos; // Vertex position -layout(location = 1) in vec3 aNormal; // Vertex normal -layout(location = 2) in vec2 aTexCoords; // Texture coordinates +out vec3 FragPos; +out vec3 Normal; +out vec2 TexCoords; -// Uniform Matrices uniform mat4 model; uniform mat4 view; uniform mat4 projection; -uniform mat4 lightSpaceMatrix; - -// Output to Fragment Shader -out VS_OUT { - vec3 FragPos; // Fragment position in world space - vec3 Normal; // Fragment normal in world space - vec2 TexCoords; // Texture coordinates - vec4 FragPosLightSpace; // Fragment position in light space -} fs_in; void main() { - // Calculate fragment position in world space - fs_in.FragPos = vec3(model * vec4(aPos, 1.0)); - - // Calculate and normalize the normal vector in world space - fs_in.Normal = mat3(transpose(inverse(model))) * aNormal; - - // Pass through texture coordinates - fs_in.TexCoords = aTexCoords; - - // Calculate fragment position in light space for shadow mapping - fs_in.FragPosLightSpace = lightSpaceMatrix * vec4(fs_in.FragPos, 1.0); - - // Final vertex position in clip space - gl_Position = projection * view * vec4(fs_in.FragPos, 1.0); + TexCoords = texCoords; // Pass texture coordinates to fragment shader + FragPos = vec3(model * vec4(position, 1.0)); + Normal = mat3(transpose(inverse(model))) * normal; + gl_Position = projection * view * vec4(FragPos, 1.0); } diff --git a/src/main.cpp b/src/main.cpp index e950390..06fdb32 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -122,6 +122,9 @@ Model ImportedModel; Model ImportedModel_shelf; +Model ImportedModel_conv; + + ImTextureID fileIconTexture; ImTextureID sceneIconTexture; ImTextureID objectIconTexture; @@ -750,6 +753,14 @@ bool LoadModels() return false; } ImportedModel_shelf.textureID = ImportedModel_shelf.loadTexture("./assets/wood.png"); + + // Load the cottage model + if (!ImportedModel_conv.loadFromOBJ("./assets/conveyor-bars.obj")) + { + std::cerr << "[Poly] Failed to load cottage_obj.obj!" << std::endl; + return false; + } + //ImportedModel_conv.textureID = ImportedModel_conv.loadTexture("./assets/colormap.png"); return true; } @@ -2112,6 +2123,10 @@ void ShowGameView( { ImportedModel_shelf.render(transform, render, depthShader); } + else if (render->meshName == "conv") + { + ImportedModel_conv.render(transform, render, depthShader); + } else { glBindVertexArray(cubeVAO); @@ -2325,6 +2340,10 @@ void ShowGameView( { ImportedModel_shelf.render(transform, render, cubeShader); } + else if (render->meshName == "conv") + { + ImportedModel_conv.render(transform, render, depthShader); + } else { glBindVertexArray(cubeVAO);