#pragma once #include #include #include #include namespace gb { class Object { private: using mesh_list_t = std::vector; public: explicit Object( const mesh_list_t& meshes, const glm::vec3& pos = {0.f, 0.f, 0.f}, const glm::vec3& scale = {1.f, 1.f, 1.f}, const glm::vec3& rotate_axis = {0.f, 0.f, 1.f}, float rotate_angle = 0.f ); explicit Object( mesh_list_t&& meshes, const glm::vec3& pos = {0.f, 0.f, 0.f}, const glm::vec3& scale = {1.f, 1.f, 1.f}, const glm::vec3& rotate_axis = {0.f, 0.f, 1.f}, float rotate_angle = 0.f ); template void draw(Framebuffer& fb, const Camera& camera) const { for (const auto& mesh : m_meshes) { auto c_mesh = mesh.apply(camera.view_mat() * m_model_mat); draw_mesh(fb, c_mesh); } } private: void calc_model_mat(void); private: mesh_list_t m_meshes; glm::vec3 m_pos; float m_rotate_angle; glm::vec3 m_rotate_axis; glm::vec3 m_scale; glm::mat4 m_model_mat; }; } // namespace gb