Skip to content

Commit a10e6e1

Browse files
authored
Merge branch 'master' into develop
2 parents 146f08c + 907bca1 commit a10e6e1

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

Engine/world/GameObject.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
7996
Mesh& GameObject::getMesh(const size_t& index)
8097
{
8198
return m_meshes[index];

Engine/world/Mesh.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
137147
std::vector<Vertex>& Mesh::get_vertices()
138148
{
139149
return m_vertices;

Engine/world/Mesh.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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();

0 commit comments

Comments
 (0)