mirror of
https://github.com/minetest/minetest.git
synced 2024-12-22 06:02:23 +01:00
Use irr_ptr for MapBlockMesh::m_mesh
This commit is contained in:
parent
2b2f2dee20
commit
9827f9df1b
@ -615,7 +615,7 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
|
||||
ZoneScoped;
|
||||
|
||||
for (auto &m : m_mesh)
|
||||
m = new scene::SMesh();
|
||||
m = make_irr<scene::SMesh>();
|
||||
m_enable_shaders = data->m_use_shaders;
|
||||
|
||||
auto mesh_grid = client->getMeshGrid();
|
||||
@ -663,7 +663,7 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
|
||||
m_bounding_radius = std::sqrt(collector.m_bounding_radius_sq);
|
||||
|
||||
for (int layer = 0; layer < MAX_TILE_LAYERS; layer++) {
|
||||
scene::SMesh *mesh = (scene::SMesh *)m_mesh[layer];
|
||||
scene::SMesh *mesh = static_cast<scene::SMesh *>(m_mesh[layer].get());
|
||||
|
||||
for(u32 i = 0; i < collector.prebuffers[layer].size(); i++)
|
||||
{
|
||||
@ -793,10 +793,10 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
|
||||
MapBlockMesh::~MapBlockMesh()
|
||||
{
|
||||
size_t sz = 0;
|
||||
for (scene::IMesh *m : m_mesh) {
|
||||
for (auto &&m : m_mesh) {
|
||||
for (u32 i = 0; i < m->getMeshBufferCount(); i++)
|
||||
sz += m->getMeshBuffer(i)->getSize();
|
||||
m->drop();
|
||||
m.reset();
|
||||
}
|
||||
for (MinimapMapblock *block : m_minimap_mapblocks)
|
||||
delete block;
|
||||
@ -865,7 +865,7 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack,
|
||||
get_sunlight_color(&day_color, daynight_ratio);
|
||||
|
||||
for (auto &daynight_diff : m_daynight_diffs) {
|
||||
auto *mesh = m_mesh[daynight_diff.first.first];
|
||||
auto *mesh = m_mesh[daynight_diff.first.first].get();
|
||||
mesh->setDirty(scene::EBT_VERTEX); // force reload to VBO
|
||||
scene::IMeshBuffer *buf = mesh->
|
||||
getMeshBuffer(daynight_diff.first.second);
|
||||
|
@ -193,12 +193,12 @@ public:
|
||||
|
||||
scene::IMesh *getMesh()
|
||||
{
|
||||
return m_mesh[0];
|
||||
return m_mesh[0].get();
|
||||
}
|
||||
|
||||
scene::IMesh *getMesh(u8 layer)
|
||||
{
|
||||
return m_mesh[layer];
|
||||
return m_mesh[layer].get();
|
||||
}
|
||||
|
||||
std::vector<MinimapMapblock*> moveMinimapMapblocks()
|
||||
@ -242,7 +242,7 @@ private:
|
||||
TileLayer tile;
|
||||
};
|
||||
|
||||
scene::IMesh *m_mesh[MAX_TILE_LAYERS];
|
||||
irr_ptr<scene::IMesh> m_mesh[MAX_TILE_LAYERS];
|
||||
std::vector<MinimapMapblock*> m_minimap_mapblocks;
|
||||
ITextureSource *m_tsrc;
|
||||
IShaderSource *m_shdrsrc;
|
||||
|
Loading…
Reference in New Issue
Block a user