diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-07-26 20:12:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-26 20:12:48 +0200 |
commit | 3e50850260db13ec63ce4ca0e47e7fd7e30ce484 (patch) | |
tree | eb07ce2418ad29152db2378dd9e75fb873cdafd4 /src/wieldmesh.cpp | |
parent | 9a17b65f26eea5b9d7176e7df205f72ed2ff6c0f (diff) | |
download | minetest-3e50850260db13ec63ce4ca0e47e7fd7e30ce484.tar.gz minetest-3e50850260db13ec63ce4ca0e47e7fd7e30ce484.tar.bz2 minetest-3e50850260db13ec63ce4ca0e47e7fd7e30ce484.zip |
TileLayer: use shared_ptr for FrameSpec vector (#6171)
* TileLayer: use shared_ptr for vector framespec
This reduce memory copy of TileLayer from (4 to 16) * FrameSpec where FrameSpec = (sizeof(int) + 3 * sizeof(ptr)) to int + sizeof(ptr)
Callgrind difference
Before: https://lut.im/RGkiJqQb8T/LeQIEXpAuRzfl7gd.png
After: https://lut.im/bcqmwee1xu/cTwtptY5tRuS9lp0.png
* Fix one push_back to use vector::emplace_back & optimize inclusions
Diffstat (limited to 'src/wieldmesh.cpp')
-rw-r--r-- | src/wieldmesh.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wieldmesh.cpp b/src/wieldmesh.cpp index e0d6b7e0d..c532a048c 100644 --- a/src/wieldmesh.cpp +++ b/src/wieldmesh.cpp @@ -593,7 +593,7 @@ void postProcessNodeMesh(scene::SMesh *mesh, const ContentFeatures &f, material.MaterialType = *mattype; } if (layer->animation_frame_count > 1) { - FrameSpec animation_frame = layer->frames[0]; + const FrameSpec &animation_frame = (*layer->frames)[0]; material.setTexture(0, animation_frame.texture); } else { material.setTexture(0, layer->texture); @@ -601,7 +601,7 @@ void postProcessNodeMesh(scene::SMesh *mesh, const ContentFeatures &f, if (use_shaders) { if (layer->normal_texture) { if (layer->animation_frame_count > 1) { - FrameSpec animation_frame = layer->frames[0]; + const FrameSpec &animation_frame = (*layer->frames)[0]; material.setTexture(1, animation_frame.normal_texture); } else material.setTexture(1, layer->normal_texture); |