refactor: change gl functions name
This commit is contained in:
@@ -22,7 +22,7 @@ public:
|
||||
static constexpr float m_AnimationSpeed = 2.0f;
|
||||
|
||||
struct Model {
|
||||
GL::VAO* vao;
|
||||
GL::VertexArray* vao;
|
||||
glm::vec2 positon;
|
||||
};
|
||||
private:
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
void prepare();
|
||||
void resize(const int width, const int height);
|
||||
|
||||
void renderVAO(const GL::VAO& vao);
|
||||
void renderVAO(const GL::VertexArray& vao);
|
||||
void renderModel(const Model& model);
|
||||
|
||||
void setZoom(float zoom);
|
||||
|
||||
@@ -21,44 +21,44 @@ struct VertexAttribPointer{
|
||||
int m_Offset;
|
||||
};
|
||||
|
||||
class VBO{
|
||||
class VertexBuffer{
|
||||
private:
|
||||
unsigned int m_ID, m_DataStride;
|
||||
std::vector<VertexAttribPointer> m_VertexAttribs;
|
||||
public:
|
||||
REMOVE_COPY(VBO);
|
||||
VBO(VBO&& other){
|
||||
REMOVE_COPY(VertexBuffer);
|
||||
VertexBuffer(VertexBuffer&& other){
|
||||
m_VertexAttribs = std::move(other.m_VertexAttribs);
|
||||
m_ID = other.m_ID;
|
||||
m_DataStride = other.m_DataStride;
|
||||
other.m_ID = 0;
|
||||
other.m_DataStride = 0;
|
||||
}
|
||||
VBO(const std::vector<float>& data, unsigned int stride);
|
||||
~VBO();
|
||||
VertexBuffer(const std::vector<float>& data, unsigned int stride);
|
||||
~VertexBuffer();
|
||||
void bind() const;
|
||||
void unbind() const;
|
||||
void addVertexAttribPointer(unsigned int index, unsigned int coordinateSize, unsigned int offset);
|
||||
void bindVertexAttribs() const;
|
||||
};
|
||||
|
||||
class VAO{
|
||||
class VertexArray{
|
||||
private:
|
||||
unsigned int m_ID, m_VertexCount;
|
||||
std::vector<VBO> m_Vbos; //use to destroy vbos when become unused
|
||||
std::vector<VertexBuffer> m_VertexBuffers; //use to destroy vbos when become unused
|
||||
public:
|
||||
REMOVE_COPY(VAO);
|
||||
VAO(VAO&& other){
|
||||
REMOVE_COPY(VertexArray);
|
||||
VertexArray(VertexArray&& other){
|
||||
m_ID = other.m_ID;
|
||||
m_VertexCount = other.m_VertexCount;
|
||||
m_Vbos = std::move(other.m_Vbos);
|
||||
m_VertexBuffers = std::move(other.m_VertexBuffers);
|
||||
other.m_VertexCount = 0;
|
||||
other.m_ID = 0;
|
||||
}
|
||||
VAO(unsigned int vertexCount);
|
||||
~VAO();
|
||||
VertexArray(unsigned int vertexCount);
|
||||
~VertexArray();
|
||||
unsigned int getVertexCount() const {return m_VertexCount;}
|
||||
void bindVBO(VBO& vbo);
|
||||
void bindVertexBuffer(VertexBuffer& vbo);
|
||||
void bind() const;
|
||||
void unbind() const;
|
||||
};
|
||||
|
||||
@@ -8,9 +8,9 @@ namespace render {
|
||||
|
||||
namespace WorldLoader {
|
||||
|
||||
GL::VAO loadMobModel();
|
||||
GL::VAO loadWorldModel(const td::game::World* world);
|
||||
GL::VAO loadTileSelectModel();
|
||||
GL::VertexArray loadMobModel();
|
||||
GL::VertexArray loadWorldModel(const td::game::World* world);
|
||||
GL::VertexArray loadTileSelectModel();
|
||||
|
||||
} // namespace WorldLoader
|
||||
|
||||
|
||||
Reference in New Issue
Block a user