aboutsummaryrefslogtreecommitdiff
path: root/src/o3d/obj3d.cpp
diff options
context:
space:
mode:
authorvimene <vincent.menegaux@gmail.com>2023-11-26 06:49:51 +0100
committervimene <vincent.menegaux@gmail.com>2023-11-26 06:49:51 +0100
commitf63febed2a769d0c55192e192a20b8e39f162932 (patch)
treef12fef4643e03e93363f902e35d06ef92dd8350d /src/o3d/obj3d.cpp
parent97f4e5c80483255912b177e6a2557344da499a3e (diff)
downloadengine-f63febed2a769d0c55192e192a20b8e39f162932.tar.gz
improved matrices, cube building and command parsing
Diffstat (limited to 'src/o3d/obj3d.cpp')
-rw-r--r--src/o3d/obj3d.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/o3d/obj3d.cpp b/src/o3d/obj3d.cpp
index 46f4db6..584e304 100644
--- a/src/o3d/obj3d.cpp
+++ b/src/o3d/obj3d.cpp
@@ -34,6 +34,29 @@ Object3D::TriangleVertex3Iterator::reference Object3D::TriangleVertex3Iterator::
};
}
+Object3D Object3D::cube() {
+ return {
+ {
+ { MathVector3(-1.f, -1.f, -1.f), {} },
+ { MathVector3(+1.f, -1.f, -1.f), {} },
+ { MathVector3(-1.f, +1.f, -1.f), {} },
+ { MathVector3(+1.f, +1.f, -1.f), {} },
+ { MathVector3(-1.f, -1.f, +1.f), {} },
+ { MathVector3(+1.f, -1.f, +1.f), {} },
+ { MathVector3(-1.f, +1.f, +1.f), {} },
+ { MathVector3(+1.f, +1.f, +1.f), {} },
+ },
+ {
+ { 0, 2, 3 }, { 0, 3, 1 }, // face 1
+ { 0, 4, 6 }, { 0, 6, 2 }, // face 2
+ { 0, 1, 5 }, { 0, 5, 4 }, // face 3
+ { 7, 6, 4 }, { 7, 4, 5 }, // face 4
+ { 7, 3, 2 }, { 7, 2, 6 }, // face 5
+ { 7, 5, 1 }, { 7, 1, 3 }, // face 6
+ }
+ };
+}
+
Object3D::Object3D(std::vector<Vertex3> pts, std::vector<std::array<int, 3>> faces) : pts{pts}, faces{faces} {
}