From e718adb7b6f637269c537aced49e62bcfa192b84 Mon Sep 17 00:00:00 2001 From: Locria Cyber <74560659+locriacyber@users.noreply.github.com> Date: Tue, 31 Jan 2023 20:58:25 +0000 Subject: [PATCH 1/9] Fix make file --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cdc796ef..8ea0a9a0 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ endif ifeq (${OS},linux) - CXXFLAGS_EARLY += -DLINUX + CXXFLAGS_EARLY += -DLINUX -I /usr/include/SDL EXE_EXTENSION := LDFLAGS_GL := -lGL LDFLAGS_GLEW := -lGLEW From 4fa7da8d9efb60333cc04795177c4c9119eacfcb Mon Sep 17 00:00:00 2001 From: Locria Cyber <74560659+locriacyber@users.noreply.github.com> Date: Wed, 1 Feb 2023 12:28:39 +0000 Subject: [PATCH 2/9] Add generated files to .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 321b2a2a..ac863cd6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ .deps/ +/autohdr.h +/langen +/makeh +/language-data.cpp From d16317f55e283a1768a9d80a9541887f1a4d1b6f Mon Sep 17 00:00:00 2001 From: Locria Cyber <74560659+locriacyber@users.noreply.github.com> Date: Wed, 1 Feb 2023 12:28:49 +0000 Subject: [PATCH 3/9] Make it compile on Linux with gcc/clang --- config.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.cpp b/config.cpp index da003420..3163d8a2 100644 --- a/config.cpp +++ b/config.cpp @@ -2240,10 +2240,10 @@ EX void edit_levellines(char c) { }); } -EX geom3::eSpatialEmbedding shown_spatial_embedding() { +geom3::eSpatialEmbedding shown_spatial_embedding() { if(GDIM == 2) return geom3::seNone; return geom3::spatial_embedding; - } +} EX bool in_tpp() { return pmodel == mdDisk && pconf.camera_angle; } From 253f0deaa6cf78708edabc3a749945a9198a47f4 Mon Sep 17 00:00:00 2001 From: Locria Cyber <74560659+locriacyber@users.noreply.github.com> Date: Wed, 1 Feb 2023 12:34:08 +0000 Subject: [PATCH 4/9] Add more compiled files to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index ac863cd6..05a6d4a2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /langen /makeh /language-data.cpp +/*.o +/hyperrogue \ No newline at end of file From 99e3b25560291471b2ab99989572b09cf80c581f Mon Sep 17 00:00:00 2001 From: Locria Cyber <74560659+locriacyber@users.noreply.github.com> Date: Wed, 1 Feb 2023 12:53:09 +0000 Subject: [PATCH 5/9] Use printf %lld, not %Ld comply with ISO C++ --- rogueviz/dhrg/betweenness.cpp | 2 +- rogueviz/dhrg/embedder.cpp | 2 +- rogueviz/dhrg/tests.cpp | 2 +- rogueviz/sag.cpp | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rogueviz/dhrg/betweenness.cpp b/rogueviz/dhrg/betweenness.cpp index 251f7427..1a8641e7 100644 --- a/rogueviz/dhrg/betweenness.cpp +++ b/rogueviz/dhrg/betweenness.cpp @@ -342,7 +342,7 @@ void compute_betweenness(bool verify) { auto b = betweenness3(c1); // add_to_set(c1, 1, 0); auto b4 = betweenness4(c1); - print(hlog, format("B;%10Ld;%10Ld;%20.10Lf;%3d;%-40s", b.first, b.second, b4, vertices[i]->lev, rogueviz::vdata[i].name.c_str())); + print(hlog, format("B;%10lld;%10lld;%20.10Lf;%3d;%-40s", b.first, b.second, b4, vertices[i]->lev, rogueviz::vdata[i].name.c_str())); if(verify) { /* betweenness_type a = b.first; diff --git a/rogueviz/dhrg/embedder.cpp b/rogueviz/dhrg/embedder.cpp index 47b0b155..daf73aa4 100644 --- a/rogueviz/dhrg/embedder.cpp +++ b/rogueviz/dhrg/embedder.cpp @@ -191,7 +191,7 @@ void preparegraph() { current_logistic.setRT(factor * graph_R, factor * graph_T); saved_logistic = current_logistic; - // for(int u=0; uascell()->item = itDiamond; diff --git a/rogueviz/sag.cpp b/rogueviz/sag.cpp index bff1b5a9..309d2157 100644 --- a/rogueviz/sag.cpp +++ b/rogueviz/sag.cpp @@ -431,7 +431,7 @@ namespace sag { if(t2 - tl > 980) { tl = t2; - println(hlog, format("it %12Ld temp %6.4f [1/e at %13.6f] cost = %f ", + println(hlog, format("it %12lld temp %6.4f [1/e at %13.6f] cost = %f ", numiter, double(sag::temperature), (double) exp(sag::temperature), double(sag::cost))); } @@ -458,7 +458,7 @@ namespace sag { auto t2 = SDL_GetTicks(); if(t2 - t1 > 1000) { t1 = t2; - println(hlog, format("it %12Ld temp %6.4f [1/e at %13.6f] cost = %f ", + println(hlog, format("it %12lld temp %6.4f [1/e at %13.6f] cost = %f ", numiter, double(sag::temperature), (double) exp(sag::temperature), double(sag::cost))); } @@ -491,7 +491,7 @@ namespace sag { if(t < (sag_ittime+1) / 2) ipturn *= 2; else if(t > sag_ittime * 2) ipturn /= 2; else ipturn = ipturn * sag_ittime / t; - print(hlog, format("it %12Ld temp %6.4f [2:%8.6f,10:%8.6f,50:%8.6f] cost = %f\n", + print(hlog, format("it %12lld temp %6.4f [2:%8.6f,10:%8.6f,50:%8.6f] cost = %f\n", numiter, double(sag::temperature), (double) exp(-2 * exp(-sag::temperature)), (double) exp(-10 * exp(-sag::temperature)), From 5e8839f3a9f87a4f87b13dfe9975b67edd91d317 Mon Sep 17 00:00:00 2001 From: Locria Cyber <74560659+locriacyber@users.noreply.github.com> Date: Wed, 1 Feb 2023 13:00:30 +0000 Subject: [PATCH 6/9] Fix bugs and C++ compilance - use 'noexcept' for constexpr - allocate dynamic array - enable CAP_TEXTURE on CAP_ROGUEVIZ --- Makefile | 2 +- hyperpoint.cpp | 4 ++-- rogueviz/dhrg/loglik.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 8ea0a9a0..d4811d27 100644 --- a/Makefile +++ b/Makefile @@ -128,7 +128,7 @@ endif ifeq (${HYPERROGUE_USE_ROGUEVIZ},1) # Enable RogueViz. RogueViz requires C++17. CXXFLAGS_STD = -std=c++17 - CXXFLAGS_EARLY += -DCAP_ROGUEVIZ=1 + CXXFLAGS_EARLY += -DCAP_ROGUEVIZ=1 -DCAP_TEXTURE=1 endif diff --git a/hyperpoint.cpp b/hyperpoint.cpp index 9f2ab8fd..25610a05 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -21,8 +21,8 @@ namespace hr { static constexpr ld A_PI = M_PI; static constexpr ld TAU = 2 * A_PI; static constexpr ld degree = A_PI / 180; -static constexpr ld golden_phi = (sqrt(5)+1)/2; -static constexpr ld log_golden_phi = log(golden_phi); +static constexpr ld golden_phi = noexcept((sqrt(5)+1)/2); +static constexpr ld log_golden_phi = noexcept(log(golden_phi)); constexpr ld operator"" _deg(long double deg) { return deg * A_PI / 180; } #endif diff --git a/rogueviz/dhrg/loglik.cpp b/rogueviz/dhrg/loglik.cpp index 930f2d82..401e52fa 100644 --- a/rogueviz/dhrg/loglik.cpp +++ b/rogueviz/dhrg/loglik.cpp @@ -139,7 +139,7 @@ void cellcoords() { // needs cellcoords/rvcoords/origcoords void build_disttable() { indenter_finish im("build_disttable"); - int tab[N]; + std::vector tab(N); for(int i=0; i tab(N); for(int i=0; i Date: Wed, 1 Feb 2023 13:07:14 +0000 Subject: [PATCH 7/9] Use c++14 by default Needed for 'default value of lambda parameter' --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d4811d27..e6cfc114 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,7 @@ ifeq (${OS},osx) endif ifeq (${TOOLCHAIN},clang) - CXXFLAGS_STD = -std=c++11 + CXXFLAGS_STD = -std=c++14 CXXFLAGS_EARLY += -fPIC CXXFLAGS_EARLY += -W -Wall -Wextra -Wsuggest-override -pedantic CXXFLAGS_EARLY += -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -Wno-char-subscripts -Wno-unknown-warning-option @@ -88,7 +88,7 @@ ifeq (${TOOLCHAIN},clang) endif ifeq (${TOOLCHAIN},gcc) - CXXFLAGS_STD = -std=c++11 + CXXFLAGS_STD = -std=c++14 CXXFLAGS_EARLY += -fPIC CXXFLAGS_EARLY += -W -Wall -Wextra -pedantic CXXFLAGS_EARLY += -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized @@ -96,7 +96,7 @@ ifeq (${TOOLCHAIN},gcc) endif ifeq (${TOOLCHAIN},mingw) - CXXFLAGS_STD = -std=c++11 + CXXFLAGS_STD = -std=c++14 CXXFLAGS_EARLY += -W -Wall -Wextra CXXFLAGS_EARLY += -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized CXXFLAGS_EARLY += -Wno-invalid-offsetof @@ -169,7 +169,7 @@ mymake$(EXE_EXTENSION): mymake.cpp emscripten: hyper.html %.html %.js %.wasm: %.emscripten-sources - emcc -std=c++11 -O3 -s USE_ZLIB=1 -s LEGACY_GL_EMULATION=1 -s TOTAL_MEMORY=128MB hyperweb.cpp -o hyper.html + emcc -std=c++14 -O3 -s USE_ZLIB=1 -s LEGACY_GL_EMULATION=1 -s TOTAL_MEMORY=128MB hyperweb.cpp -o hyper.html hyper.emscripten-sources: *.cpp autohdr.h From 8d3173d1a43c8a3c7b46f6e16fa90f565312fcd5 Mon Sep 17 00:00:00 2001 From: Locria Cyber <74560659+iacore@users.noreply.github.com> Date: Thu, 24 Aug 2023 15:44:42 +0000 Subject: [PATCH 8/9] Remove wrong usage of `noexcept` I have no idea why I added this. --- hyperpoint.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hyperpoint.cpp b/hyperpoint.cpp index 25610a05..9f2ab8fd 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -21,8 +21,8 @@ namespace hr { static constexpr ld A_PI = M_PI; static constexpr ld TAU = 2 * A_PI; static constexpr ld degree = A_PI / 180; -static constexpr ld golden_phi = noexcept((sqrt(5)+1)/2); -static constexpr ld log_golden_phi = noexcept(log(golden_phi)); +static constexpr ld golden_phi = (sqrt(5)+1)/2; +static constexpr ld log_golden_phi = log(golden_phi); constexpr ld operator"" _deg(long double deg) { return deg * A_PI / 180; } #endif From 1dfe67de86ae0c9c917ae79ebaaabcf6b46c5bdd Mon Sep 17 00:00:00 2001 From: iacore Date: Thu, 3 Oct 2024 20:09:52 +0000 Subject: [PATCH 9/9] cleanup --- nonisotropic.cpp | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/nonisotropic.cpp b/nonisotropic.cpp index 9dd5dc97..99e21fd9 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -2281,25 +2281,30 @@ EX namespace rots { M[0][0] = +xx - yy - zz + ww; M[1][1] = -xx + yy - zz + ww; - M[2][2] = -xx - yy + zz + ww; - - M[0][1] = -2 * (xy + zw); - M[1][0] = -2 * (xy - zw); - - M[0][2] = 2 * (xz - yw); - M[2][0] = 2 * (xz + yw); - - M[1][2] = -2 * (yz + xw); - M[2][1] = -2 * (yz - xw); if(hyperbolic) { - swap(M[0][2], M[1][2]); - swap(M[2][0], M[2][1]); - M[1][2] *= -1; - M[2][0] *= -1; M[2][2] = xx + yy + zz + ww; - return M; - } + + M[0][1] = -2 * (xy + zw); + M[1][0] = -2 * (xy - zw); + + M[0][2] = -2 * (yz + xw); + M[2][0] = 2 * (yz - xw); + + M[1][2] = -2 * (xz - yw); + M[2][1] = 2 * (xz + yw); + } else { + M[2][2] = -xx - yy + zz + ww; + + M[0][1] = -2 * (xy + zw); + M[1][0] = -2 * (xy - zw); + + M[0][2] = 2 * (xz - yw); + M[2][0] = 2 * (xz + yw); + + M[1][2] = -2 * (yz + xw); + M[2][1] = -2 * (yz - xw); + } return M;