]> git.tdb.fi Git - libs/game.git/commitdiff
Make it possible to shoot bullets in Bassteroids
authorMikko Rasa <tdb@tdb.fi>
Fri, 25 Nov 2022 20:04:30 +0000 (22:04 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 25 Nov 2022 20:04:30 +0000 (22:04 +0200)
They don't actually do anything yet except bounce around.

examples/bassteroids/assets.blend
examples/bassteroids/data/exported/Note.tech [new file with mode: 0644]
examples/bassteroids/data/exported/Quaver.mesh [new file with mode: 0644]
examples/bassteroids/data/exported/Quaver.object [new file with mode: 0644]
examples/bassteroids/source/bullet.cpp [new file with mode: 0644]
examples/bassteroids/source/bullet.h [new file with mode: 0644]
examples/bassteroids/source/playercontroller.cpp
examples/bassteroids/source/playercontroller.h

index 216ba42db1a791d796f9dc6cf8db0263e06efc12..c94c095a5a034fb50edea9da82da7f78ffdf2d76 100644 (file)
Binary files a/examples/bassteroids/assets.blend and b/examples/bassteroids/assets.blend differ
diff --git a/examples/bassteroids/data/exported/Note.tech b/examples/bassteroids/data/exported/Note.tech
new file mode 100644 (file)
index 0000000..9c97b75
--- /dev/null
@@ -0,0 +1,20 @@
+method ""
+{
+       material
+       {
+               type pbr;
+               base_color 0.110689 0.110689 0.110689 1.00000;
+               tint 1.00000 1.00000 1.00000 1.00000;
+               metalness 1.00000;
+               roughness 0.500000;
+               emission 0.00000 0.00000 0.00000;
+       };
+};
+method "shadow"
+{
+       shader "occluder.glsl.shader";
+};
+method "shadow_thsm"
+{
+       shader "occluder_thsm.glsl.shader";
+};
diff --git a/examples/bassteroids/data/exported/Quaver.mesh b/examples/bassteroids/data/exported/Quaver.mesh
new file mode 100644 (file)
index 0000000..3e5a036
--- /dev/null
@@ -0,0 +1,712 @@
+winding COUNTERCLOCKWISE;
+vertices VERTEX3_FLOAT TEXCOORD2_USHORT NORMAL3_BYTE PADDING1_UBYTE
+{
+       normal 0.660985 0.750399 0.00000;
+       texcoord 0.853553 0.853553;
+       vertex 0.0480356 0.167461 0.00000;
+       vertex 0.0480356 0.167461 0.0692407;
+       texcoord 0.933013 0.750000;
+       vertex 0.0835394 0.136188 0.00000;
+       vertex 0.0835394 0.136188 0.0692407;
+       normal -0.286109 0.958197 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.997010 0.207767 0.00000;
+       vertex -0.997010 0.207767 0.0692407;
+       vertex -0.945589 0.223121 0.00000;
+       vertex -0.945589 0.223121 0.0692407;
+       normal -0.805733 -0.592279 0.00000;
+       texcoord 0.0669873 0.250000;
+       vertex -0.0835394 -0.136188 0.00000;
+       vertex -0.0835394 -0.136188 0.0692407;
+       texcoord 0.0170371 0.370590;
+       vertex -0.113350 -0.0956334 0.00000;
+       vertex -0.113350 -0.0956334 0.0692407;
+       normal -0.372540 0.928016 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.759236 0.320042 0.00000;
+       normal -0.372540 0.928016 0.00000;
+       vertex -0.759236 0.320042 0.0692407;
+       vertex -0.709282 0.340096 0.00000;
+       normal -0.372540 0.928016 0.00000;
+       vertex -0.709282 0.340096 0.0692407;
+       normal 0.917562 -0.397592 0.00000;
+       texcoord 0.853553 0.146447;
+       vertex 0.143500 -0.0987842 0.00000;
+       vertex 0.143500 -0.0987842 0.0692407;
+       texcoord 0.750000 0.0669873;
+       vertex 0.126178 -0.138760 0.00000;
+       vertex 0.126178 -0.138760 0.0692407;
+       normal -0.418268 0.908324 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.900620 0.238238 0.00000;
+       vertex -0.900620 0.238238 0.0692407;
+       vertex -0.855690 0.258928 0.00000;
+       vertex -0.855690 0.258928 0.0692407;
+       normal 0.455868 0.890047 0.00000;
+       texcoord 0.750000 0.933013;
+       vertex 0.00925825 0.187322 0.00000;
+       vertex 0.00925825 0.187322 0.0692407;
+       texcoord 0.853553 0.853553;
+       vertex 0.0480356 0.167461 0.00000;
+       vertex 0.0480356 0.167461 0.0692407;
+       normal -0.112938 0.993602 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.658383 0.353724 0.00000;
+       vertex -0.658383 0.353724 0.0692407;
+       vertex -0.598665 0.360512 0.00000;
+       vertex -0.598665 0.360512 0.0692407;
+       normal -0.660985 -0.750399 0.00000;
+       texcoord 0.146447 0.146447;
+       vertex -0.0480356 -0.167461 0.00000;
+       vertex -0.0480356 -0.167461 0.0692407;
+       texcoord 0.0669873 0.250000;
+       vertex -0.0835394 -0.136188 0.00000;
+       vertex -0.0835394 -0.136188 0.0692407;
+       normal 0.190358 0.981715 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.536318 0.357520 0.00000;
+       vertex -0.536318 0.357520 0.0692407;
+       vertex -0.470286 0.344716 0.00000;
+       vertex -0.470286 0.344716 0.0692407;
+       normal 0.987210 -0.159424 0.00000;
+       texcoord 0.933013 0.250000;
+       vertex 0.151043 -0.0520761 0.00000;
+       vertex 0.151043 -0.0520761 0.0692407;
+       texcoord 0.853553 0.146447;
+       vertex 0.143500 -0.0987842 0.00000;
+       vertex 0.143500 -0.0987842 0.0692407;
+       normal -0.258640 0.965974 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.709282 0.340096 0.00000;
+       vertex -0.709282 0.340096 0.0692407;
+       vertex -0.658383 0.353724 0.00000;
+       vertex -0.658383 0.353724 0.0692407;
+       normal 0.177200 0.984175 0.00000;
+       texcoord 0.629409 0.982963;
+       vertex -0.0301501 0.194418 0.00000;
+       vertex -0.0301501 0.194418 0.0692407;
+       texcoord 0.750000 0.933013;
+       vertex 0.00925825 0.187322 0.00000;
+       vertex 0.00925825 0.187322 0.0692407;
+       normal 0.933714 -0.358021 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.409460 0.323182 0.00000;
+       vertex -0.409460 0.323182 0.0692407;
+       vertex -0.428844 0.272630 0.00000;
+       vertex -0.428844 0.272630 0.0692407;
+       normal -0.917562 0.397592 0.00000;
+       texcoord 0.146447 0.853553;
+       vertex -0.143500 0.0987842 0.00000;
+       vertex -0.143500 0.0987842 0.0692407;
+       texcoord 0.250000 0.933013;
+       vertex -0.126178 0.138760 0.00000;
+       vertex -0.126178 0.138760 0.0692407;
+       normal 0.0479373 0.998850 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.598665 0.360512 0.00000;
+       vertex -0.598665 0.360512 0.0692407;
+       vertex -0.536318 0.357520 0.00000;
+       vertex -0.536318 0.357520 0.0692407;
+       normal -0.455868 -0.890047 0.00000;
+       texcoord 0.250000 0.0669873;
+       vertex -0.00925823 -0.187322 0.00000;
+       vertex -0.00925823 -0.187322 0.0692407;
+       texcoord 0.146447 0.146447;
+       vertex -0.0480356 -0.167461 0.00000;
+       vertex -0.0480356 -0.167461 0.0692407;
+       normal 0.998506 0.0546464 0.00000;
+       texcoord 0.982963 0.370591;
+       vertex 0.148293 -0.00181911 0.00000;
+       vertex 0.148293 -0.00181911 0.0692407;
+       texcoord 0.933013 0.250000;
+       vertex 0.151043 -0.0520761 0.00000;
+       vertex 0.151043 -0.0520761 0.0692407;
+       normal 0.333724 0.942671 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.470286 0.344716 0.00000;
+       vertex -0.470286 0.344716 0.0692407;
+       vertex -0.409460 0.323182 0.00000;
+       vertex -0.409460 0.323182 0.0692407;
+       normal -0.987210 0.159424 0.00000;
+       texcoord 0.0669873 0.750000;
+       vertex -0.151043 0.0520761 0.00000;
+       vertex -0.151043 0.0520761 0.0692407;
+       texcoord 0.146447 0.853553;
+       vertex -0.143500 0.0987842 0.00000;
+       vertex -0.143500 0.0987842 0.0692407;
+       normal -0.177201 -0.984175 0.00000;
+       texcoord 0.370590 0.0170371;
+       vertex 0.0301500 -0.194418 0.00000;
+       vertex 0.0301500 -0.194418 0.0692407;
+       texcoord 0.250000 0.0669873;
+       vertex -0.00925823 -0.187322 0.00000;
+       vertex -0.00925823 -0.187322 0.0692407;
+       normal 0.968949 0.247259 0.00000;
+       texcoord 1.00000 0.500000;
+       vertex 0.135436 0.0485618 0.00000;
+       vertex 0.135436 0.0485618 0.0692407;
+       texcoord 0.982963 0.370591;
+       vertex 0.148293 -0.00181911 0.00000;
+       vertex 0.148293 -0.00181911 0.0692407;
+       normal 0.787473 -0.616349 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.779847 0.229709 0.00000;
+       vertex -0.779847 0.229709 0.0692407;
+       vertex -0.807469 0.194418 0.00000;
+       vertex -0.807469 0.194418 0.0692407;
+       normal 0.00000 1.00000 0.00000;
+       vertex -0.807469 0.194418 0.00000;
+       vertex -0.807469 0.194418 0.0692407;
+       texcoord 0.629409 0.982963;
+       vertex -0.0301501 0.194418 0.00000;
+       vertex -0.0301501 0.194418 0.0692407;
+       normal -0.998506 -0.0546464 0.00000;
+       texcoord 0.0170371 0.629410;
+       vertex -0.148293 0.00181912 0.00000;
+       vertex -0.148293 0.00181912 0.0692407;
+       texcoord 0.0669873 0.750000;
+       vertex -0.151043 0.0520761 0.00000;
+       vertex -0.151043 0.0520761 0.0692407;
+       normal 0.430750 -0.902471 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.697495 0.282689 0.00000;
+       vertex -0.697495 0.282689 0.0692407;
+       vertex -0.742616 0.261152 0.00000;
+       vertex -0.742616 0.261152 0.0692407;
+       normal 0.162553 -0.986700 0.00000;
+       texcoord 0.500000 0.00000;
+       vertex 0.0675037 -0.188264 0.00000;
+       vertex 0.0675037 -0.188264 0.0692407;
+       texcoord 0.370590 0.0170371;
+       vertex 0.0301500 -0.194418 0.00000;
+       vertex 0.0301500 -0.194418 0.0692407;
+       normal 0.645233 -0.763986 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.742616 0.261152 0.00000;
+       vertex -0.742616 0.261152 0.0692407;
+       vertex -0.779847 0.229709 0.00000;
+       vertex -0.779847 0.229709 0.0692407;
+       normal 0.905301 0.424770 0.00000;
+       texcoord 0.982963 0.629409;
+       vertex 0.113350 0.0956334 0.00000;
+       vertex 0.113350 0.0956334 0.0692407;
+       texcoord 1.00000 0.500000;
+       vertex 0.135436 0.0485618 0.00000;
+       vertex 0.135436 0.0485618 0.0692407;
+       normal 0.125319 -0.992117 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.596704 0.303162 0.00000;
+       vertex -0.596704 0.303162 0.0692407;
+       vertex -0.646060 0.296928 0.00000;
+       vertex -0.646060 0.296928 0.0692407;
+       normal 0.266802 -0.963751 0.00000;
+       vertex -0.646060 0.296928 0.00000;
+       vertex -0.646060 0.296928 0.0692407;
+       vertex -0.697495 0.282689 0.00000;
+       vertex -0.697495 0.282689 0.0692407;
+       normal -0.968949 -0.247259 0.00000;
+       texcoord 0.00000 0.500000;
+       vertex -0.135436 -0.0485618 0.00000;
+       vertex -0.135436 -0.0485618 0.0692407;
+       texcoord 0.0170371 0.629410;
+       vertex -0.148293 0.00181912 0.00000;
+       vertex -0.148293 0.00181912 0.0692407;
+       normal -0.148494 -0.988913 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.484642 0.292660 0.00000;
+       vertex -0.484642 0.292660 0.0692407;
+       vertex -0.543496 0.301498 0.00000;
+       vertex -0.543496 0.301498 0.0692407;
+       normal 0.501456 -0.865183 0.00000;
+       texcoord 0.629410 0.0170371;
+       vertex 0.100257 -0.169280 0.00000;
+       vertex 0.100257 -0.169280 0.0692407;
+       texcoord 0.500000 0.00000;
+       vertex 0.0675037 -0.188264 0.00000;
+       vertex 0.0675037 -0.188264 0.0692407;
+       normal -0.0312707 -0.999511 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.543496 0.301498 0.00000;
+       vertex -0.543496 0.301498 0.0692407;
+       vertex -0.596704 0.303162 0.00000;
+       vertex -0.596704 0.303162 0.0692407;
+       normal 0.805732 0.592279 0.00000;
+       texcoord 0.933013 0.750000;
+       vertex 0.0835394 0.136188 0.00000;
+       vertex 0.0835394 0.136188 0.0692407;
+       texcoord 0.982963 0.629409;
+       vertex 0.113350 0.0956334 0.00000;
+       vertex 0.113350 0.0956334 0.0692407;
+       normal -0.242478 0.970157 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -1.05042 0.194418 0.00000;
+       vertex -1.05042 0.194418 0.0692407;
+       vertex -0.997010 0.207767 0.00000;
+       vertex -0.997010 0.207767 0.0692407;
+       normal -0.337865 -0.941195 0.00000;
+       vertex -0.428844 0.272630 0.00000;
+       vertex -0.428844 0.272630 0.0692407;
+       vertex -0.484642 0.292660 0.00000;
+       vertex -0.484642 0.292660 0.0692407;
+       normal -0.905301 -0.424770 0.00000;
+       texcoord 0.0170371 0.370590;
+       vertex -0.113350 -0.0956334 0.00000;
+       vertex -0.113350 -0.0956334 0.0692407;
+       texcoord 0.00000 0.500000;
+       vertex -0.135436 -0.0485618 0.00000;
+       vertex -0.135436 -0.0485618 0.0692407;
+       normal -0.318645 0.947874 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.945589 0.223121 0.00000;
+       vertex -0.945589 0.223121 0.0692407;
+       vertex -0.900620 0.238238 0.00000;
+       vertex -0.900620 0.238238 0.0692407;
+       normal 0.762196 -0.647346 0.00000;
+       texcoord 0.750000 0.0669873;
+       vertex 0.126178 -0.138760 0.00000;
+       vertex 0.126178 -0.138760 0.0692407;
+       texcoord 0.629410 0.0170371;
+       vertex 0.100257 -0.169280 0.00000;
+       vertex 0.100257 -0.169280 0.0692407;
+       normal -1.00000 0.00000 0.00000;
+       texcoord 0.00000 0.00000;
+       vertex -1.05042 0.138760 0.00000;
+       vertex -1.05042 0.138760 0.0692407;
+       vertex -1.05042 0.194418 0.00000;
+       vertex -1.05042 0.194418 0.0692407;
+       normal -0.534783 0.844989 0.00000;
+       vertex -0.855690 0.258928 0.00000;
+       vertex -0.855690 0.258928 0.0692407;
+       normal -0.535227 0.844708 0.00000;
+       vertex -0.806701 0.289932 0.00000;
+       vertex -0.806701 0.289932 0.0692407;
+       normal -0.535671 0.844427 0.00000;
+       vertex -0.759236 0.320042 0.00000;
+       vertex -0.759236 0.320042 0.0692407;
+       normal 0.00000 -1.00000 0.00000;
+       texcoord 0.250000 0.933013;
+       vertex -0.126178 0.138760 0.00000;
+       vertex -0.126178 0.138760 0.0692407;
+       texcoord 0.00000 0.00000;
+       vertex -0.810828 0.138760 0.00000;
+       vertex -0.810828 0.138760 0.0692407;
+       vertex -1.05042 0.138760 0.00000;
+       vertex -1.05042 0.138760 0.0692407;
+       normal 0.00000 0.00000 1.00000;
+       vertex -0.409460 0.323182 0.0692407;
+       vertex -0.470286 0.344716 0.0692407;
+       vertex -0.428844 0.272630 0.0692407;
+       vertex -0.484642 0.292660 0.0692407;
+       vertex -0.543496 0.301498 0.0692407;
+       vertex -0.536318 0.357520 0.0692407;
+       vertex -0.596704 0.303162 0.0692407;
+       vertex -0.598665 0.360512 0.0692407;
+       vertex -0.658383 0.353724 0.0692407;
+       vertex -0.646060 0.296928 0.0692407;
+       vertex -0.709282 0.340096 0.0692407;
+       vertex -0.697495 0.282689 0.0692407;
+       vertex -0.759236 0.320042 0.0692407;
+       vertex -0.742616 0.261152 0.0692407;
+       vertex -0.806701 0.289932 0.0692407;
+       vertex -0.779847 0.229709 0.0692407;
+       vertex -0.807469 0.194418 0.0692407;
+       vertex -0.855690 0.258928 0.0692407;
+       vertex -0.900620 0.238238 0.0692407;
+       vertex -0.945589 0.223121 0.0692407;
+       vertex -0.997010 0.207767 0.0692407;
+       vertex -1.05042 0.194418 0.0692407;
+       vertex -0.810828 0.138760 0.0692407;
+       vertex -1.05042 0.138760 0.0692407;
+       texcoord 0.629409 0.982963;
+       vertex -0.0301501 0.194418 0.0692407;
+       texcoord 0.250000 0.933013;
+       vertex -0.126178 0.138760 0.0692407;
+       texcoord 0.500000 0.500000;
+       vertex 2.31753e-10 -6.11486e-10 0.0692407;
+       texcoord 0.146447 0.853553;
+       vertex -0.143500 0.0987842 0.0692407;
+       texcoord 0.750000 0.933013;
+       vertex 0.00925825 0.187322 0.0692407;
+       texcoord 0.0669873 0.750000;
+       vertex -0.151043 0.0520761 0.0692407;
+       texcoord 0.853553 0.853553;
+       vertex 0.0480356 0.167461 0.0692407;
+       texcoord 0.0170371 0.629410;
+       vertex -0.148293 0.00181912 0.0692407;
+       texcoord 0.933013 0.750000;
+       vertex 0.0835394 0.136188 0.0692407;
+       texcoord 0.00000 0.500000;
+       vertex -0.135436 -0.0485618 0.0692407;
+       texcoord 0.982963 0.629409;
+       vertex 0.113350 0.0956334 0.0692407;
+       texcoord 0.0170371 0.370590;
+       vertex -0.113350 -0.0956334 0.0692407;
+       texcoord 1.00000 0.500000;
+       vertex 0.135436 0.0485618 0.0692407;
+       texcoord 0.0669873 0.250000;
+       vertex -0.0835394 -0.136188 0.0692407;
+       texcoord 0.982963 0.370591;
+       vertex 0.148293 -0.00181911 0.0692407;
+       texcoord 0.146447 0.146447;
+       vertex -0.0480356 -0.167461 0.0692407;
+       texcoord 0.933013 0.250000;
+       vertex 0.151043 -0.0520761 0.0692407;
+       texcoord 0.250000 0.0669873;
+       vertex -0.00925823 -0.187322 0.0692407;
+       texcoord 0.853553 0.146447;
+       vertex 0.143500 -0.0987842 0.0692407;
+       texcoord 0.370590 0.0170371;
+       vertex 0.0301500 -0.194418 0.0692407;
+       texcoord 0.750000 0.0669873;
+       vertex 0.126178 -0.138760 0.0692407;
+       texcoord 0.500000 0.00000;
+       vertex 0.0675037 -0.188264 0.0692407;
+       texcoord 0.629410 0.0170371;
+       vertex 0.100257 -0.169280 0.0692407;
+       normal 0.00000 0.00000 -1.00000;
+       texcoord 0.00000 0.00000;
+       vertex -0.409460 0.323182 0.00000;
+       vertex -0.428844 0.272630 0.00000;
+       vertex -0.470286 0.344716 0.00000;
+       vertex -0.484642 0.292660 0.00000;
+       vertex -0.543496 0.301498 0.00000;
+       vertex -0.536318 0.357520 0.00000;
+       vertex -0.596704 0.303162 0.00000;
+       vertex -0.598665 0.360512 0.00000;
+       vertex -0.658383 0.353724 0.00000;
+       vertex -0.646060 0.296928 0.00000;
+       vertex -0.709282 0.340096 0.00000;
+       vertex -0.697495 0.282689 0.00000;
+       vertex -0.759236 0.320042 0.00000;
+       vertex -0.742616 0.261152 0.00000;
+       vertex -0.806701 0.289932 0.00000;
+       vertex -0.779847 0.229709 0.00000;
+       vertex -0.807469 0.194418 0.00000;
+       vertex -0.855690 0.258928 0.00000;
+       vertex -0.900620 0.238238 0.00000;
+       vertex -0.945589 0.223121 0.00000;
+       vertex -0.997010 0.207767 0.00000;
+       vertex -1.05042 0.194418 0.00000;
+       vertex -0.810828 0.138760 0.00000;
+       vertex -1.05042 0.138760 0.00000;
+       texcoord 0.629409 0.982963;
+       vertex -0.0301501 0.194418 0.00000;
+       texcoord 0.250000 0.933013;
+       vertex -0.126178 0.138760 0.00000;
+       texcoord 0.500000 0.500000;
+       vertex 2.31753e-10 -6.11486e-10 0.00000;
+       texcoord 0.146447 0.853553;
+       vertex -0.143500 0.0987842 0.00000;
+       texcoord 0.750000 0.933013;
+       vertex 0.00925825 0.187322 0.00000;
+       texcoord 0.0669873 0.750000;
+       vertex -0.151043 0.0520761 0.00000;
+       texcoord 0.853553 0.853553;
+       vertex 0.0480356 0.167461 0.00000;
+       texcoord 0.0170371 0.629410;
+       vertex -0.148293 0.00181912 0.00000;
+       texcoord 0.933013 0.750000;
+       vertex 0.0835394 0.136188 0.00000;
+       texcoord 0.00000 0.500000;
+       vertex -0.135436 -0.0485618 0.00000;
+       texcoord 0.982963 0.629409;
+       vertex 0.113350 0.0956334 0.00000;
+       texcoord 0.0170371 0.370590;
+       vertex -0.113350 -0.0956334 0.00000;
+       texcoord 1.00000 0.500000;
+       vertex 0.135436 0.0485618 0.00000;
+       texcoord 0.0669873 0.250000;
+       vertex -0.0835394 -0.136188 0.00000;
+       texcoord 0.982963 0.370591;
+       vertex 0.148293 -0.00181911 0.00000;
+       texcoord 0.146447 0.146447;
+       vertex -0.0480356 -0.167461 0.00000;
+       texcoord 0.933013 0.250000;
+       vertex 0.151043 -0.0520761 0.00000;
+       texcoord 0.250000 0.0669873;
+       vertex -0.00925823 -0.187322 0.00000;
+       texcoord 0.853553 0.146447;
+       vertex 0.143500 -0.0987842 0.00000;
+       texcoord 0.370590 0.0170371;
+       vertex 0.0301500 -0.194418 0.00000;
+       texcoord 0.750000 0.0669873;
+       vertex 0.126178 -0.138760 0.00000;
+       texcoord 0.500000 0.00000;
+       vertex 0.0675037 -0.188264 0.00000;
+       texcoord 0.629410 0.0170371;
+       vertex 0.100257 -0.169280 0.00000;
+};
+batch TRIANGLE_STRIP
+{
+       indices 0 1 2 3;
+};
+batch TRIANGLE_STRIP
+{
+       indices 4 5 6 7;
+};
+batch TRIANGLE_STRIP
+{
+       indices 8 9 10 11;
+};
+batch TRIANGLE_STRIP
+{
+       indices 12 13 14 15;
+};
+batch TRIANGLE_STRIP
+{
+       indices 16 17 18 19;
+};
+batch TRIANGLE_STRIP
+{
+       indices 20 21 22 23;
+};
+batch TRIANGLE_STRIP
+{
+       indices 24 25 26 27;
+};
+batch TRIANGLE_STRIP
+{
+       indices 28 29 30 31;
+};
+batch TRIANGLE_STRIP
+{
+       indices 32 33 34 35;
+};
+batch TRIANGLE_STRIP
+{
+       indices 36 37 38 39;
+};
+batch TRIANGLE_STRIP
+{
+       indices 40 41 42 43;
+};
+batch TRIANGLE_STRIP
+{
+       indices 44 45 46 47;
+};
+batch TRIANGLE_STRIP
+{
+       indices 48 49 50 51;
+};
+batch TRIANGLE_STRIP
+{
+       indices 52 53 54 55;
+};
+batch TRIANGLE_STRIP
+{
+       indices 56 57 58 59;
+};
+batch TRIANGLE_STRIP
+{
+       indices 60 61 62 63;
+};
+batch TRIANGLE_STRIP
+{
+       indices 64 65 66 67;
+};
+batch TRIANGLE_STRIP
+{
+       indices 68 69 70 71;
+};
+batch TRIANGLE_STRIP
+{
+       indices 72 73 74 75;
+};
+batch TRIANGLE_STRIP
+{
+       indices 76 77 78 79;
+};
+batch TRIANGLE_STRIP
+{
+       indices 80 81 82 83;
+};
+batch TRIANGLE_STRIP
+{
+       indices 84 85 86 87;
+};
+batch TRIANGLE_STRIP
+{
+       indices 88 89 90 91;
+};
+batch TRIANGLE_STRIP
+{
+       indices 92 93 94 95;
+};
+batch TRIANGLE_STRIP
+{
+       indices 96 97 98 99;
+};
+batch TRIANGLE_STRIP
+{
+       indices 100 101 102 103;
+};
+batch TRIANGLE_STRIP
+{
+       indices 104 105 106 107;
+};
+batch TRIANGLE_STRIP
+{
+       indices 108 109 110 111;
+};
+batch TRIANGLE_STRIP
+{
+       indices 112 113 114 115;
+};
+batch TRIANGLE_STRIP
+{
+       indices 116 117 118 119;
+};
+batch TRIANGLE_STRIP
+{
+       indices 120 121 122 123;
+};
+batch TRIANGLE_STRIP
+{
+       indices 124 125 126 127;
+};
+batch TRIANGLE_STRIP
+{
+       indices 128 129 130 131;
+};
+batch TRIANGLE_STRIP
+{
+       indices 132 133 134 135;
+};
+batch TRIANGLE_STRIP
+{
+       indices 136 137 138 139;
+};
+batch TRIANGLE_STRIP
+{
+       indices 140 141 142 143;
+};
+batch TRIANGLE_STRIP
+{
+       indices 144 145 146 147;
+};
+batch TRIANGLE_STRIP
+{
+       indices 148 149 150 151;
+};
+batch TRIANGLE_STRIP
+{
+       indices 152 153 154 155;
+};
+batch TRIANGLE_STRIP
+{
+       indices 156 157 158 159;
+};
+batch TRIANGLE_STRIP
+{
+       indices 160 161 162 163;
+};
+batch TRIANGLE_STRIP
+{
+       indices 164 165 166 167;
+};
+batch TRIANGLE_STRIP
+{
+       indices 168 169 170 171 172 173;
+};
+batch TRIANGLE_STRIP
+{
+       indices 174 175 176 177 178 179;
+};
+batch TRIANGLE_STRIP
+{
+       indices 180 181 182 183 183 181 184 185 186 187 188 188 186 189 189 188 190 190 189 191 191 190 192 192 191 193 193 192 194 194 193 195;
+       indices 195 194 196 197 198 198 196 199 200 200 196 201 202 203;
+};
+batch TRIANGLE_STRIP
+{
+       indices 196 202 204 205 206 207;
+};
+batch TRIANGLE_STRIP
+{
+       indices 208 204 206 206 209 207;
+};
+batch TRIANGLE_STRIP
+{
+       indices 210 208 206 206 211 209;
+};
+batch TRIANGLE_STRIP
+{
+       indices 212 210 206 206 213 211;
+};
+batch TRIANGLE_STRIP
+{
+       indices 214 212 206 206 215 213;
+};
+batch TRIANGLE_STRIP
+{
+       indices 216 214 206 206 217 215;
+};
+batch TRIANGLE_STRIP
+{
+       indices 218 216 206 206 219 217;
+};
+batch TRIANGLE_STRIP
+{
+       indices 220 218 206 206 221 219;
+};
+batch TRIANGLE_STRIP
+{
+       indices 222 220 206 206 223 221;
+};
+batch TRIANGLE_STRIP
+{
+       indices 224 222 206 206 225 223;
+};
+batch TRIANGLE_STRIP
+{
+       indices 224 206 226 225;
+};
+batch TRIANGLE_STRIP
+{
+       indices 227 228 229 230 231 231 229 232 232 231 233 233 232 234 234 233 235 236 237 238 239 240 241 242 243 243 241 244 244 243 245 246;
+       indices 246 243 247 248 248 243 249 249 248 250;
+};
+batch TRIANGLE_STRIP
+{
+       indices 243 251 249 252 252 251 253 253 252 254;
+};
+batch TRIANGLE_STRIP
+{
+       indices 251 255 253 253 254 256;
+};
+batch TRIANGLE_STRIP
+{
+       indices 255 257 253 253 256 258;
+};
+batch TRIANGLE_STRIP
+{
+       indices 257 259 253 253 258 260;
+};
+batch TRIANGLE_STRIP
+{
+       indices 259 261 253 253 260 262;
+};
+batch TRIANGLE_STRIP
+{
+       indices 261 263 253 253 262 264;
+};
+batch TRIANGLE_STRIP
+{
+       indices 263 265 253 253 264 266;
+};
+batch TRIANGLE_STRIP
+{
+       indices 265 267 253 253 266 268;
+};
+batch TRIANGLE_STRIP
+{
+       indices 267 269 253 253 268 270;
+};
+batch TRIANGLE_STRIP
+{
+       indices 269 271 253 253 270 272;
+};
+batch TRIANGLE_STRIP
+{
+       indices 271 273 253 272;
+};
diff --git a/examples/bassteroids/data/exported/Quaver.object b/examples/bassteroids/data/exported/Quaver.object
new file mode 100644 (file)
index 0000000..13cb2fd
--- /dev/null
@@ -0,0 +1,3 @@
+bounding_sphere_hint -0.453461 0.0478167 0.0346204 0.615673;
+mesh "Quaver.mesh";
+technique "Note.tech";
diff --git a/examples/bassteroids/source/bullet.cpp b/examples/bassteroids/source/bullet.cpp
new file mode 100644 (file)
index 0000000..260601b
--- /dev/null
@@ -0,0 +1,8 @@
+#include "bullet.h"
+
+using namespace Msp;
+
+Bullet::Bullet(Game::Handle<Game::Entity> p, const Setup &s):
+       PhysicalEntity(p, s.physical),
+       mesh(*this, s.mesh)
+{ }
diff --git a/examples/bassteroids/source/bullet.h b/examples/bassteroids/source/bullet.h
new file mode 100644 (file)
index 0000000..825125f
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef BULLET_H_
+#define BULLET_H_
+
+#include <msp/game/meshsource.h>
+#include "physicalentity.h"
+
+struct BulletSetup
+{
+       PhysicalSetup physical;
+       Msp::Game::MeshSourceSetup mesh;
+};
+
+class Bullet: public PhysicalEntity
+{
+private:
+       Msp::Game::Owned<Msp::Game::MeshSource> mesh;
+
+public:
+       using Setup = BulletSetup;
+
+       Bullet(Msp::Game::Handle<Msp::Game::Entity>, const Setup &);
+};
+
+#endif
index cd7e72ad3a53f191a36b23921466d1834dbd985f..65a879d2447727277ce4da16c4b4e1f822f57aef 100644 (file)
@@ -10,7 +10,9 @@ PlayerController::PlayerController(Game::Stage &s):
        System(s),
        player_setup{ .physical={ .body={ .mass=1, .moment_of_inertia=0.8f }, .collider={ .type=ColliderType::CIRCLE, .radius=0.8f }},
                .mesh={ .object_name="Bass guitar.object" },
-               .speed=12.0f, .turn_rate=4.71f }
+               .speed=12.0f, .turn_rate=4.71f },
+       bullet_setup{ .physical={ .body={ .mass=0.05f, .moment_of_inertia=0.04f }, .collider={ .type=ColliderType::CIRCLE, .radius=0.2f }},
+               .mesh={ .object_name="Quaver.object" }}
 { }
 
 void PlayerController::set_controls(Controls *c)
