Merge branch 'main' into release-0.27

This commit is contained in:
MihailRis 2025-03-20 23:11:31 +03:00
commit 09aee223a0
61 changed files with 306 additions and 319 deletions

View File

@ -17,12 +17,7 @@ jobs:
- name: Install dependencies from brew - name: Install dependencies from brew
run: | run: |
brew install glfw3 glew libpng openal-soft luajit libvorbis skypjack/entt/entt googletest brew install glfw3 glew libpng openal-soft luajit libvorbis skypjack/entt/entt googletest glm
- name: Install specific version of GLM
run: |
curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/5c7655a866646aa4b857c002b8ae5465b9d26f65/Formula/g/glm.rb
brew install --formula glm.rb
- name: Configure - name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_TESTS=ON -DVOXELENGINE_BUILD_APPDIR=1 run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_TESTS=ON -DVOXELENGINE_BUILD_APPDIR=1

View File

@ -28,9 +28,7 @@ jobs:
msystem: clang64 msystem: clang64
install: >- install: >-
mingw-w64-clang-x86_64-toolchain mingw-w64-clang-x86_64-toolchain
mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-cmake
mingw-w64-clang-x86_64-make
mingw-w64-clang-x86_64-luajit
git git
- name: Set up vcpkg - name: Set up vcpkg
shell: msys2 {0} shell: msys2 {0}
@ -41,11 +39,12 @@ jobs:
./vcpkg integrate install ./vcpkg integrate install
cd .. cd ..
- name: Configure project with CMake and vcpkg - name: Configure project with CMake and vcpkg
env:
VCPKG_DEFAULT_TRIPLET: x64-mingw-static
VCPKG_DEFAULT_HOST_TRIPLET: x64-mingw-static
shell: msys2 {0} shell: msys2 {0}
run: | run: |
export VCPKG_DEFAULT_TRIPLET=x64-mingw-static export VCPKG_ROOT=$(pwd)/vcpkg
export VCPKG_DEFAULT_HOST_TRIPLET=x64-mingw-static
export VCPKG_ROOT=./vcpkg
mkdir build mkdir build
cd build cd build
cmake -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake .. cmake -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake ..

View File

@ -1,84 +1,47 @@
cmake_minimum_required(VERSION 3.26) cmake_minimum_required(VERSION 3.26)
project(VoxelEngine) project(VoxelEngine)
option(VOXELENGINE_BUILD_APPDIR "" OFF)
option(VOXELENGINE_BUILD_TESTS "" OFF)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
execute_process(COMMAND ${CMAKE_COMMAND} --version)
option(VOXELENGINE_BUILD_APPDIR "Pack linux build" OFF)
option(VOXELENGINE_BUILD_TESTS "Build tests" OFF)
# Need for static compilation on Windows with MSVC clang TODO: Make single build
# on Windows to avoid dependence on combinations of platforms and compilers and
# make it independent
if(CMAKE_SYSTEM_NAME STREQUAL "Windows") if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# We use two types linking: for clang build is static (vcpkg triplet # We use two types linking: for clang build is static (vcpkg triplet
# x64-windows-static) and for msvc build is dynamic linking (vcpkg triplet # x64-windows-static) and for msvc build is dynamic linking (vcpkg triplet
# x64-windows) By default CMAKE_MSVC_RUNTIME_LIBRARY set by # x64-windows) By default CMAKE_MSVC_RUNTIME_LIBRARY set by
# MultiThreaded$<$<CONFIG:Debug>:Debug>DLL # MultiThreaded$<$<CONFIG:Debug>:Debug>DLL
if(VCPKG_TARGET_TRIPLET MATCHES "static") if(VCPKG_TARGET_TRIPLET MATCHES "static")
# Need for MSVC clang
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif() endif()
endif() endif()
add_subdirectory(src) add_subdirectory(src)
add_executable(${PROJECT_NAME} src/main.cpp) add_executable(VoxelEngine src/main.cpp)
target_include_directories(${PROJECT_NAME}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
if(VOXELENGINE_BUILD_APPDIR) if(VOXELENGINE_BUILD_APPDIR)
include(${CMAKE_CURRENT_SOURCE_DIR}/dev/cmake/BuildAppdir.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/dev/cmake/BuildAppdir.cmake)
endif() endif()
if(MSVC) target_link_libraries(VoxelEngine PRIVATE VoxelEngineSrc
if(NOT CMAKE_BUILD_TYPE) $<$<PLATFORM_ID:Windows>:winmm>)
set(CMAKE_BUILD_TYPE
Release
CACHE STRING "Build type" FORCE)
endif()
if((CMAKE_BUILD_TYPE EQUAL "Release") OR (CMAKE_BUILD_TYPE EQUAL
"RelWithDebInfo"))
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /MT /O2)
else()
target_compile_options(${PROJECT_NAME} PRIVATE /W4)
endif()
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} /source-charset:UTF-8 /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR"
)
else()
target_compile_options(
${PROJECT_NAME}
PRIVATE -Wall
-Wextra
# additional warnings
-Wformat-nonliteral
-Wcast-align
-Wpointer-arith
-Wundef
-Wwrite-strings
-Wno-unused-parameter)
if(CMAKE_BUILD_TYPE MATCHES "Debug")
target_compile_options(${PROJECT_NAME} PRIVATE -Og)
endif()
if(WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
endif()
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_link_options(VoxelEngine PRIVATE $<$<CXX_COMPILER_ID:GNU>:-no-pie>)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
endif()
if(WIN32)
target_link_libraries(${PROJECT_NAME} VoxelEngineSrc winmm)
endif()
target_link_libraries(${PROJECT_NAME} VoxelEngineSrc ${CMAKE_DL_LIBS})
# Deploy res to build dir # Deploy res to build dir
add_custom_command( add_custom_command(
TARGET ${PROJECT_NAME} TARGET VoxelEngine
POST_BUILD POST_BUILD
COMMAND COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different
${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/res $<TARGET_FILE_DIR:VoxelEngine>/res)
${CMAKE_CURRENT_SOURCE_DIR}/res $<TARGET_FILE_DIR:${PROJECT_NAME}>/res)
if(VOXELENGINE_BUILD_TESTS) if(VOXELENGINE_BUILD_TESTS)
enable_testing() enable_testing()

View File

@ -14,6 +14,34 @@
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"VOXELENGINE_BUILD_TESTS": "ON" "VOXELENGINE_BUILD_TESTS": "ON"
} }
},
{
"name": "default-ninja-gnu-linux",
"condition": {
"type": "equals",
"rhs": "${hostSystemName}",
"lhs": "Linux"
},
"generator": "Ninja Multi-Config",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"VOXELENGINE_BUILD_TESTS": "ON",
"VOXELENGINE_BUILD_APPDIR": "ON"
}
},
{
"name": "default-ninja-clang-macos",
"condition": {
"type": "equals",
"rhs": "${hostSystemName}",
"lhs": "Darwin"
},
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"VOXELENGINE_BUILD_TESTS": "ON",
"VOXELENGINE_BUILD_APPDIR": "ON"
}
} }
], ],
"buildPresets": [ "buildPresets": [
@ -21,6 +49,16 @@
"name": "default-vs-msvc-windows", "name": "default-vs-msvc-windows",
"configurePreset": "default-vs-msvc-windows", "configurePreset": "default-vs-msvc-windows",
"configuration": "Debug" "configuration": "Debug"
},
{
"name": "default-ninja-gnu-linux",
"configurePreset": "default-ninja-gnu-linux",
"configuration": "Debug"
},
{
"name": "default-ninja-clang-macos",
"configurePreset": "default-ninja-clang-macos",
"configuration": "Debug"
} }
], ],
"testPresets": [ "testPresets": [
@ -30,6 +68,20 @@
"output": { "output": {
"outputOnFailure": true "outputOnFailure": true
} }
},
{
"name": "default-ninja-gnu-linux",
"configurePreset": "default-ninja-gnu-linux",
"output": {
"outputOnFailure": true
}
},
{
"name": "default-ninja-clang-macos",
"configurePreset": "default-ninja-clang-macos",
"output": {
"outputOnFailure": true
}
} }
] ]
} }

View File

