summaryrefslogtreecommitdiff
path: root/lib/basicShapes.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-07 13:23:27 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-07 13:23:27 +0000
commit108bf5b2424da06aa2e1735ffd10a2b713834db8 (patch)
treeaf0918a6a266aa7e6ee1d8129df6d5ef9fc4f8ab /lib/basicShapes.h
parentRemove more use of legacy types and unnecessary pointers from selectable inte... (diff)
parentRemove Position3D from RailVehicle (diff)
downloadilt-108bf5b2424da06aa2e1735ffd10a2b713834db8.tar.bz2
ilt-108bf5b2424da06aa2e1735ffd10a2b713834db8.tar.xz
ilt-108bf5b2424da06aa2e1735ffd10a2b713834db8.zip
Merge branch 'template-types'
Diffstat (limited to 'lib/basicShapes.h')
-rw-r--r--lib/basicShapes.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/basicShapes.h b/lib/basicShapes.h
new file mode 100644
index 0000000..183863e
--- /dev/null
+++ b/lib/basicShapes.h
@@ -0,0 +1,19 @@
+#pragma once
+#include <array>
+#include <glm/vec3.hpp>
+
+template<typename T, glm::qualifier Q = glm::defaultp>
+constexpr std::array<glm::vec<3, T, Q>, 8>
+cuboidCorners(T lx, T ux, T ly, T uy, T lz, T uz)
+{
+ return {{
+ {lx, uy, lz}, // LFB
+ {ux, uy, lz}, // RFB
+ {lx, uy, uz}, // LFT
+ {ux, uy, uz}, // RFT
+ {lx, ly, lz}, // LBB
+ {ux, ly, lz}, // RBB
+ {lx, ly, uz}, // LBT
+ {ux, ly, uz}, // RBT
+ }};
+}