File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,6 +76,23 @@ std::vector<uint32_t> GameObject::GetIndices(const size_t& index)
7676 return m_meshes[index].get_indices ();
7777}
7878
79+ void GameObject::UpdateMesh (const size_t & index, const std::vector<Vertex>& vertices, const std::vector<uint32_t >& indices)
80+ {
81+ m_meshes[index].SetVertices (vertices);
82+ m_meshes[index].SetIndices (indices);
83+ m_meshes[index].createBuffer (mp_renderer);
84+ }
85+
86+ std::vector<Vertex> GameObject::GetVertices (const size_t & index)
87+ {
88+ return m_meshes[index].get_vertices ();
89+ }
90+
91+ std::vector<uint32_t > GameObject::GetIndices (const size_t & index)
92+ {
93+ return m_meshes[index].get_indices ();
94+ }
95+
7996Mesh& GameObject::getMesh (const size_t & index)
8097{
8198 return m_meshes[index];
Original file line number Diff line number Diff line change @@ -134,6 +134,16 @@ void Mesh::SetIndices(const std::vector<uint32_t>& indices)
134134 m_indices = indices;
135135}
136136
137+ void Mesh::SetVertices (const std::vector<Vertex>& vertices)
138+ {
139+ m_vertices = vertices;
140+ }
141+
142+ void Mesh::SetIndices (const std::vector<uint32_t >& indices)
143+ {
144+ m_indices = indices;
145+ }
146+
137147std::vector<Vertex>& Mesh::get_vertices ()
138148{
139149 return m_vertices;
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ class Mesh
3232 void SetVertices (const std::vector<Vertex>& vertices);
3333 void SetIndices (const std::vector<uint32_t >& indices);
3434
35+ void SetVertices (const std::vector<Vertex>& vertices);
36+ void SetIndices (const std::vector<uint32_t >& indices);
37+
3538 std::vector<Vertex>& get_vertices ();
3639 std::vector<uint32_t >& get_indices ();
3740 Buffer& getBuffer ();
You can’t perform that action at this time.
0 commit comments