forked from Shell4026/ShellEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrid.cpp
More file actions
32 lines (28 loc) · 848 Bytes
/
Copy pathGrid.cpp
File metadata and controls
32 lines (28 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "pch.h"
#include "Mesh/Grid.h"
#include "Core/SContainer.hpp"
namespace sh::render
{
SH_RENDER_API Grid::Grid()
{
core::SVector<glm::vec3> verts{};
core::SVector<uint32_t> indices{};
for (int w = -10; w < 11; ++w)
{
verts.push_back(glm::vec3{ static_cast<float>(w), 0.f, -10.f });
verts.push_back(glm::vec3{ static_cast<float>(w), 0.f, 10.f });
indices.push_back(indices.size());
indices.push_back(indices.size());
}
for (int h = -10; h < 11; ++h)
{
verts.push_back(glm::vec3{ -10.f, 0.f, static_cast<float>(h) });
verts.push_back(glm::vec3{ 10.f, 0.f, static_cast<float>(h) });
indices.push_back(indices.size());
indices.push_back(indices.size());
}
this->SetVertex(std::move(verts));
this->SetIndices(std::move(indices));
this->SetTopology(Mesh::Topology::Line);
}
}//namespace