@ -1,87 +1,123 @@
project(VoxelEngineSrc) project(VoxelEngineSrc)
set(CMAKE_CXX_STANDARD 17) file(GLOB_RECURSE headers ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
file(GLOB_RECURSE sources ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)
file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) add_library(VoxelEngineSrc STATIC ${sources} ${headers})
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
list(REMOVE_ITEM SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)
add_library(${PROJECT_NAME} STATIC ${SOURCES} ${HEADERS})
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED) find_package(GLEW REQUIRED)
find_package(glm REQUIRED)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows") if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# specific for vcpkg # specific for vcpkg
find_package(OpenAL CONFIG REQUIRED) find_package(OpenAL CONFIG REQUIRED)
set(OPENAL_LIBRARY OpenAL::OpenAL)
else() else()
find_package(OpenAL REQUIRED) find_package(OpenAL REQUIRED)
endif() endif()
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED) find_package(PNG REQUIRED)
find_package(CURL REQUIRED) find_package(CURL REQUIRED)
find_package(glfw3 REQUIRED)
if(NOT APPLE) if(NOT APPLE)
find_package(EnTT REQUIRED) find_package(EnTT REQUIRED)
endif() endif()
set(LIBS "")
if(CMAKE_SYSTEM_NAME STREQUAL "Windows") if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# Use directly linking to lib instead PkgConfig (because pkg-config dont
# install on windows as default) TODO: Do it with findLua.
if(MSVC)
set(LUA_INCLUDE_DIR
"$ENV{VCPKG_ROOT}/packages/luajit_${VCPKG_TARGET_TRIPLET}/include/luajit"
)
find_package(Lua REQUIRED)
else()
# Used for mingw-clang cross compiling from msys2
set(LIBS ${LIBS} luajit-5.1)
endif()
find_package(glfw3 REQUIRED)
find_package(glm REQUIRED)
find_package(vorbis REQUIRED) find_package(vorbis REQUIRED)
set(VORBISLIB Vorbis::vorbis Vorbis::vorbisfile) if(VCPKG_TARGET_TRIPLET MATCHES "static")
add_library(luajit STATIC IMPORTED)
set_target_properties(
luajit
PROPERTIES
IMPORTED_LOCATION
"$ENV{VCPKG_ROOT}/packages/luajit_${VCPKG_TARGET_TRIPLET}/lib/libluajit-5.1.a"
INTERFACE_INCLUDE_DIRECTORIES
"$ENV{VCPKG_ROOT}/packages/luajit_${VCPKG_TARGET_TRIPLET}/include/"
)
else()
add_library(luajit SHARED IMPORTED)
set_target_properties(
luajit
PROPERTIES
IMPORTED_LOCATION
"$ENV{VCPKG_ROOT}/packages/luajit_${VCPKG_TARGET_TRIPLET}/bin/lua51.dll"
IMPORTED_IMPLIB
"$ENV{VCPKG_ROOT}/packages/luajit_${VCPKG_TARGET_TRIPLET}/lib/lua51.lib"
INTERFACE_INCLUDE_DIRECTORIES
"$ENV{VCPKG_ROOT}/packages/luajit_${VCPKG_TARGET_TRIPLET}/include/luajit"
)
endif()
elseif(APPLE) add_library(luajit::luajit ALIAS luajit)
find_package(PkgConfig)
pkg_check_modules(LUAJIT REQUIRED luajit)
pkg_check_modules(VORBIS REQUIRED vorbis vorbisfile)
set(LUA_INCLUDE_DIR "/opt/homebrew/include/luajit-2.1")
set(LUA_LIBRARIES "/opt/homebrew/lib/libluajit-5.1.a")
message(STATUS "LUA Libraries: ${LUA_LIBRARIES}")
message(STATUS "LUA Include Dir: ${LUA_INCLUDE_DIR}")
set(VORBISLIB ${VORBIS_LDFLAGS})
message(STATUS "Vorbis Lib: ${VORBIS_LDFLAGS}")
else() else()
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(LUAJIT REQUIRED luajit)
pkg_check_modules(VORBIS REQUIRED vorbis vorbisfile) pkg_check_modules(luajit REQUIRED IMPORTED_TARGET luajit)
set(LUA_LIBRARIES ${LUAJIT_LIBRARIES}) pkg_check_modules(vorbis REQUIRED IMPORTED_TARGET vorbis)
set(LUA_INCLUDE_DIR ${LUAJIT_INCLUDE_DIRS}) pkg_check_modules(vorbisfile REQUIRED IMPORTED_TARGET vorbisfile)
set(VORBISLIB ${VORBIS_LDFLAGS}) add_library(Vorbis::vorbis ALIAS PkgConfig::vorbis)
add_library(Vorbis::vorbisfile ALIAS PkgConfig::vorbisfile)
add_library(luajit::luajit ALIAS PkgConfig::luajit)
endif() endif()
if(UNIX) target_include_directories(VoxelEngineSrc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
find_package(glfw3 3.3 REQUIRED)
find_package(Threads REQUIRED)
set(LIBS ${LIBS} Threads::Threads)
endif()
include_directories(${LUA_INCLUDE_DIR})
include_directories(${CURL_INCLUDE_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries( target_link_libraries(
${PROJECT_NAME} VoxelEngineSrc
${LIBS} PRIVATE glfw
glfw OpenGL::GL
OpenGL::GL GLEW::GLEW
${OPENAL_LIBRARY} ZLIB::ZLIB
GLEW::GLEW PNG::PNG
ZLIB::ZLIB CURL::libcurl
PNG::PNG OpenAL::OpenAL
CURL::libcurl Vorbis::vorbis
${VORBISLIB} Vorbis::vorbisfile
${LUA_LIBRARIES} luajit::luajit
${CMAKE_DL_LIBS}) PUBLIC glm::glm # Need public for src/delegates.hpp, which including to
# main.cpp
)
target_compile_options(
VoxelEngineSrc
PUBLIC $<$<CXX_COMPILER_ID:MSVC>:
/utf-8
/MP
/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR
/W4
/wd4244 # conversion from 'a' to 'T', possible loss of data
/wd4267 # conversion from 'size_t' to 'int', possible loss of data
/wd4245 # conversion from 'int' to 'const size_t', signed/unsigned
# mismatch
/wd4100 # unreferenced formal parameter
/wd4458 # declaration of 'var' hides class member
/wd4101 # 'var': unreferenced local variable
/wd4388 # 'token' : signed/unsigned mismatch
/wd4018 # '>': signed/unsigned mismatch
>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:
-Wall
-Wextra
# additional warnings
-Wformat-nonliteral
-Wcast-align
-Wpointer-arith
-Wundef
-Wwrite-strings
-Wno-unused-parameter
-Wno-sign-compare
-Wno-unknown-pragmas
$<$<CONFIG:Debug>:-Og>
>)
target_link_options(
VoxelEngineSrc
PUBLIC
$<$<CXX_COMPILER_ID:GNU>:
-no-pie
>
# Need for static compilation on Windows with clang TODO: Make single build
# on Windows to avoid dependence on combinations of platforms and compilers
# and make it independent
$<$<PLATFORM_ID:Windows>:$<$<CXX_COMPILER_ID:Clang>:-static>>)

View File

@ -6,7 +6,7 @@
#include "util/stringutil.hpp" #include "util/stringutil.hpp"
namespace { namespace {
int is_box(int c) { inline int is_box(int c) {
switch (c) { switch (c) {
case 'B': case 'B':
case 'b': case 'b':
@ -21,7 +21,7 @@ namespace {
return 10; return 10;
} }
double power(double base, int64_t power) { inline double power(double base, int64_t power) {
double result = 1.0; double result = 1.0;
for (int64_t i = 0; i < power; i++) { for (int64_t i = 0; i < power; i++) {
result *= base; result *= base;

View File

@ -30,7 +30,6 @@ class TomlReader : BasicParser<char> {
// todo: extract common part // todo: extract common part
std::string parseMultilineString() { std::string parseMultilineString() {
pos += 2; pos += 2;
char next = peek();
std::stringstream ss; std::stringstream ss;
while (hasNext()) { while (hasNext()) {

View File

@ -68,7 +68,7 @@ static model::Mesh build_mesh(
const glm::vec2* uvs = nullptr; const glm::vec2* uvs = nullptr;
const glm::vec3* normals = nullptr; const glm::vec3* normals = nullptr;
int coordsIndex, uvsIndex, normalsIndex; int coordsIndex = 0, uvsIndex = 0, normalsIndex = 0;
for (int i = 0; i < attrs.size(); i++) { for (int i = 0; i < attrs.size(); i++) {
const auto& attr = attrs[i]; const auto& attr = attrs[i];
@ -204,7 +204,7 @@ File vec3::load(
// Header // Header
reader.checkMagic("\0\0VEC3\0\0", 8); reader.checkMagic("\0\0VEC3\0\0", 8);
int version = reader.getInt16(); int version = reader.getInt16();
int reserved = reader.getInt16(); [[maybe_unused]] int reserved = reader.getInt16();
if (version > VERSION) { if (version > VERSION) {
throw std::runtime_error("unsupported VEC3 version"); throw std::runtime_error("unsupported VEC3 version");
} }

View File

@ -41,13 +41,13 @@ static void process_blocks_data(
continue; continue;
} }
if (def->dataStruct == nullptr) { if (def->dataStruct == nullptr) {
ContentIssue issue {ContentIssueType::BLOCK_DATA_LAYOUTS_UPDATE}; ContentIssue issue {ContentIssueType::BLOCK_DATA_LAYOUTS_UPDATE, {}};
report.issues.push_back(issue); report.issues.push_back(issue);
report.dataLoss.push_back(name + ": discard data"); report.dataLoss.push_back(name + ": discard data");
continue; continue;
} }
if (layout != *def->dataStruct) { if (layout != *def->dataStruct) {
ContentIssue issue {ContentIssueType::BLOCK_DATA_LAYOUTS_UPDATE}; ContentIssue issue {ContentIssueType::BLOCK_DATA_LAYOUTS_UPDATE, {}};
report.issues.push_back(issue); report.issues.push_back(issue);
report.dataLayoutsUpdated = true; report.dataLayoutsUpdated = true;
} }
@ -111,10 +111,10 @@ static void build_issues(
) { ) {
auto type = report.getContentType(); auto type = report.getContentType();
if (report.hasContentReorder()) { if (report.hasContentReorder()) {
issues.push_back(ContentIssue {ContentIssueType::REORDER, type}); issues.push_back(ContentIssue {ContentIssueType::REORDER, {type}});
} }
if (report.hasMissingContent()) { if (report.hasMissingContent()) {
issues.push_back(ContentIssue {ContentIssueType::MISSING, type}); issues.push_back(ContentIssue {ContentIssueType::MISSING, {type}});
} }
} }
@ -126,7 +126,7 @@ void ContentReport::buildIssues() {
for (int layer = REGION_LAYER_VOXELS; for (int layer = REGION_LAYER_VOXELS;
layer < REGION_LAYERS_COUNT; layer < REGION_LAYERS_COUNT;
layer++) { layer++) {
ContentIssue issue {ContentIssueType::REGION_FORMAT_UPDATE}; ContentIssue issue {ContentIssueType::REGION_FORMAT_UPDATE, {}};
issue.regionLayer = static_cast<RegionLayerIndex>(layer); issue.regionLayer = static_cast<RegionLayerIndex>(layer);
issues.push_back(issue); issues.push_back(issue);
} }

View File

@ -7,6 +7,7 @@
#include "io/io.hpp" #include "io/io.hpp"
#include "io/engine_paths.hpp" #include "io/engine_paths.hpp"
#include "logic/scripting/scripting.hpp" #include "logic/scripting/scripting.hpp"
#include "util/stringutil.hpp"
#include "world/generator/GeneratorDef.hpp" #include "world/generator/GeneratorDef.hpp"
#include "world/generator/VoxelFragment.hpp" #include "world/generator/VoxelFragment.hpp"
#include "debug/Logger.hpp" #include "debug/Logger.hpp"

View File

@ -245,11 +245,11 @@ namespace data {
return totalSize; return totalSize;
} }
[[nodiscard]] const auto begin() const { [[nodiscard]] auto begin() const {
return fields.begin(); return fields.begin();
} }
[[nodiscard]] const auto end() const { [[nodiscard]] auto end() const {
return fields.end(); return fields.end();
} }

View File

@ -310,7 +310,6 @@ void Hud::updateWorldGenDebug() {
} }
void Hud::update(bool visible) { void Hud::update(bool visible) {
const auto& level = frontend.getLevel();
const auto& chunks = *player.chunks; const auto& chunks = *player.chunks;
const auto& menu = gui.getMenu(); const auto& menu = gui.getMenu();

View File

@ -38,7 +38,6 @@ bool menus::call(Engine& engine, runnable func) {
if (engine.isHeadless()) { if (engine.isHeadless()) {
throw std::runtime_error("menus::call(...) in headless mode"); throw std::runtime_error("menus::call(...) in headless mode");
} }
auto gui = engine.getGUI();
try { try {
func(); func();
return true; return true;

View File

@ -154,7 +154,6 @@ void LevelScreen::saveDecorations() {
void LevelScreen::saveWorldPreview() { void LevelScreen::saveWorldPreview() {
try { try {
logger.info() << "saving world preview"; logger.info() << "saving world preview";
const auto& paths = engine.getPaths();
auto player = playerController->getPlayer(); auto player = playerController->getPlayer();
auto& settings = engine.getSettings(); auto& settings = engine.getSettings();
int previewSize = settings.ui.worldPreviewSize.get(); int previewSize = settings.ui.worldPreviewSize.get();

View File

@ -153,7 +153,6 @@ static inline void draw_text(
} }
batch.texture(font.getPage(0)); batch.texture(font.getPage(0));
for (size_t i = 0; i < text.length(); i++) { for (size_t i = 0; i < text.length(); i++) {
uint c = text[i];
size_t styleIndex = styles->map.at( size_t styleIndex = styles->map.at(
std::min(styles->map.size() - 1, i + styleMapOffset) std::min(styles->map.size() - 1, i + styleMapOffset)
); );

View File

@ -329,8 +329,6 @@ void BlocksRenderer::blockCube(
bool lights, bool lights,
bool ao bool ao
) { ) {
ubyte group = block.drawGroup;
glm::ivec3 X(1, 0, 0); glm::ivec3 X(1, 0, 0);
glm::ivec3 Y(0, 1, 0); glm::ivec3 Y(0, 1, 0);
glm::ivec3 Z(0, 0, 1); glm::ivec3 Z(0, 0, 1);
@ -557,7 +555,7 @@ SortingMeshData BlocksRenderer::renderTranslucent(
y + 0.5f, y + 0.5f,
z + chunk->z * CHUNK_D + 0.5f z + chunk->z * CHUNK_D + 0.5f
), ),
util::Buffer<float>(indexSize * CHUNK_VERTEX_SIZE)}; util::Buffer<float>(indexSize * CHUNK_VERTEX_SIZE), 0};
totalSize += entry.vertexData.size(); totalSize += entry.vertexData.size();
@ -593,7 +591,8 @@ SortingMeshData BlocksRenderer::renderTranslucent(
sortingMesh.entries.size() > 1) { sortingMesh.entries.size() > 1) {
SortingMeshEntry newEntry { SortingMeshEntry newEntry {
sortingMesh.entries[0].position, sortingMesh.entries[0].position,
util::Buffer<float>(totalSize) util::Buffer<float>(totalSize),
0
}; };
size_t offset = 0; size_t offset = 0;
for (const auto& entry : sortingMesh.entries) { for (const auto& entry : sortingMesh.entries) {
@ -643,7 +642,7 @@ void BlocksRenderer::build(const Chunk* chunk, const Chunks* chunks) {
vertexOffset = 0; vertexOffset = 0;
indexOffset = indexSize = 0; indexOffset = indexSize = 0;
sortingMesh = std::move(renderTranslucent(voxels, beginEnds)); sortingMesh = renderTranslucent(voxels, beginEnds);
overflow = false; overflow = false;
vertexOffset = 0; vertexOffset = 0;

View File

@ -19,7 +19,6 @@ static debug::Logger logger("chunks-render");
size_t ChunksRenderer::visibleChunks = 0; size_t ChunksRenderer::visibleChunks = 0;
class RendererWorker : public util::Worker<std::shared_ptr<Chunk>, RendererResult> { class RendererWorker : public util::Worker<std::shared_ptr<Chunk>, RendererResult> {
const Level& level;
const Chunks& chunks; const Chunks& chunks;
BlocksRenderer renderer; BlocksRenderer renderer;
public: public:
@ -29,8 +28,7 @@ public:
const ContentGfxCache& cache, const ContentGfxCache& cache,
const EngineSettings& settings const EngineSettings& settings
) )
: level(level), : chunks(chunks),
chunks(chunks),
renderer( renderer(
settings.graphics.denseRender.get() settings.graphics.denseRender.get()
? settings.graphics.chunkMaxVerticesDense.get() ? settings.graphics.chunkMaxVerticesDense.get()
@ -45,7 +43,7 @@ public:
renderer.build(chunk.get(), &chunks); renderer.build(chunk.get(), &chunks);
if (renderer.isCancelled()) { if (renderer.isCancelled()) {
return RendererResult { return RendererResult {
glm::ivec2(chunk->x, chunk->z), true, MeshData()}; glm::ivec2(chunk->x, chunk->z), true, ChunkMeshData {}};
} }
auto meshData = renderer.createMesh(); auto meshData = renderer.createMesh();
return RendererResult { return RendererResult {
@ -61,8 +59,7 @@ ChunksRenderer::ChunksRenderer(
const ContentGfxCache& cache, const ContentGfxCache& cache,
const EngineSettings& settings const EngineSettings& settings
) )
: level(*level), : chunks(chunks),
chunks(chunks),
assets(assets), assets(assets),
frustum(frustum), frustum(frustum),
settings(settings), settings(settings),

View File

@ -42,7 +42,6 @@ struct RendererResult {
}; };
class ChunksRenderer { class ChunksRenderer {
const Level& level;
const Chunks& chunks; const Chunks& chunks;
const Assets& assets; const Assets& assets;
const Frustum& frustum; const Frustum& frustum;

View File

@ -40,11 +40,10 @@ Decorator::Decorator(
const Assets& assets, const Assets& assets,
Player& player Player& player
) )
: engine(engine), : level(*controller.getLevel()),
level(*controller.getLevel()),
renderer(renderer),
assets(assets), assets(assets),
player(player) { player(player),
renderer(renderer) {
controller.getBlocksController()->listenBlockInteraction( controller.getBlocksController()->listenBlockInteraction(
[this](auto player, const auto& pos, const auto& def, BlockInteraction type) { [this](auto player, const auto& pos, const auto& def, BlockInteraction type) {
if (type == BlockInteraction::placing && def.particles) { if (type == BlockInteraction::placing && def.particles) {

View File

@ -18,11 +18,10 @@ class Block;
class Engine; class Engine;
class LevelController; class LevelController;
class WorldRenderer; class WorldRenderer;
class Weather; struct Weather;
struct WeatherPreset; struct WeatherPreset;
class Decorator { class Decorator {
Engine& engine;
const Level& level; const Level& level;
const Assets& assets; const Assets& assets;
Player& player; Player& player;

View File

@ -19,7 +19,7 @@ Emitter::Emitter(
) )
: level(level), : level(level),
origin(std::move(origin)), origin(std::move(origin)),
prototype({this, 0, {}, preset.velocity, preset.lifetime, region}), prototype({this, 0, {}, preset.velocity, preset.lifetime, region, 0, 0}),
texture(texture), texture(texture),
count(count), count(count),
preset(std::move(preset)) { preset(std::move(preset)) {

View File

@ -51,11 +51,10 @@ ModelBatch::ModelBatch(
const Chunks& chunks, const Chunks& chunks,
const EngineSettings& settings const EngineSettings& settings
) )
: batch(std::make_unique<MainBatch>(capacity)), : assets(assets),
assets(assets),
chunks(chunks), chunks(chunks),
settings(settings) { settings(settings),
} batch(std::make_unique<MainBatch>(capacity)) {}
ModelBatch::~ModelBatch() = default; ModelBatch::~ModelBatch() = default;

View File

@ -21,11 +21,10 @@ ParticlesRenderer::ParticlesRenderer(
const Chunks& chunks, const Chunks& chunks,
const GraphicsSettings* settings const GraphicsSettings* settings
) )
: batch(std::make_unique<MainBatch>(4096)), : chunks(chunks),
level(level),
chunks(chunks),
assets(assets), assets(assets),
settings(settings) { settings(settings),
batch(std::make_unique<MainBatch>(4096)) {
} }
ParticlesRenderer::~ParticlesRenderer() = default; ParticlesRenderer::~ParticlesRenderer() = default;
@ -171,7 +170,6 @@ void ParticlesRenderer::render(const Camera& camera, float delta) {
continue; continue;
} }
auto texture = emitter.getTexture(); auto texture = emitter.getTexture();
const auto& found = particles.find(texture);
std::vector<Particle>* vec; std::vector<Particle>* vec;
vec = &particles[texture]; vec = &particles[texture];
emitter.update(delta, camera.position, *vec); emitter.update(delta, camera.position, *vec);

View File

@ -16,7 +16,6 @@ class Level;
struct GraphicsSettings; struct GraphicsSettings;
class ParticlesRenderer { class ParticlesRenderer {
const Level& level;
const Chunks& chunks; const Chunks& chunks;
const Assets& assets; const Assets& assets;
const GraphicsSettings* settings; const GraphicsSettings* settings;

View File

@ -18,15 +18,13 @@
PrecipitationRenderer::PrecipitationRenderer( PrecipitationRenderer::PrecipitationRenderer(
const Assets& assets, const Assets& assets,
const Level& level, const Level&,
const Chunks& chunks, const Chunks& chunks,
const GraphicsSettings* settings const GraphicsSettings*
) )
: batch(std::make_unique<MainBatch>(4096)), : batch(std::make_unique<MainBatch>(4096)),
level(level),
chunks(chunks), chunks(chunks),
assets(assets), assets(assets) {
settings(settings) {
} }
PrecipitationRenderer::~PrecipitationRenderer() = default; PrecipitationRenderer::~PrecipitationRenderer() = default;

View File

@ -12,10 +12,8 @@ struct WeatherPreset;
class PrecipitationRenderer { class PrecipitationRenderer {
std::unique_ptr<MainBatch> batch; std::unique_ptr<MainBatch> batch;
const Level& level;
const Chunks& chunks; const Chunks& chunks;
const Assets& assets; const Assets& assets;
const GraphicsSettings* settings;
float timer = 0.0f; float timer = 0.0f;
int getHeightAt(int x, int z); int getHeightAt(int x, int z);

View File

@ -72,10 +72,6 @@ WorldRenderer::WorldRenderer(
modelBatch(std::make_unique<ModelBatch>( modelBatch(std::make_unique<ModelBatch>(
MODEL_BATCH_CAPACITY, assets, *player.chunks, engine.getSettings() MODEL_BATCH_CAPACITY, assets, *player.chunks, engine.getSettings()
)), )),
particles(std::make_unique<ParticlesRenderer>(
assets, level, *player.chunks, &engine.getSettings().graphics
)),
texts(std::make_unique<TextsRenderer>(*batch3d, assets, *frustumCulling)),
guides(std::make_unique<GuidesRenderer>()), guides(std::make_unique<GuidesRenderer>()),
chunks(std::make_unique<ChunksRenderer>( chunks(std::make_unique<ChunksRenderer>(
&level, &level,
@ -85,6 +81,10 @@ WorldRenderer::WorldRenderer(
frontend.getContentGfxCache(), frontend.getContentGfxCache(),
engine.getSettings() engine.getSettings()
)), )),
particles(std::make_unique<ParticlesRenderer>(
assets, level, *player.chunks, &engine.getSettings().graphics
)),
texts(std::make_unique<TextsRenderer>(*batch3d, assets, *frustumCulling)),
blockWraps( blockWraps(
std::make_unique<BlockWrapsRenderer>(assets, level, *player.chunks) std::make_unique<BlockWrapsRenderer>(assets, level, *player.chunks)
), ),

View File

@ -43,10 +43,10 @@ class WorldRenderer {
std::unique_ptr<Frustum> frustumCulling; std::unique_ptr<Frustum> frustumCulling;
std::unique_ptr<LineBatch> lineBatch; std::unique_ptr<LineBatch> lineBatch;
std::unique_ptr<Batch3D> batch3d; std::unique_ptr<Batch3D> batch3d;
std::unique_ptr<ChunksRenderer> chunks;
std::unique_ptr<GuidesRenderer> guides;
std::unique_ptr<Skybox> skybox;
std::unique_ptr<ModelBatch> modelBatch; std::unique_ptr<ModelBatch> modelBatch;
std::unique_ptr<GuidesRenderer> guides;
std::unique_ptr<ChunksRenderer> chunks;
std::unique_ptr<Skybox> skybox;
Weather weather {}; Weather weather {};
float timer = 0.0f; float timer = 0.0f;
@ -73,8 +73,8 @@ class WorldRenderer {
float fogFactor float fogFactor
); );
public: public:
std::unique_ptr<TextsRenderer> texts;
std::unique_ptr<ParticlesRenderer> particles; std::unique_ptr<ParticlesRenderer> particles;
std::unique_ptr<TextsRenderer> texts;
std::unique_ptr<BlockWrapsRenderer> blockWraps; std::unique_ptr<BlockWrapsRenderer> blockWraps;
std::unique_ptr<PrecipitationRenderer> precipitation; std::unique_ptr<PrecipitationRenderer> precipitation;

View File

@ -7,9 +7,9 @@ namespace gui {
class InputBindBox : public Panel { class InputBindBox : public Panel {
protected: protected:
Binding& binding;
glm::vec4 focusedColor {0.1f, 0.15f, 0.35f, 0.75f}; glm::vec4 focusedColor {0.1f, 0.15f, 0.35f, 0.75f};
std::shared_ptr<Label> label; std::shared_ptr<Label> label;
Binding& binding;
public: public:
InputBindBox(Binding& binding, glm::vec4 padding=glm::vec4(6.0f)); InputBindBox(Binding& binding, glm::vec4 padding=glm::vec4(6.0f));

View File

@ -12,7 +12,7 @@
class Font; class Font;
class Assets; class Assets;
class ItemDef; struct ItemDef;
class Batch2D; class Batch2D;
class DrawContext; class DrawContext;
class Content; class Content;

View File

@ -1,12 +1,13 @@
#include "Label.hpp" #include "Label.hpp"
#include <utility> #include <utility>
#include "assets/Assets.hpp"
#include "graphics/core/DrawContext.hpp" #include "graphics/core/DrawContext.hpp"
#include "graphics/core/Batch2D.hpp" #include "graphics/core/Batch2D.hpp"
#include "graphics/core/Font.hpp" #include "graphics/core/Font.hpp"
#include "assets/Assets.hpp" #include "graphics/ui/markdown.hpp"
#include "util/stringutil.hpp" #include "util/stringutil.hpp"
#include "../markdown.hpp"
using namespace gui; using namespace gui;
@ -60,7 +61,6 @@ void LabelCache::update(std::wstring_view text, bool multiline, bool wrap) {
} }
} }
if (font != nullptr) { if (font != nullptr) {
int lineHeight = font->getLineHeight();
int maxWidth = 0; int maxWidth = 0;
for (int i = 0; i < lines.size() - 1; i++) { for (int i = 0; i < lines.size() - 1; i++) {
const auto& next = lines[i + 1]; const auto& next = lines[i + 1];

View File

@ -1,15 +1,16 @@
#include "TextBox.hpp" #include "TextBox.hpp"
#include <algorithm>
#include <sstream> #include <sstream>
#include <utility> #include <utility>
#include <algorithm>
#include "Label.hpp" #include "Label.hpp"
#include "devtools/syntax_highlighting.hpp"
#include "graphics/core/DrawContext.hpp"
#include "graphics/core/Batch2D.hpp"
#include "graphics/core/Font.hpp"
#include "assets/Assets.hpp" #include "assets/Assets.hpp"
#include "devtools/syntax_highlighting.hpp"
#include "graphics/core/Batch2D.hpp"
#include "graphics/core/DrawContext.hpp"
#include "graphics/core/Font.hpp"
#include "graphics/ui/markdown.hpp"
#include "util/stringutil.hpp" #include "util/stringutil.hpp"
#include "window/Events.hpp" #include "window/Events.hpp"
#include "window/Window.hpp" #include "window/Window.hpp"
@ -602,7 +603,6 @@ void TextBox::onFocus(GUI* gui) {
} }
void TextBox::reposition() { void TextBox::reposition() {
auto size = getSize();
UINode::reposition(); UINode::reposition();
refreshLabel(); refreshLabel();
} }

View File

@ -46,7 +46,7 @@ void guiutil::alert(
auto menuPtr = engine.getGUI()->getMenu(); auto menuPtr = engine.getGUI()->getMenu();
auto& menu = *menuPtr; auto& menu = *menuPtr;
runnable on_hidden_final = [on_hidden, &menu, &engine]() { runnable on_hidden_final = [on_hidden, &menu]() {
menu.removePage("<alert>"); menu.removePage("<alert>");
if (on_hidden) { if (on_hidden) {
on_hidden(); on_hidden();
@ -103,7 +103,7 @@ void guiutil::confirm(
auto menu = engine.getGUI()->getMenu(); auto menu = engine.getGUI()->getMenu();
runnable on_confirm_final = [on_confirm, menu, &engine]() { runnable on_confirm_final = [on_confirm, menu]() {
menu->removePage("<confirm>"); menu->removePage("<confirm>");
if (on_confirm) { if (on_confirm) {
on_confirm(); on_confirm();
@ -112,7 +112,7 @@ void guiutil::confirm(
} }
}; };
runnable on_deny_final = [on_deny, menu, &engine]() { runnable on_deny_final = [on_deny, menu]() {
menu->removePage("<confirm>"); menu->removePage("<confirm>");
if (on_deny) { if (on_deny) {
on_deny(); on_deny();

View File

@ -9,8 +9,8 @@
class memory_buffer : public std::streambuf { class memory_buffer : public std::streambuf {
public: public:
explicit memory_buffer(size_t initial_size = 64) explicit memory_buffer(size_t initial_size = 64)
: capacity(initial_size), : buffer(std::make_unique<char[]>(initial_size)),
buffer(std::make_unique<char[]>(initial_size)) { capacity(initial_size) {
setp(buffer.get(), buffer.get() + initial_size); setp(buffer.get(), buffer.get() + initial_size);
} }

View File

@ -59,8 +59,6 @@ path path::normalized() const {
} }
parts.push(std::move(token)); parts.push(std::move(token));
} }
bool started = false;
path = ""; path = "";
while (!parts.empty()) { while (!parts.empty()) {
const auto& token = parts.top(); const auto& token = parts.top();

View File

@ -217,8 +217,7 @@ PlayerController::PlayerController(
Player& player, Player& player,
BlocksController& blocksController BlocksController& blocksController
) )
: settings(settings), : level(level),
level(level),
player(player), player(player),
camControl(player, settings.camera), camControl(player, settings.camera),
blocksController(blocksController) { blocksController(blocksController) {

View File

@ -47,7 +47,6 @@ public:
}; };
class PlayerController { class PlayerController {
const EngineSettings& settings;
Level& level; Level& level;
Player& player; Player& player;
PlayerInput input {}; PlayerInput input {};

View File

@ -145,7 +145,7 @@ static int get_axis(lua::State* L) {
} }
auto z = lua::tointeger(L, 3); auto z = lua::tointeger(L, 3);
glm::ivec3 defAxis; glm::ivec3 defAxis {};
defAxis[n] = 1; defAxis[n] = 1;
auto vox = blocks_agent::get(*level->chunks, x, y, z); auto vox = blocks_agent::get(*level->chunks, x, y, z);
@ -562,6 +562,7 @@ static int set_field(
return lua::pushinteger(L, return lua::pushinteger(L,
dataStruct.setUnicode(dst, value.asString(), field)); dataStruct.setUnicode(dst, value.asString(), field));
} }
[[fallthrough]];
case data::FieldType::I8: case data::FieldType::I8:
case data::FieldType::I16: case data::FieldType::I16:
case data::FieldType::I32: case data::FieldType::I32:

View File

@ -13,7 +13,6 @@
using namespace scripting; using namespace scripting;
static int l_save_fragment(lua::State* L) { static int l_save_fragment(lua::State* L) {
const auto& paths = engine->getPaths();
auto fragment = lua::touserdata<lua::LuaVoxelFragment>(L, 1); auto fragment = lua::touserdata<lua::LuaVoxelFragment>(L, 1);
auto file = lua::require_string(L, 2); auto file = lua::require_string(L, 2);
auto map = fragment->getFragment()->serialize(); auto map = fragment->getFragment()->serialize();
@ -55,13 +54,11 @@ static int l_get_generators(lua::State* L) {
lua::createtable(L, 0, 0); lua::createtable(L, 0, 0);
int i = 1;
for (const auto& pack : packs) { for (const auto& pack : packs) {
auto pairs = ContentLoader::scanContent(pack, ContentType::GENERATOR); auto pairs = ContentLoader::scanContent(pack, ContentType::GENERATOR);
for (const auto& [name, caption] : pairs) { for (const auto& [name, caption] : pairs) {
lua::pushstring(L, caption); lua::pushstring(L, caption);
lua::setfield(L, name); lua::setfield(L, name);
i++;
} }
} }
return 1; return 1;

View File

@ -783,7 +783,7 @@ static int l_gui_escape_markup(lua::State* L) {
auto lang = lua::require_string(L, 1); auto lang = lua::require_string(L, 1);
std::string text = lua::require_string(L, 2); std::string text = lua::require_string(L, 2);
if (std::strcmp(lang, "md") == 0) { if (std::strcmp(lang, "md") == 0) {
text = std::move(markdown::escape<char>(text)); text = markdown::escape<char>(text);
} }
return lua::pushstring(L, text); return lua::pushstring(L, text);
} }

View File

@ -227,7 +227,6 @@ static int l_has_data(lua::State* L, ItemStack& stack) {
static int l_set_data(lua::State* L, ItemStack& stack) { static int l_set_data(lua::State* L, ItemStack& stack) {
auto key = lua::require_string(L, 3); auto key = lua::require_string(L, 3);
auto value = lua::tovalue(L, 4); auto value = lua::tovalue(L, 4);
auto& fields = stack.getFields();
stack.setField(key, std::move(value)); stack.setField(key, std::move(value));
return 0; return 0;
} }

View File

@ -235,7 +235,7 @@ static int l_pack_assemble(lua::State* L) {
auto manager = engine->createPacksManager(worldFolder); auto manager = engine->createPacksManager(worldFolder);
manager.scan(); manager.scan();
try { try {
ids = std::move(manager.assemble(ids)); ids = manager.assemble(ids);
} catch (const contentpack_error& err) { } catch (const contentpack_error& err) {
throw std::runtime_error( throw std::runtime_error(
std::string(err.what()) + " [" + err.getPackId() + "]" std::string(err.what()) + " [" + err.getPackId() + "]"

View File

@ -59,7 +59,6 @@ static int l_get_origin(lua::State* L) {
static int l_set_origin(lua::State* L) { static int l_set_origin(lua::State* L) {
u64id_t id = lua::touinteger(L, 1); u64id_t id = lua::touinteger(L, 1);
if (auto emitter = renderer->particles->getEmitter(id)) { if (auto emitter = renderer->particles->getEmitter(id)) {
EmitterOrigin origin;
if (lua::istable(L, 2)) { if (lua::istable(L, 2)) {
emitter->setOrigin(lua::tovec3(L, 2)); emitter->setOrigin(lua::tovec3(L, 2));
} else { } else {

View File

@ -149,9 +149,7 @@ static int l_get_chunk_data(lua::State* L) {
static void integrate_chunk_client(Chunk& chunk) { static void integrate_chunk_client(Chunk& chunk) {
int x = chunk.x; int x = chunk.x;
int z = chunk.z; int z = chunk.z;
auto chunksController = controller->getChunksController();
Lighting& lighting = *chunksController->lighting;
chunk.flags.loadedLights = false; chunk.flags.loadedLights = false;
chunk.flags.lighted = false; chunk.flags.lighted = false;
chunk.lightmap.clear(); chunk.lightmap.clear();

View File

@ -50,7 +50,6 @@ const float* LuaHeightmap::getValues() const {
} }
static int l_dump(lua::State* L) { static int l_dump(lua::State* L) {
const auto& paths = scripting::engine->getPaths();
if (auto heightmap = touserdata<LuaHeightmap>(L, 1)) { if (auto heightmap = touserdata<LuaHeightmap>(L, 1)) {
io::path file = require_string(L, 2); io::path file = require_string(L, 2);
uint w = heightmap->getWidth(); uint w = heightmap->getWidth();

View File

@ -21,41 +21,26 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
// //
// .'',;:cldxkO00KKXXNNWWWNNXKOkxdollcc::::::;:::ccllloooolllllllllooollc:,'... // .'',;:cldxkO00KKXXNNWWWNNXKOkxdollcc::::::;:::ccllloooolllllllllooollc:,'... ...........',;cldxkO000Okxdlc::;;;,,;;;::cclllllll
// ...........',;cldxkO000Okxdlc::;;;,,;;;::cclllllll // ..',;:ldxO0KXXNNNNNNNNXXK0kxdolcc::::::;;;,,,,,,;;;;;;;;;;:::cclllllc:;'.... ...........',;:ldxO0KXXXK0Okxdolc::;;;;::cllodddddo
// ..',;:ldxO0KXXNNNNNNNNXXK0kxdolcc::::::;;;,,,,,,;;;;;;;;;;:::cclllllc:;'....
// ...........',;:ldxO0KXXXK0Okxdolc::;;;;::cllodddddo
// ...',:loxO0KXNNNNNXXKK0Okxdolc::;::::::::;;;,,'''''.....''',;:clllllc:;,'............''''''''',;:loxO0KXNNNNNXK0Okxdollccccllodxxxxxxd // ...',:loxO0KXNNNNNXXKK0Okxdolc::;::::::::;;;,,'''''.....''',;:clllllc:;,'............''''''''',;:loxO0KXNNNNNXK0Okxdollccccllodxxxxxxd
// ....';:ldkO0KXXXKK00Okxdolcc:;;;;;::cclllcc:;;,''..... // ....';:ldkO0KXXXKK00Okxdolcc:;;;;;::cclllcc:;;,''..... ....',;clooddolcc:;;;;,,;;;;;::::;;;;;;:cloxk0KXNWWWWWWNXKK0Okxddoooddxxkkkkkxx
// ....',;clooddolcc:;;;;,,;;;;;::::;;;;;;:cloxk0KXNWWWWWWNXKK0Okxddoooddxxkkkkkxx // .....';:ldxkOOOOOkxxdolcc:;;;,,,;;:cllooooolcc:;'... ..,:codxkkkxddooollloooooooollcc:::::clodkO0KXNWWWWWWNNXK00Okxxxxxxxxkkkkxxx
// .....';:ldxkOOOOOkxxdolcc:;;;,,,;;:cllooooolcc:;'... // . ....';:cloddddo___________,,,,;;:clooddddoolc:,... ..,:ldx__00OOOkkk___kkkkkkxxdollc::::cclodkO0KXXNNNNNNXXK0OOkxxxxxxxxxxxxddd
// ..,:codxkkkxddooollloooooooollcc:::::clodkO0KXNWWWWWWNNXK00Okxxxxxxxxkkkkxxx // .......',;:cccc:| |,,,;;:cclooddddoll:;'.. ..';cox| \KKK000| |KK00OOkxdocc___;::clldxxkO0KKKKK00Okkxdddddddddddddddoo
// . ....';:cloddddo___________,,,,;;:clooddddoolc:,... // .......'',,,,,''| ________|',,;;::cclloooooolc:;'......___:ldk| \KK000| |XKKK0Okxolc| |;;::cclodxxkkkkxxdoolllcclllooodddooooo
// ..,:ldx__00OOOkkk___kkkkkkxxdollc::::cclodkO0KXXNNNNNNXXK0OOkxxxxxxxxxxxxddd // ''......''''....| | ....'',,,,;;;::cclloooollc:;,''.'| |oxk| \OOO0| |KKK00Oxdoll|___|;;;;;::ccllllllcc::;;,,;;;:cclloooooooo
// .......',;:cccc:| |,,,;;:cclooddddoll:;'.. ..';cox| \KKK000| // ;;,''.......... | |_____',,;;;____:___cllo________.___| |___| \xkk| |KK_______ool___:::;________;;;_______...'',;;:ccclllloo
// |KK00OOkxdocc___;::clldxxkO0KKKKK00Okkxdddddddddddddddoo // c:;,''......... | |:::/ ' |lo/ | | \dx| |0/ \d| |cc/ |'/ \......',,;;:ccllo
// .......'',,,,,''| ________|',,;;::cclloooooolc:;'......___:ldk| \KK000| // ol:;,'..........| _____|ll/ __ |o/ ______|____ ___| | \o| |/ ___ \| |o/ ______|/ ___ \ .......'',;:clo
// |XKKK0Okxolc| |;;::cclodxxkkkkxxdoolllcclllooodddooooo // dlc;,...........| |::clooo| / | |x\___ \KXKKK0| |dol| |\ \| | | | | |d\___ \..| | / / ....',:cl
// ''......''''....| | ....'',,,,;;;::cclloooollc:;,''.'| |oxk| \OOO0| // xoc;'... .....'| |llodddd| \__| |_____\ \KKK0O| |lc:| |'\ | |___| | |_____\ \.| |_/___/... ...',;:c
// |KKK00Oxdoll|___|;;;;;::ccllllllcc::;;,,;;;:cclloooooooo // dlc;'... ....',;| |oddddddo\ | |Okkx| |::;| |..\ |\ /| | | \ |... ....',;:c
// ;;,''.......... | |_____',,;;;____:___cllo________.___| |___| \xkk| // ol:,'.......',:c|___|xxxddollc\_____,___|_________/ddoll|___|,,,|___|...\_____|:\ ______/l|___|_________/...\________|'........',;::cc
// |KK_______ool___:::;________;;;_______...'',;;:ccclllloo c:;,''......... |
// |:::/ ' |lo/ | | \dx| |0/ \d| |cc/ |'/
// \......',,;;:ccllo ol:;,'..........| _____|ll/ __ |o/ ______|____
// ___| | \o| |/ ___ \| |o/ ______|/ ___ \ .......'',;:clo
// dlc;,...........| |::clooo| / | |x\___ \KXKKK0| |dol| |\ \|
// | | | | |d\___ \..| | / / ....',:cl xoc;'... .....'|
// |llodddd| \__| |_____\ \KKK0O| |lc:| |'\ | |___| |
// |_____\ \.| |_/___/... ...',;:c dlc;'... ....',;| |oddddddo\ |
// |Okkx| |::;| |..\ |\ /| | | \ |...
// ....',;:c
// ol:,'.......',:c|___|xxxddollc\_____,___|_________/ddoll|___|,,,|___|...\_____|:\
// ______/l|___|_________/...\________|'........',;::cc
// c:;'.......';:codxxkkkkxxolc::;::clodxkOO0OOkkxdollc::;;,,''''',,,,''''''''''',,'''''',;:loxkkOOkxol:;,'''',,;:ccllcc:;,'''''',;::ccll // c:;'.......';:codxxkkkkxxolc::;::clodxkOO0OOkkxdollc::;;,,''''',,,,''''''''''',,'''''',;:loxkkOOkxol:;,'''',,;:ccllcc:;,'''''',;::ccll
// ;,'.......',:codxkOO0OOkxdlc:;,,;;:cldxxkkxxdolc:;;,,''.....'',;;:::;;,,,'''''........,;cldkO0KK0Okdoc::;;::cloodddoolc:;;;;;::ccllooo // ;,'.......',:codxkOO0OOkxdlc:;,,;;:cldxxkkxxdolc:;;,,''.....'',;;:::;;,,,'''''........,;cldkO0KK0Okdoc::;;::cloodddoolc:;;;;;::ccllooo
// .........',;:lodxOO0000Okdoc:,,',,;:clloddoolc:;,''.......'',;:clooollc:;;,,''.......',:ldkOKXNNXX0Oxdolllloddxxxxxxdolccccccllooodddd // .........',;:lodxOO0000Okdoc:,,',,;:clloddoolc:;,''.......'',;:clooollc:;;,,''.......',:ldkOKXNNXX0Oxdolllloddxxxxxxdolccccccllooodddd
// . // . .....';:cldxkO0000Okxol:;,''',,;::cccc:;,,'.......'',;:cldxxkkxxdolc:;;,'.......';coxOKXNWWWNXKOkxddddxxkkkkkkxdoollllooddxxxxkkk
// .....';:cldxkO0000Okxol:;,''',,;::cccc:;,,'.......'',;:cldxxkkxxdolc:;;,'.......';coxOKXNWWWNXKOkxddddxxkkkkkkxdoollllooddxxxxkkk
// ....',;:codxkO000OOxdoc:;,''',,,;;;;,''.......',,;:clodkO00000Okxolc::;,,''..',;:ldxOKXNWWWNNK0OkkkkkkkkkkkxxddooooodxxkOOOOO000 // ....',;:codxkO000OOxdoc:;,''',,,;;;;,''.......',,;:clodkO00000Okxolc::;,,''..',;:ldxOKXNWWWNNK0OkkkkkkkkkkkxxddooooodxxkOOOOO000
// ....',;;clodxkkOOOkkdolc:;,,,,,,,,'..........,;:clodxkO0KKXKK0Okxdolcc::;;,,,;;:codkO0XXNNNNXKK0OOOOOkkkkxxdoollloodxkO0KKKXXXXX // ....',;;clodxkkOOOkkdolc:;,,,,,,,,'..........,;:clodxkO0KKXKK0Okxdolcc::;;,,,;;:codkO0XXNNNNXKK0OOOOOkkkkxxdoollloodxkO0KKKXXXXX
// //

View File

@ -16,8 +16,8 @@ enum class InterpolationType {
std::optional<InterpolationType> InterpolationType_from(std::string_view str); std::optional<InterpolationType> InterpolationType_from(std::string_view str);
class Heightmap { class Heightmap {
std::vector<float> buffer;
uint width, height; uint width, height;
std::vector<float> buffer;
public: public:
Heightmap(uint width, uint height) Heightmap(uint width, uint height)
: width(width), height(height) { : width(width), height(height) {

View File

@ -85,7 +85,8 @@ public:
OnReject onReject, OnReject onReject,
long maxSize long maxSize
) override { ) override {
Request request {RequestType::GET, url, onResponse, onReject, maxSize}; Request request {
RequestType::GET, url, onResponse, onReject, maxSize, false, ""};
processRequest(std::move(request)); processRequest(std::move(request));
} }
@ -96,7 +97,8 @@ public:
OnReject onReject=nullptr, OnReject onReject=nullptr,
long maxSize=0 long maxSize=0
) override { ) override {
Request request {RequestType::POST, url, onResponse, onReject, maxSize}; Request request {
RequestType::POST, url, onResponse, onReject, maxSize, false, ""};
request.data = data; request.data = data;
processRequest(std::move(request)); processRequest(std::move(request));
} }
@ -288,7 +290,6 @@ static std::string to_string(const sockaddr_in& addr, bool port=true) {
class SocketConnection : public Connection { class SocketConnection : public Connection {
SOCKET descriptor; SOCKET descriptor;
bool open = true;
sockaddr_in addr; sockaddr_in addr;
size_t totalUpload = 0; size_t totalUpload = 0;
size_t totalDownload = 0; size_t totalDownload = 0;
@ -453,7 +454,8 @@ public:
throw std::runtime_error(gai_strerror(res)); throw std::runtime_error(gai_strerror(res));
} }
sockaddr_in serverAddress = *(sockaddr_in*)addrinfo->ai_addr; sockaddr_in serverAddress;
std::memcpy(&serverAddress, addrinfo->ai_addr, sizeof(sockaddr_in));
serverAddress.sin_port = htons(port); serverAddress.sin_port = htons(port);
freeaddrinfo(addrinfo); freeaddrinfo(addrinfo);

View File

@ -1,15 +1,15 @@
#pragma once #pragma once
#include <mutex>
#include <vector>
#include <algorithm> #include <algorithm>
#include <mutex>
#include <unordered_map> #include <unordered_map>
#include <vector>
#include "typedefs.hpp"
#include "delegates.hpp" #include "delegates.hpp"
#include "typedefs.hpp"
namespace util { namespace util {
template<class...Types> template <class... Types>
class HandlersList { class HandlersList {
int nextid = 1; int nextid = 1;
std::unordered_map<int, std::function<bool(Types...)>> handlers; std::unordered_map<int, std::function<bool(Types...)>> handlers;
@ -35,7 +35,7 @@ namespace util {
int id = nextid++; int id = nextid++;
handlers[id] = std::move(handler); handlers[id] = std::move(handler);
order.push_back(id); order.push_back(id);
return observer_handler(new int(id), [this](int* id) { //-V508 return observer_handler(new int(id), [this](int* id) { //-V508
std::lock_guard lock(mutex); std::lock_guard lock(mutex);
handlers.erase(*id); handlers.erase(*id);
order.erase( order.erase(
@ -45,7 +45,7 @@ namespace util {
}); });
} }
void notify(Types...args) { void notify(Types... args) {
std::vector<int> orderCopy; std::vector<int> orderCopy;
decltype(handlers) handlersCopy; decltype(handlers) handlersCopy;
{ {

View File

@ -9,6 +9,9 @@
#include "stringutil.hpp" #include "stringutil.hpp"
#include "typedefs.hpp" #include "typedefs.hpp"
#include "debug/Logger.hpp"
static debug::Logger logger("platform");
#ifdef _WIN32 #ifdef _WIN32
#include <Windows.h> #include <Windows.h>
@ -103,6 +106,9 @@ void platform::open_folder(const std::filesystem::path& folder) {
ShellExecuteW(NULL, L"open", folder.wstring().c_str(), NULL, NULL, SW_SHOWDEFAULT); ShellExecuteW(NULL, L"open", folder.wstring().c_str(), NULL, NULL, SW_SHOWDEFAULT);
#else #else
auto cmd = "xdg-open " + util::quote(folder.u8string()); auto cmd = "xdg-open " + util::quote(folder.u8string());
system(cmd.c_str()); if (int res = system(cmd.c_str())) {
logger.warning() << "'" << cmd << "' returned code " << res;
}
#endif #endif
} }

View File

@ -13,6 +13,7 @@
#include "content/Content.hpp" #include "content/Content.hpp"
#include "maths/voxmaths.hpp" #include "maths/voxmaths.hpp"
#include <algorithm>
#include <set> #include <set>
#include <algorithm> #include <algorithm>
#include <stdint.h> #include <stdint.h>

View File

@ -21,8 +21,7 @@ Level::Level(
const Content& content, const Content& content,
EngineSettings& settings EngineSettings& settings
) )
: settings(settings), : world(std::move(worldPtr)),
world(std::move(worldPtr)),
content(content), content(content),
chunks(std::make_unique<GlobalChunks>(*this)), chunks(std::make_unique<GlobalChunks>(*this)),
physics(std::make_unique<PhysicsSolver>(glm::vec3(0, -22.6f, 0))), physics(std::make_unique<PhysicsSolver>(glm::vec3(0, -22.6f, 0))),

View File

@ -20,7 +20,6 @@ struct EngineSettings;
/// @brief A level, contains chunks and objects /// @brief A level, contains chunks and objects
class Level { class Level {
const EngineSettings& settings;
std::unique_ptr<World> world; std::unique_ptr<World> world;
public: public:
const Content& content; const Content& content;

View File

@ -54,7 +54,6 @@ void WorldConverter::addRegionsTasks(
} }
void WorldConverter::createUpgradeTasks() { void WorldConverter::createUpgradeTasks() {
const auto& regions = wfile->getRegions();
for (auto& issue : report->getIssues()) { for (auto& issue : report->getIssues()) {
if (issue.issueType != ContentIssueType::REGION_FORMAT_UPDATE) { if (issue.issueType != ContentIssueType::REGION_FORMAT_UPDATE) {
continue; continue;
@ -83,7 +82,6 @@ void WorldConverter::createConvertTasks() {
} }
}; };
const auto& regions = wfile->getRegions();
for (auto& issue : report->getIssues()) { for (auto& issue : report->getIssues()) {
switch (issue.issueType) { switch (issue.issueType) {
case ContentIssueType::BLOCK_DATA_LAYOUTS_UPDATE: case ContentIssueType::BLOCK_DATA_LAYOUTS_UPDATE:
@ -97,13 +95,13 @@ void WorldConverter::createConvertTasks() {
} }
} }
tasks.push(ConvertTask {ConvertTaskType::PLAYER, wfile->getPlayerFile()}); tasks.push(ConvertTask {
ConvertTaskType::PLAYER, wfile->getPlayerFile(), 0, 0, {}});
} }
void WorldConverter::createBlockFieldsConvertTasks() { void WorldConverter::createBlockFieldsConvertTasks() {
// blocks data conversion requires correct block indices // blocks data conversion requires correct block indices
// so it must be done AFTER voxels conversion // so it must be done AFTER voxels conversion
const auto& regions = wfile->getRegions();
for (auto& issue : report->getIssues()) { for (auto& issue : report->getIssues()) {
switch (issue.issueType) { switch (issue.issueType) {
case ContentIssueType::BLOCK_DATA_LAYOUTS_UPDATE: case ContentIssueType::BLOCK_DATA_LAYOUTS_UPDATE:

View File

@ -43,7 +43,7 @@ util::Buffer<ubyte> compatibility::convert_region_2to3(
const util::Buffer<ubyte>& src, RegionLayerIndex layer const util::Buffer<ubyte>& src, RegionLayerIndex layer
) { ) {
const size_t REGION_CHUNKS = 1024; const size_t REGION_CHUNKS = 1024;
const size_t HEADER_SIZE = 10; // const size_t HEADER_SIZE = 10;
const size_t OFFSET_TABLE_SIZE = REGION_CHUNKS * sizeof(uint32_t); const size_t OFFSET_TABLE_SIZE = REGION_CHUNKS * sizeof(uint32_t);
const ubyte COMPRESS_NONE = 0; const ubyte COMPRESS_NONE = 0;
const ubyte COMPRESS_EXTRLE8 = 1; const ubyte COMPRESS_EXTRLE8 = 1;
@ -61,7 +61,6 @@ util::Buffer<ubyte> compatibility::convert_region_2to3(
} }
uint32_t offsets[REGION_CHUNKS] {}; uint32_t offsets[REGION_CHUNKS] {};
size_t chunkIndex = 0;
auto tablePtr = reinterpret_cast<const uint32_t*>( auto tablePtr = reinterpret_cast<const uint32_t*>(
ptr + src.size() - OFFSET_TABLE_SIZE ptr + src.size() - OFFSET_TABLE_SIZE

View File

@ -8,7 +8,7 @@
VoxelStructure::VoxelStructure( VoxelStructure::VoxelStructure(
VoxelStructureMeta meta, VoxelStructureMeta meta,
std::unique_ptr<VoxelFragment> structure std::unique_ptr<VoxelFragment> structure
) : fragments({std::move(structure)}), meta(std::move(meta)) {} ) : meta(std::move(meta)), fragments({std::move(structure)}) {}
GeneratorDef::GeneratorDef(std::string name) GeneratorDef::GeneratorDef(std::string name)
: name(std::move(name)), caption(util::id_to_caption(name)) { : name(std::move(name)), caption(util::id_to_caption(name)) {

View File

@ -437,7 +437,6 @@ void WorldGenerator::generate(voxel* voxels, int chunkX, int chunkZ) {
std::memset(voxels, 0, sizeof(voxel) * CHUNK_VOL); std::memset(voxels, 0, sizeof(voxel) * CHUNK_VOL);
const auto& indices = content.getIndices()->blocks;
const auto& biomes = prototype.biomes.get(); const auto& biomes = prototype.biomes.get();
for (uint z = 0; z < CHUNK_D; z++) { for (uint z = 0; z < CHUNK_D; z++) {
for (uint x = 0; x < CHUNK_W; x++) { for (uint x = 0; x < CHUNK_W; x++) {
@ -456,6 +455,7 @@ void WorldGenerator::generate(voxel* voxels, int chunkX, int chunkZ) {
generatePlacements(prototype, voxels, chunkX, chunkZ); generatePlacements(prototype, voxels, chunkX, chunkZ);
generatePlants(prototype, values, voxels, chunkX, chunkZ, biomes); generatePlants(prototype, values, voxels, chunkX, chunkZ, biomes);
[[maybe_unused]] const auto& indices = content.getIndices()->blocks;
for (uint i = 0; i < CHUNK_VOL; i++) { for (uint i = 0; i < CHUNK_VOL; i++) {
blockid_t& id = voxels[i].id; blockid_t& id = voxels[i].id;
if (id == BLOCK_STRUCT_AIR) { if (id == BLOCK_STRUCT_AIR) {
@ -609,3 +609,7 @@ WorldGenDebugInfo WorldGenerator::createDebugInfo() const {
std::move(values) std::move(values)
}; };
} }
uint64_t WorldGenerator::getSeed() const {
return seed;
}

View File

@ -134,4 +134,6 @@ public:
void generate(voxel* voxels, int x, int z); void generate(voxel* voxels, int x, int z);
WorldGenDebugInfo createDebugInfo() const; WorldGenDebugInfo createDebugInfo() const;
uint64_t getSeed() const;
}; };

View File

@ -1,26 +1,22 @@
project(VoxelEngineTest) project(VoxelEngineTest)
set(CMAKE_CXX_STANDARD 17) file(GLOB_RECURSE sources ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
find_package(GTest) find_package(GTest)
add_executable(${PROJECT_NAME} ${SOURCES}) add_executable(VoxelEngineTest ${sources})
target_include_directories(${PROJECT_NAME} target_link_libraries(VoxelEngineTest PRIVATE VoxelEngineSrc GTest::gtest_main)
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../src)
target_link_libraries(${PROJECT_NAME} VoxelEngineSrc GTest::gtest_main)
# HACK: copy res to test/ folder for fixing problem compatibility MultiConfig # HACK: copy res to test/ folder for fixing problem compatibility MultiConfig
# and non MultiConfig builds. Delete in future and use only root res folder Also # and non MultiConfig builds. Delete in future and use only root res folder Also
# this resolve problem with ctests, because it set cwd to # this resolve problem with ctests, because it set cwd to
# CMAKE_CURRENT_BINARY_DIR # ${CMAKE_CURRENT_BINARY_DIR}
add_custom_command( add_custom_command(
TARGET ${PROJECT_NAME} TARGET VoxelEngineTest
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different
${CMAKE_SOURCE_DIR}/res ${CMAKE_CURRENT_BINARY_DIR}/res) ${CMAKE_SOURCE_DIR}/res ${CMAKE_CURRENT_BINARY_DIR}/res)
include(GoogleTest) include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}) gtest_discover_tests(VoxelEngineTest)

View File

@ -1,7 +1,8 @@
#include "coders/lua_parsing.hpp"
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "coders/commons.hpp" #include "coders/commons.hpp"
#include "coders/lua_parsing.hpp"
#include "io/io.hpp" #include "io/io.hpp"
#include "io/devices/StdfsDevice.hpp" #include "io/devices/StdfsDevice.hpp"
#include "util/stringutil.hpp" #include "util/stringutil.hpp"

View File

@ -1,42 +1,22 @@
project(vctest) project(vctest)
set(CMAKE_CXX_STANDARD 17) add_executable(vctest ${CMAKE_CURRENT_LIST_DIR}/main.cpp)
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) # Needed for header-only source util/ArgsReader.hpp
target_include_directories(vctest PRIVATE ${CMAKE_SOURCE_DIR}/src)
add_executable(${PROJECT_NAME} ${SOURCES}) target_compile_options(
vctest
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/W4>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:
-Wall
-Wextra
-Wformat-nonliteral
-Wcast-align
-Wpointer-arith
-Wundef
-Wwrite-strings
-Wno-unused-parameter
>)
if(MSVC) target_link_options(vctest PRIVATE $<$<CXX_COMPILER_ID:GNU>:-no-pie>)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE
Release
CACHE STRING "Build type" FORCE)
endif()
if((CMAKE_BUILD_TYPE EQUAL "Release") OR (CMAKE_BUILD_TYPE EQUAL
"RelWithDebInfo"))
set(CMAKE_MSVC_RUNTIME_LIBRARY
"MultiThreaded$<$<CONFIG:Release>:Release>")
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /MT /O2)
else()
target_compile_options(${PROJECT_NAME} PRIVATE /W4)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
target_compile_options(
${PROJECT_NAME}
PRIVATE -Wall
-Wextra
-Wformat-nonliteral
-Wcast-align
-Wpointer-arith
-Wundef
-Wwrite-strings
-Wno-unused-parameter)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
endif()
target_include_directories(
${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_DL_LIBS})