Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,35 @@ jobs:
cxx: g++-14
build_type: Release
sanitizer: normal
warnings_as_errors: OFF
cmake_flags: ""
- name: gcc-16-normal
cc: gcc-16
cxx: g++-16
build_type: Release
sanitizer: normal
warnings_as_errors: ON
cmake_flags: ""
- name: clang-23-asan
cc: clang-23
cxx: clang++-23
build_type: RelWithDebInfo
sanitizer: asan
warnings_as_errors: ON
cmake_flags: -DALP_ENABLE_ADDRESS_SANITIZER=ON
- name: clang-23-tsan
cc: clang-23
cxx: clang++-23
build_type: RelWithDebInfo
sanitizer: tsan
warnings_as_errors: ON
cmake_flags: -DALP_ENABLE_THREAD_SANITIZER=ON
- name: clang-23-unity
cc: clang-23
cxx: clang++-23
build_type: Release
sanitizer: normal
warnings_as_errors: ON
cmake_flags: -DALP_ENABLE_UNITY_BUILD=ON

steps:
Expand Down Expand Up @@ -82,6 +93,13 @@ jobs:
sudo /tmp/llvm.sh 23
sudo apt-get install -y --no-install-recommends libclang-rt-23-dev

- name: Install GCC ${{ matrix.cxx }}
if: matrix.cxx == 'g++-16'
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y --no-install-recommends ${{ matrix.cc }} ${{ matrix.cxx }}

- name: Restore installed CMake dependencies
id: cmake_dependency_cache
uses: actions/cache/restore@v4
Expand Down Expand Up @@ -122,6 +140,7 @@ jobs:
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }}
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DALP_WARNINGS_AS_ERRORS=${{ matrix.warnings_as_errors }}
${{ matrix.cmake_flags }}

- name: Save installed CMake dependencies
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ option(ALP_ENABLE_THREAD_SANITIZER "Compile with ThreadSanitizer enabled" OFF)
option(ALP_ENABLE_ADDRESS_SANITIZER "Compile with AddressSanitizer enabled" OFF)
option(ALP_ENABLE_OVERVIEW_READING "Enable GDAL overview reading (broken with newer GDAL versions)" OFF)
option(ALP_ENABLE_UNITY_BUILD "Enable unity (jumbo) builds to speed compilation" OFF)
option(ALP_WARNINGS_AS_ERRORS "Treat first-party compiler warnings as errors" OFF)

