Merge pull request 'Geometry & GeometryFactory memory leaks' (#85) from geometry_mem_leaks into master
Reviewed-on: https://git.madvoxel.net/OpenVulkano/OpenVulkano/pulls/85 Reviewed-by: Georg Hagen <georg.hagen@madvoxel.com>
This commit is contained in:
@@ -75,12 +75,12 @@ namespace OpenVulkano
|
||||
m_uniBuffer.setId = 3;
|
||||
m_drawablesPool.resize(cntDrawables);
|
||||
m_nodesPool.resize(cntDrawables);
|
||||
m_geo.reserve(cntDrawables);
|
||||
m_geo.resize(cntDrawables);
|
||||
m_texturedMat.texture = &Texture::PLACEHOLDER;
|
||||
|
||||
for (uint32_t i = 0; i < cntDrawables; i++)
|
||||
{
|
||||
Geometry* geo = nullptr;
|
||||
Geometry* geo = &m_geo[i];
|
||||
m_nodesPool[i].Init();
|
||||
if (i < quadsCnt)
|
||||
{
|
||||
@@ -96,11 +96,10 @@ namespace OpenVulkano
|
||||
}
|
||||
else
|
||||
{
|
||||
geo = GeometryFactory::MakePyramid(1, 1, glm::vec4(0, 1, 0, 1));
|
||||
*geo = GeometryFactory::MakePyramid(1, 1, glm::vec4(0, 1, 0, 1));
|
||||
m_nodesPool[i].SetMatrix(Math::Utils::translate(glm::mat4x4(1.f), Vector3f(-5 + std::rand() % 5, -5 + std::rand() % 5, -std::rand() % 10)));
|
||||
m_drawablesPool[i].Init(&m_shader, geo, &m_mat, &m_uniBuffer);
|
||||
}
|
||||
m_geo.push_back(geo);
|
||||
m_scene.GetRoot()->AddChild(&m_nodesPool[i]);
|
||||
m_nodesPool[i].AddDrawable(&m_drawablesPool[i]);
|
||||
}
|
||||
@@ -125,10 +124,6 @@ namespace OpenVulkano
|
||||
|
||||
void Close() override
|
||||
{
|
||||
for (Geometry* g: m_geo)
|
||||
{
|
||||
delete g;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -145,7 +140,7 @@ namespace OpenVulkano
|
||||
std::vector<Node> m_nodesPool;
|
||||
Vector3f_SIMD m_position = { 0, 0, -10 };
|
||||
OpenVulkano::Scene::UI::SimpleUi m_ui;
|
||||
std::vector<Geometry*> m_geo;
|
||||
std::vector<Geometry> m_geo;
|
||||
std::shared_ptr<OpenVulkano::Scene::UI::PerformanceInfo> m_perfInfo;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user