diff options
author | rtk0c <[email protected]> | 2022-04-25 20:22:07 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-04-25 20:22:07 -0700 |
commit | 855da86feae1a5cc14dc2d486ccf115f484dbc2e (patch) | |
tree | 8284c6a6bdfb1a919eb1a22f466f4180a329c7f3 /source/CpuMesh.cpp | |
parent | d78a55de5003dbb040f1d1c369409e63a2c806d8 (diff) |
Changeset: 16 Initial work on rendering sprites to screen
Diffstat (limited to 'source/CpuMesh.cpp')
-rw-r--r-- | source/CpuMesh.cpp | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/source/CpuMesh.cpp b/source/CpuMesh.cpp deleted file mode 100644 index 15b0f54..0000000 --- a/source/CpuMesh.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "CpuMesh.hpp" - -#include <cstring> - -StandardCpuMesh::StandardCpuMesh() - : mGpuMesh(new GpuMesh()) { - mGpuMesh->vertFormat = gVformatStandard; - mGpuMesh->vertBufBindings.SetBinding(0, new GpuVertexBuffer()); - mGpuMesh->vertBufBindings.SetBinding(1, new GpuVertexBuffer()); - mGpuMesh->indexBuf.Attach(new GpuIndexBuffer()); -} - -StandardCpuMesh::~StandardCpuMesh() { - delete mData; -} - -void StandardCpuMesh::CreateCpuData() { - if (!mData) { - mData = new StandardCpuMeshData(); - } -} - -GpuVertexBuffer* StandardCpuMesh::GetPosBuffer() const { - return mGpuMesh->vertBufBindings.bindings[0].Get(); -} - -GpuVertexBuffer* StandardCpuMesh::GetExtraBuffer() const { - return mGpuMesh->vertBufBindings.bindings[1].Get(); -} - -bool StandardCpuMesh::UpdatePositions(glm::vec3* pos, size_t count, size_t startVertIndex) { - if (mData) { - std::memcpy(&mData->vertPositions[startVertIndex], pos, count * sizeof(glm::vec3)); - } - auto posBuf = GetPosBuffer(); - glBindBuffer(GL_ARRAY_BUFFER, posBuf->handle); - glBufferSubData(GL_ARRAY_BUFFER, startVertIndex * mGpuMesh->vertFormat->vertexSize, count * sizeof(glm::vec3), pos); - return true; -} - -bool StandardCpuMesh::UpdateColors(RgbaColor* color, size_t count, size_t starVertIndex) { - if (!mData) return false; - // TODO -} - -bool StandardCpuMesh::UpdateNormals(glm::vec2* normals, size_t count, size_t startVertIndex) { - if (!mData) return false; - // TODO -} - -bool StandardCpuMesh::UpdateIndices(uint32_t* indices, size_t count, size_t startVertIndex) { - if (!mData) return false; - // TODO -} |