-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTerrain.cpp
More file actions
23 lines (20 loc) · 824 Bytes
/
Terrain.cpp
File metadata and controls
23 lines (20 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "Terrain.hpp"
namespace terrain {
modelLoading::MeshData CreatePlaneMesh(float size) {
return CreatePlaneMesh(size, size);
}
modelLoading::MeshData CreatePlaneMesh(float width, float depth) {
const float halfWidth = width * 0.5f;
const float halfDepth = depth * 0.5f;
modelLoading::MeshData mesh;
mesh.hasTexcoord = true;
mesh.vertices = {
{ {-halfWidth, 0.0f, -halfDepth}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f} },
{ { halfWidth, 0.0f, -halfDepth}, {0.0f, 1.0f, 0.0f}, {1.0f, 0.0f} },
{ { halfWidth, 0.0f, halfDepth}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f} },
{ {-halfWidth, 0.0f, halfDepth}, {0.0f, 1.0f, 0.0f}, {0.0f, 1.0f} }
};
mesh.indices = { 0, 2, 1, 2, 0, 3 };
return mesh;
}
}