aboutsummaryrefslogtreecommitdiff
path: root/assets/img_large/tcbex2.png
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-12-18 10:01:47 +0100
committerorwell96 <orwell@bleipb.de>2019-12-18 10:01:47 +0100
commit50a81dd1f312cf427944812f0e599b54e11b1a61 (patch)
treec4484ea360674bd0f31f9f473bc426b446f18181 /assets/img_large/tcbex2.png
parentd123679b3c6e44a002ea2fb9e32daa1aa1b0663d (diff)
downloadadvtrains-50a81dd1f312cf427944812f0e599b54e11b1a61.tar.gz
advtrains-50a81dd1f312cf427944812f0e599b54e11b1a61.tar.bz2
advtrains-50a81dd1f312cf427944812f0e599b54e11b1a61.zip
Fix RWT initialization when creating new world (H#142)
Diffstat (limited to 'assets/img_large/tcbex2.png')
0 files changed, 0 insertions, 0 deletions
/span> 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.push_back(v3s16(0,0,0)); return c; } if (d == 1) { // This is an optimized sequence of coordinates. c.push_back(v3s16( 0, 1, 0)); // Top c.push_back(v3s16( 0, 0, 1)); // Back c.push_back(v3s16(-1, 0, 0)); // Left c.push_back(v3s16( 1, 0, 0)); // Right c.push_back(v3s16( 0, 0,-1)); // Front c.push_back(v3s16( 0,-1, 0)); // Bottom // 6 c.push_back(v3s16(-1, 0, 1)); // Back left c.push_back(v3s16( 1, 0, 1)); // Back right c.push_back(v3s16(-1, 0,-1)); // Front left c.push_back(v3s16( 1, 0,-1)); // Front right