set(ALP_ENABLE_ASSERTS_DEFAULT OFF)
if(CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$")
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ find_package(CGAL REQUIRED)
include(../cmake/SetupOpenCV.cmake)
alp_setup_opencv(4.11.0)

alp_add_git_repository(cgltf URL https://github.com/jkuhlmann/cgltf COMMITISH 7331a5adf4b0fde15f0e682a5803e4f17137e0ad DO_NOT_ADD_SUBPROJECT)
alp_add_git_repository(cgltf URL https://github.com/AlpineMapsOrgDependencies/cgltf.git COMMITISH e035b820ccde6ab20451b612d8033c9b76ea0ce4 DO_NOT_ADD_SUBPROJECT)
add_library(cgltf INTERFACE)
target_include_directories(cgltf SYSTEM INTERFACE ${cgltf_SOURCE_DIR})

Expand All @@ -42,7 +42,7 @@ target_include_directories(tl_expected SYSTEM INTERFACE ${tl_expected_SOURCE_DIR
set(SPDLOG_FMT_EXTERNAL ON CACHE BOOL "SPDLOG_FMT_EXTERNAL" FORCE)
alp_add_git_repository(spdlog URL https://github.com/gabime/spdlog.git COMMITISH v1.17.0)

alp_add_git_repository(zpp_bits URL https://github.com/eyalz800/zpp_bits.git COMMITISH v4.7.2 DO_NOT_ADD_SUBPROJECT)
alp_add_git_repository(zpp_bits URL https://github.com/eyalz800/zpp_bits.git COMMITISH v4.7.3 DO_NOT_ADD_SUBPROJECT)
add_library(zpp_bits INTERFACE)
target_include_directories(zpp_bits SYSTEM INTERFACE ${zpp_bits_SOURCE_DIR})

Expand Down
2 changes: 1 addition & 1 deletion src/sf_browser/core/window/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
std::atomic<bool> Window::glfw_initialized(false);
std::atomic<size_t> Window::window_instances(0);

Window::Window(WindowConfig config) : m_width(config.width), m_height(config.height), m_title(config.title), m_msaa_samples(config.msaa_samples) {
Window::Window(WindowConfig config) : m_width(config.width), m_height(config.height), m_title(config.title) /*, m_msaa_samples(config.msaa_samples)*/ {
update_window_count(1);

const auto [gl_major_version, gl_minor_version] = config.opengl_version;
Expand Down
2 changes: 1 addition & 1 deletion src/sf_browser/core/window/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Window {

int m_width, m_height, m_max_dimension, m_min_dimension;
std::string m_title;
int m_msaa_samples;
// int m_msaa_samples;

GLFWwindow* m_handle;

Expand Down
4 changes: 2 additions & 2 deletions src/sf_merger/merge/NodeData.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class NodeData {

// Status::Leaf or Status::Inner guarantuess a node is present
template <octree::NodeStatusOrMissing S = Status>
std::enable_if_t<S == octree::NodeStatus::Leaf || S == octree::NodeStatus::Inner, const SimpleMesh &>
std::enable_if_t<S == octree::NodeStatusOrMissing::Leaf || S == octree::NodeStatusOrMissing::Inner, const SimpleMesh &>
mesh() const {
auto mesh = this->load_mesh();
if (mesh.has_value()) {
Expand All @@ -39,7 +39,7 @@ class NodeData {

// Status::Missing and Status::Virtual do not exist on disk, but may be the child of a leaf or inner node
template <octree::NodeStatusOrMissing S = Status>
std::enable_if_t<S == octree::NodeStatusOrMissing::Missing || S == octree::NodeStatus::Virtual, std::optional<std::reference_wrapper<SimpleMesh>>>
std::enable_if_t<S == octree::NodeStatusOrMissing::Missing || S == octree::NodeStatusOrMissing::Virtual, std::optional<std::reference_wrapper<SimpleMesh>>>
mesh() const {
return this->load_mesh();
}
Expand Down
6 changes: 6 additions & 0 deletions src/terrainlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ target_compile_features(terrainlib PUBLIC cxx_std_23)
target_compile_definitions(terrainlib PUBLIC SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE)
target_include_directories(terrainlib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_precompile_headers(terrainlib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/pch.h)
if(ALP_WARNINGS_AS_ERRORS)
target_compile_options(terrainlib PUBLIC
$<$<COMPILE_LANG_AND_ID:CXX,GNU,Clang,AppleClang>:-Werror>
$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/WX>
)
endif()
target_link_libraries(terrainlib PUBLIC
radix
ZLIB::ZLIB
Expand Down
6 changes: 3 additions & 3 deletions src/terrainlib/Dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ void GdalDatasetDeleter::operator()(GDALDataset *dataset) const {

std::optional<Dataset> Dataset::open_raster(std::filesystem::path path) {
if (GDALDataset *dataset = open_gdal_dataset(path, GDAL_OF_RASTER)) {
return std::optional<Dataset>(std::move(Dataset(path, dataset)));
return std::optional<Dataset>(Dataset(path, dataset));
}
LOG_ERROR("Couldn't open raster dataset {}.\n", path);
return std::nullopt;
}
std::optional<Dataset> Dataset::open_vector(std::filesystem::path path) {
if (GDALDataset *dataset = open_gdal_dataset(path, GDAL_OF_VECTOR)) {
return std::optional<Dataset>(std::move(Dataset(path, dataset)));
return std::optional<Dataset>(Dataset(path, dataset));
}
LOG_ERROR("Couldn't open vector dataset {}.\n", path);
return std::nullopt;
}
std::optional<std::shared_ptr<Dataset>> Dataset::open_shared_raster(std::filesystem::path path) {
if (GDALDataset *dataset = open_gdal_dataset(path, GDAL_OF_RASTER)) {
return std::make_shared<Dataset>(std::move(Dataset(path, dataset)));
return std::make_shared<Dataset>(Dataset(path, dataset));
}
LOG_ERROR("Couldn't open shared raster dataset {}.\n", path);
return std::nullopt;
Expand Down
20 changes: 4 additions & 16 deletions src/terrainlib/mesh/io/gltf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@ using namespace mesh::io::utils;
namespace mesh::io::gltf {

namespace {
const int GL_NEAREST = 0x2600;
const int GL_LINEAR = 0x2601;
const int GL_NEAREST_MIPMAP_NEAREST = 0x2700;
const int GL_LINEAR_MIPMAP_NEAREST = 0x2701;
const int GL_NEAREST_MIPMAP_LINEAR = 0x2702;
const int GL_LINEAR_MIPMAP_LINEAR = 0x2703;
const int GL_TEXTURE_MAG_FILTER = 0x2800;
const int GL_TEXTURE_MIN_FILTER = 0x2801;
const int GL_REPEAT = 0x2901;
const int GL_CLAMP_TO_EDGE = 0x812F;
const int GL_MIRRORED_REPEAT = 0x8370;

cgltf_attribute *find_attribute_with_type(cgltf_attribute *attributes, size_t attribute_count, cgltf_attribute_type type) {
for (unsigned int i = 0; i < attribute_count; i++) {
cgltf_attribute *attribute = &attributes[i];
Expand Down Expand Up @@ -575,10 +563,10 @@ tl::expected<void, SaveMeshError> save_to_path(

std::array<cgltf_sampler, 1> samplers;
cgltf_sampler &sampler = samplers[0] = {};
sampler.min_filter = GL_LINEAR_MIPMAP_LINEAR;
sampler.mag_filter = GL_LINEAR;
sampler.wrap_s = GL_CLAMP_TO_EDGE;
sampler.wrap_t = GL_CLAMP_TO_EDGE;
sampler.min_filter = cgltf_filter_type_linear_mipmap_linear;
sampler.mag_filter = cgltf_filter_type_linear;
sampler.wrap_s = cgltf_wrap_mode_clamp_to_edge;
sampler.wrap_t = cgltf_wrap_mode_clamp_to_edge;

std::array<cgltf_texture, 1> textures;
cgltf_texture &texture = textures[0] = {};
Expand Down
1 change: 1 addition & 0 deletions src/terrainlib/mesh/topology.inl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ inline constexpr glm::uvec3 change_vertex(const glm::uvec3 &triangle, const uint
} else if (!allow_missing) {
UNREACHABLE();
}
return triangle;
}

inline constexpr void flip_triangle_orientation(glm::uvec3 &triangle) {
Expand Down
36 changes: 18 additions & 18 deletions src/terrainlib/mesh/validate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,29 @@

namespace mesh {
namespace {
inline constexpr double EPSILON = 1e-12;
// inline constexpr double EPSILON = 1e-12;

constexpr bool has_flag(const ValidationFlags set, const ValidationFlags flag) noexcept {
return (set & flag) != ValidationFlags::None;
}

inline bool has_duplicate_faces(const std::span<const glm::uvec3> triangles, const bool ignore_orientation = true) {
std::unordered_map<glm::uvec3, uint32_t> counts;
counts.reserve(triangles.size());

for (const glm::uvec3 &triangle : triangles) {
const glm::uvec3 normalized = normalize_triangle(triangle, !ignore_orientation);
counts[normalized] += 1;
}

for (const auto &[_triangle, count] : counts) {
if (count > 1) {
return true;
}
}

return false;
}
// inline bool has_duplicate_faces(const std::span<const glm::uvec3> triangles, const bool ignore_orientation = true) {
// std::unordered_map<glm::uvec3, uint32_t> counts;
// counts.reserve(triangles.size());
//
// for (const glm::uvec3 &triangle : triangles) {
// const glm::uvec3 normalized = normalize_triangle(triangle, !ignore_orientation);
// counts[normalized] += 1;
// }
//
// for (const auto &[_triangle, count] : counts) {
// if (count > 1) {
// return true;
// }
// }
//
// return false;
// }

template <glm::length_t n_dims, typename T>
void validate_impl_basic(const mesh::View_<n_dims, T> &mesh) {
Expand Down
2 changes: 1 addition & 1 deletion src/terrainlib/octree/storage/open.inl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Storage_<T, Codec> open_folder(
LOG_WARN("Unable to determine layout of dataset, using layout strategy {} and extension {}",
disk::layout::StrategyRegister::instance().get_id(*default_layout_strategy),
default_extension_with_dot);
layout_info_opt = std::move(octree::helpers::LayoutWithoutBase(std::move(default_layout_strategy), default_extension_with_dot));
layout_info_opt = octree::helpers::LayoutWithoutBase(std::move(default_layout_strategy), default_extension_with_dot);
}

disk::Layout layout(base_path, std::move(layout_info_opt->strategy), layout_info_opt->extension_with_dot);
Expand Down
8 changes: 4 additions & 4 deletions src/terrainlib/uv/unwrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,25 +139,25 @@ tl::expected<CgalUvMap, UnwrapError> parameterize_mesh(cgal::Mesh &mesh, Algorit
if (algorithm == Algorithm::TutteBarycentricMapping) {
if (border == Border::Circle) {
result = CGAL::Surface_mesh_parameterization::parameterize(mesh, TutteBarycentricMappingParameterizerCircularBorder(), bhd, uv_map);
} else if (border == Border::Square) {
} else {
result = CGAL::Surface_mesh_parameterization::parameterize(mesh, TutteBarycentricMappingParameterizerSquareBorder(), bhd, uv_map);
}
} else if (algorithm == Algorithm::DiscreteAuthalic) {
if (border == Border::Circle) {
result = CGAL::Surface_mesh_parameterization::parameterize(mesh, DiscreteAuthalicParameterizerCircularBorder(), bhd, uv_map);
} else if (border == Border::Square) {
} else {
result = CGAL::Surface_mesh_parameterization::parameterize(mesh, DiscreteAuthalicParameterizerSquareBorder(), bhd, uv_map);
}
} else if (algorithm == Algorithm::DiscreteConformalMap) {
if (border == Border::Circle) {
result = CGAL::Surface_mesh_parameterization::parameterize(mesh, DiscreteConformalMapParameterizerCircularBorder(), bhd, uv_map);
} else if (border == Border::Square) {
} else {
result = CGAL::Surface_mesh_parameterization::parameterize(mesh, DiscreteConformalMapParameterizerSquareBorder(), bhd, uv_map);
}
} else if (algorithm == Algorithm::FloaterMeanValueCoordinates) {
if (border == Border::Circle) {
result = CGAL::Surface_mesh_parameterization::parameterize(mesh, FloaterMeanValueCoordinatesParameterizerCircularBorder(), bhd, uv_map);
} else if (border == Border::Square) {
} else {
result = CGAL::Surface_mesh_parameterization::parameterize(mesh, FloaterMeanValueCoordinatesParameterizerSquareBorder(), bhd, uv_map);
}
} else if (algorithm == Algorithm::LeastSquaresConformalMap) {
Expand Down
5 changes: 3 additions & 2 deletions unittests/terrainlib/fixed_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ TEST_CASE("FixedVector copy constructor and assignment") {
REQUIRE(assign_vec.size() == vec.size());
CHECK(assign_vec[2] == 3);

// Self-assignment
vec = vec;
// Exercise self-assignment through an alias to avoid Clang's syntactic self-assignment warning.
const auto *self = &vec;
vec = *self;
CHECK(vec.size() == 3);
}

Expand Down
Loading