Bit of cleanup.

This commit is contained in:
2023-11-01 23:08:20 -05:00
parent d530210bed
commit c4032b4a84
32 changed files with 212 additions and 162 deletions

View File

@ -98,12 +98,12 @@ void Mesh::disposeBuffers() {
}
void Mesh::bufferPositions(int32_t pos, glm::vec3 *positions, int32_t len) {
assertNotNull(positions, "Mesh::bufferPositions: Positions cannot be null");
assertTrue(pos >= 0 && pos < this->verticeCount, "Mesh::bufferPositions: Position must be within range");
assertTrue(pos+len <= this->verticeCount, "Mesh::bufferPositions: Position + Length must be within range");
assertTrue(len > 0, "Mesh::bufferPositions: Length must be greater than zero");
assertNotNull(positions, "Positions cannot be null");
assertTrue(pos >= 0 && pos < verticeCount, "Position must be within range");
assertTrue(pos+len <= verticeCount, "Position + Length must be within range");
assertTrue(len > 0, "Length must be greater than zero");
glBindBuffer(GL_ARRAY_BUFFER, this->vertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
assertNoGLError();
glBufferSubData(
GL_ARRAY_BUFFER,
@ -115,10 +115,10 @@ void Mesh::bufferPositions(int32_t pos, glm::vec3 *positions, int32_t len) {
}
void Mesh::bufferCoordinates(int32_t pos, glm::vec2 *coordinates, int32_t len) {
assertNotNull(coordinates, "Mesh::bufferCoordinates: Coordinates cannot be null");
assertTrue(pos >= 0 && pos < this->verticeCount, "Mesh::bufferCoordinates: Position must be within range");
assertTrue(pos+len <= this->verticeCount, "Mesh::bufferCoordinates: Position + Length must be within range");
assertTrue(len > 0, "Mesh::bufferCoordinates: Length must be greater than zero");
assertNotNull(coordinates, "Coordinates cannot be null");
assertTrue(pos >= 0 && pos < verticeCount, "Position must be within range");
assertTrue(pos+len <= verticeCount, "Position + Length must be within range");
assertTrue(len > 0, "Length must be greater than zero");
auto offsetCoordinates = (
(sizeof(glm::vec3) * this->verticeCount) +
@ -137,12 +137,12 @@ void Mesh::bufferCoordinates(int32_t pos, glm::vec2 *coordinates, int32_t len) {
}
void Mesh::bufferIndices(int32_t pos, meshindice_t *indices, int32_t len) {
assertNotNull(indices, "Mesh::bufferIndices: Indices cannot be null");
assertTrue(pos >= 0 && pos < this->indiceCount, "Mesh::bufferIndices: Position must be within range");
assertTrue(pos+len <= this->indiceCount, "Mesh::bufferIndices: Position + Length must be within range");
assertTrue(len > 0, "Mesh::bufferIndices: Length must be greater than zero");
assertNotNull(indices, "Indices cannot be null");
assertTrue(pos >= 0 && pos < indiceCount, "Position must be within range");
assertTrue(pos+len <= indiceCount, "Position + Length must be within range");
assertTrue(len > 0, "Length must be greater than zero");
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->indexBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
assertNoGLError();
glBufferSubData(
GL_ELEMENT_ARRAY_BUFFER,