Όπου η Mesh_impl κλάση, εχει την μορφή:
class Mesh_impl {
public:
Mesh_impl(std::vector<vertex> const & vertices_data, std::vector<GLuint> & indices);
Mesh_impl(Mesh_impl const &);
Mesh_impl& operator=(Mesh_impl const &);
~Mesh_impl() = default;
void draw() const;
void bind() const;
void unbind() const;
std::vector< glm::vec3 > get_vertices();
std::vector< glm::vec3 > get_colors();
std::vector< glm::vec2 > get_tex_coords();
void set_tex_coords(const std::vector<glm::vec2>& tex_coords);
private:
std::unique_ptr< ge::Vertex_array > m_VAO;
std::unique_ptr< ge::Vertex_buffer > m_VBO;
std::unique_ptr< ge::Vertex_buffer > m_VBO2;
std::unique_ptr< ge::Vertex_buffer > m_VBO3;
std::unique_ptr< ge::Index_buffer > m_IBO;
std::vector< GLfloat > m_vertices;
std::vector< GLfloat > m_vertex_colors;
std::vector< GLfloat > m_tex_coords;
};
4.5.2
Αρχική προσέγγιση: Ιεραρχία Κλάσεων
Στην αρχική δομή, η μηχανή περιλάμβανε:
• Κλάση Entity (βάση)
• Κλάση GameObject (2D/3D αντικείμενα με mesh)
• Κλάση Sprite (2D αντικείμενα με texture και animation)
Κάθε οντότητα υλοποιούσε μεθόδους:
32