@@ -46,4 +48,23 @@ void PlayerController::tick(Time::TimeDelta dt)
        Geometry::Angle<float> angular_speed = abs(angular_vel);
        if(abs(angular_speed.radians())>1e-5)
                body->add_torque(angular_vel.radians()*-min(angular_speed.radians()+setup.turn_rate/angular_speed.radians(), 1.0f/dt_secs));
+
+       if(controls->fire.was_pressed())
+               fire();
+
+       controls->reset_edges();
+}
+
+void PlayerController::fire()
+{
+       Game::Handle<Game::Transform> player_tf = player_ship->get_transform();
+       Game::Handle<RigidBody> player_body = player_ship->get_body();
+
+       bullets.emplace_back(stage.get_root(), bullet_setup);
+       Game::Handle<Bullet> bullet = bullets.back();
+       Game::Handle<Game::Transform> bullet_tf = bullet->get_transform();
+       bullet_tf->set_position((player_tf->get_world_matrix()*LinAl::Vector<float, 4>(2.0f, 0.0f, 0.0f, 1.0f)).slice<3>(0));
+       bullet_tf->set_rotation(player_tf->get_rotation()*Geometry::Quaternion<float>::rotation(Geometry::Angle<float>::from_degrees(10), LinAl::Vector<float, 3>(0.0f, 0.0f, 1.0f)));
+       Game::Handle<RigidBody> bullet_body = bullet->get_body();
+       bullet_body->set_velocity(player_body->get_velocity()+(player_tf->get_world_matrix()*LinAl::Vector<float, 4>(20.0f, 0.0f, 0.0f, 0.0f)).slice<2>(0));
 }
index 83d49f1d715e0edb50ea28041e248984a01ed2c2..d29b2d6218a5fbc9f0a924f3fd9ca06e6167d39c 100644 (file)
@@ -4,6 +4,7 @@
 #include <msp/game/eventobserver.h>
 #include <msp/game/owned.h>
 #include <msp/game/system.h>
+#include "bullet.h"
 #include "ship.h"
 
 class Controls;
@@ -13,7 +14,9 @@ class PlayerController: public Msp::Game::System
 private:
        Controls *controls = nullptr;
        ShipSetup player_setup;
+       BulletSetup bullet_setup;
        Msp::Game::Owned<Ship> player_ship;
+       std::vector<Msp::Game::Owned<Bullet>> bullets;
 
 public:
        PlayerController(Msp::Game::Stage &);
@@ -21,6 +24,8 @@ public:
        void set_controls(Controls *);
 
        void tick(Msp::Time::TimeDelta) override;
+private:
+       void fire();
 };
 
 #endif