aboutsummaryrefslogtreecommitdiff
path: root/src/o3d/mesh.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/o3d/mesh.cpp')
-rw-r--r--src/o3d/mesh.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/o3d/mesh.cpp b/src/o3d/mesh.cpp
index 60c7f8b..2423e88 100644
--- a/src/o3d/mesh.cpp
+++ b/src/o3d/mesh.cpp
@@ -6,26 +6,25 @@
using namespace engine::o3d;
-Mesh Mesh::plane() {
+Mesh Mesh::plane(float width, float height) {
+ const float w2 = width / 2,
+ h2 = height / 2;
return {
{
- {-1.f, 0.f, -1.f, 1.f},
- {+1.f, 0.f, -1.f, 1.f},
- {+1.f, 0.f, +1.f, 1.f},
- {-1.f, 0.f, +1.f, 1.f},
+ {-w2 / 2, 0.f, -h2 / 2, 1.f},
+ {+w2 / 2, 0.f, -h2 / 2, 1.f},
+ {+w2 / 2, 0.f, +h2 / 2, 1.f},
+ {-w2 / 2, 0.f, +h2 / 2, 1.f},
},
- { {0.f, 0.f, -1.f} },
{
- {0.f, 0.f},
- {1.f, 0.f},
- {1.f, 1.f},
- {0.f, 1.f},
+ {0.f, -1.f, 0.f},
+ {0.f, +1.f, 0.f},
},
{
- {{ {{0, 0, 0}}, {{1, 0, 1}}, {{2, 0, 2}} }},
- {{ {{2, 0, 2}}, {{3, 0, 3}}, {{0, 0, 0}} }},
- {{ {{0, 0, 0}}, {{3, 0, 3}}, {{2, 0, 2}} }},
- {{ {{2, 0, 2}}, {{1, 0, 1}}, {{0, 0, 0}} }},
+ {{ {{0, 0}}, {{1, 0}}, {{2, 0}} }},
+ {{ {{2, 0}}, {{3, 0}}, {{0, 0}} }},
+ {{ {{0, 1}}, {{3, 1}}, {{2, 1}} }},
+ {{ {{2, 1}}, {{1, 1}}, {{0, 1}} }},
}
};
}