Testing textures and events

This commit is contained in:
2022-10-20 15:49:25 -07:00
parent 375b25ff59
commit 80d6cba854
27 changed files with 513 additions and 26 deletions

View File

@ -7,5 +7,4 @@
target_sources(${DAWN_TARGET_NAME}
PRIVATE
Mesh.cpp
TriangleMesh.cpp
)

View File

@ -80,10 +80,15 @@ namespace Dawn {
int32_t position,
std::array<glm::vec2, N> coordinates
) {
auto offsetCoordinates = (
(sizeof(glm::vec3) * this->verticeCount) +
(sizeof(glm::vec2) * position)
);
glBindBuffer(GL_ARRAY_BUFFER, this->vertexBuffer);
glBufferSubData(
GL_ARRAY_BUFFER,
sizeof(glm::vec2) * position,
offsetCoordinates,
sizeof(coordinates),
(void *)coordinates.data()
);

View File

@ -1,26 +0,0 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "display/mesh/Mesh.hpp"
#include "display/mesh/TriangleMesh.hpp"
using namespace Dawn;
void TriangleMesh::createTriangleMesh(Mesh &mesh) {
mesh.createBuffers(3, 3);
mesh.bufferPositions(0, std::array<glm::vec3, 3>{{
glm::vec3(-1, 0, 0),
glm::vec3(0, 1, 0),
glm::vec3(1, 0, 0)
}});
mesh.bufferCoordinates(0, std::array<glm::vec2, 3>{{
glm::vec2(0, 0),
glm::vec2(0, 1),
glm::vec2(1, 0)
}});
mesh.bufferIndices(0, std::array<meshindice_t,3>{{
0, 1, 2
}});
}