GIGA REFACTOR

This commit is contained in:
2022-03-02 18:51:42 +01:00
parent 553b2f6aad
commit 6df59b1487
92 changed files with 1807 additions and 1785 deletions

View File

@@ -4,12 +4,12 @@
namespace td {
namespace render {
void VertexCache::addData(std::uint64_t index, std::vector<float> positions, std::vector<float> colors) {
void VertexCache::AddData(std::uint64_t index, std::vector<float> positions, std::vector<float> colors) {
m_Indexes.insert({ index, {positions, colors} });
m_VertexCount += colors.size(); // one color per vertex
}
void VertexCache::removeData(std::uint64_t index) {
void VertexCache::RemoveData(std::uint64_t index) {
auto it = m_Indexes.find(index);
if (it != m_Indexes.end()) {
m_Indexes.erase(it);
@@ -17,12 +17,12 @@ void VertexCache::removeData(std::uint64_t index) {
}
}
void VertexCache::clear() {
void VertexCache::Clear() {
m_Indexes.clear();
m_VertexCount = 0;
}
void VertexCache::updateVertexArray() {
void VertexCache::UpdateVertexArray() {
m_VertexArray = std::make_unique<GL::VertexArray>(m_VertexCount); // one color per vertex
Vector positions;
@@ -39,15 +39,15 @@ void VertexCache::updateVertexArray() {
}
GL::VertexBuffer positionsBuffer(positions, 2);
positionsBuffer.addVertexAttribPointer(0, 2, 0);
positionsBuffer.AddVertexAttribPointer(0, 2, 0);
GL::VertexBuffer colorsBuffer(colors, 1);
colorsBuffer.addVertexAttribPointer(1, 1, 0);
colorsBuffer.AddVertexAttribPointer(1, 1, 0);
m_VertexArray->bind();
m_VertexArray->bindVertexBuffer(positionsBuffer);
m_VertexArray->bindVertexBuffer(colorsBuffer);
m_VertexArray->unbind();
m_VertexArray->Bind();
m_VertexArray->BindVertexBuffer(positionsBuffer);
m_VertexArray->BindVertexBuffer(colorsBuffer);
m_VertexArray->Unbind();
}
} // namespace render