aboutsummaryrefslogtreecommitdiff
path: root/src/json/CMakeLists.txt
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-11-10 19:37:45 +0100
committersapier <Sapier at GMX dot net>2013-11-10 19:37:45 +0100
commit0f9440fa61fbfd95b0c06217d08b07c81c897ee0 (patch)
tree2e1845fe07af64c1b6f4b6b533ccdb50a8b399ec /src/json/CMakeLists.txt
parentd75b1718f8768cca1390c463215e65c4ec9ef6c4 (diff)
downloadminetest-0f9440fa61fbfd95b0c06217d08b07c81c897ee0.tar.gz
minetest-0f9440fa61fbfd95b0c06217d08b07c81c897ee0.tar.bz2
minetest-0f9440fa61fbfd95b0c06217d08b07c81c897ee0.zip
Fix "TODO read modinfo" in modmanager to improve ui usability
Diffstat (limited to 'src/json/CMakeLists.txt')
0 files changed, 0 insertions, 0 deletions
">it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "face_position_cache.h" #include "threading/mutex_auto_lock.h" std::unordered_map<u16, std::vector<v3s16>> FacePositionCache::cache; std::mutex FacePositionCache::cache_mutex; // Calculate the borders of a "d-radius" cube const std::vector<v3s16> &FacePositionCache::getFacePositions(u16 d) { MutexAutoLock lock(cache_mutex); std::unordered_map<u16, std::vector<v3s16>>::const_iterator it = cache.find(d); if (it != cache.end()) return it->second; return generateFacePosition(d); } const std::vector<v3s16> &FacePositionCache::generateFacePosition(u16 d) { cache[d] = std::vector<v3s16>(); std::vector<v3s16> &c = cache[d]; if (d == 0) { c.emplace_back(0,0,0); return c; } if (d == 1) { // This is an optimized sequence of coordinates. c.emplace_back(0, 1, 0); // Top c.emplace_back(0, 0, 1); // Back c.emplace_back(-1, 0, 0); // Left c.emplace_back(1, 0, 0); // Right c.emplace_back(0, 0,-1); // Front c.emplace_back(0,-1, 0); // Bottom // 6 c.emplace_back(-1, 0, 1); // Back left c.emplace_back(1, 0, 1); // Back right c.emplace_back(-1, 0,-1); // Front left c.emplace_back(1, 0,-1); // Front right