GIGA REFACTOR
This commit is contained in:
@@ -20,17 +20,17 @@ VertexArray::VertexArray(unsigned int vertexCount) : m_VertexCount(vertexCount)
|
||||
glGenVertexArrays(1, &m_ID);
|
||||
}
|
||||
|
||||
void VertexArray::bind() const {
|
||||
void VertexArray::Bind() const {
|
||||
glBindVertexArray(m_ID);
|
||||
}
|
||||
|
||||
void VertexArray::unbind() const {
|
||||
void VertexArray::Unbind() const {
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void VertexArray::bindVertexBuffer(VertexBuffer& VertexBuffer) {
|
||||
VertexBuffer.bind();
|
||||
VertexBuffer.bindVertexAttribs();
|
||||
void VertexArray::BindVertexBuffer(VertexBuffer& VertexBuffer) {
|
||||
VertexBuffer.Bind();
|
||||
VertexBuffer.BindVertexAttribs();
|
||||
m_VertexBuffers.push_back(std::move(VertexBuffer));
|
||||
}
|
||||
|
||||
@@ -41,21 +41,21 @@ VertexBuffer::~VertexBuffer() {
|
||||
|
||||
VertexBuffer::VertexBuffer(const std::vector<float>& data, unsigned int stride) : m_DataStride(stride) {
|
||||
glGenBuffers(1, &m_ID);
|
||||
bind();
|
||||
Bind();
|
||||
glBufferData(GL_ARRAY_BUFFER, static_cast<GLsizeiptr>(data.size() * sizeof(float)), nullptr, GL_STATIC_DRAW);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, static_cast<GLsizeiptr>(data.size() * sizeof(float)), data.data());
|
||||
unbind();
|
||||
Unbind();
|
||||
}
|
||||
|
||||
void VertexBuffer::bind() const {
|
||||
void VertexBuffer::Bind() const {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_ID);
|
||||
}
|
||||
|
||||
void VertexBuffer::unbind() const {
|
||||
void VertexBuffer::Unbind() const {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
void VertexBuffer::addVertexAttribPointer(unsigned int index, unsigned int coordinateSize, unsigned int offset) {
|
||||
void VertexBuffer::AddVertexAttribPointer(unsigned int index, unsigned int coordinateSize, unsigned int offset) {
|
||||
VertexAttribPointer pointer;
|
||||
pointer.m_Index = index;
|
||||
pointer.m_Size = coordinateSize;
|
||||
@@ -63,7 +63,7 @@ void VertexBuffer::addVertexAttribPointer(unsigned int index, unsigned int coord
|
||||
m_VertexAttribs.push_back(pointer);
|
||||
}
|
||||
|
||||
void VertexBuffer::bindVertexAttribs() const {
|
||||
void VertexBuffer::BindVertexAttribs() const {
|
||||
for (const VertexAttribPointer& pointer : m_VertexAttribs) {
|
||||
glEnableVertexAttribArray(pointer.m_Index);
|
||||
glVertexAttribPointer(pointer.m_Index, static_cast<GLint>(pointer.m_Size), GL_FLOAT, false, m_DataStride * sizeof(float), reinterpret_cast<void*>(pointer.m_Offset));
|
||||
|
||||
Reference in New Issue
Block a user