diff --git a/CMakeLists.txt b/CMakeLists.txt index c0bb271..72ff2e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,13 +183,18 @@ if(SEASTACK_ENABLE_CHRONO) " (or /usr/local/opt/libomp on Intel Homebrew).") endif() - # If Chrono set HDF5_DIR, retry the find + # If Chrono set HDF5_DIR to NOTFOUND (common when Chrono itself found HDF5 + # via module mode, not hdf5-config.cmake), clear it so later FindHDF5 + # module-mode discovery (e.g. Ubuntu libhdf5-dev) can succeed. if(NOT HDF5_FOUND AND DEFINED CACHE{HDF5_DIR}) if("${HDF5_DIR}" MATCHES "NOTFOUND") unset(HDF5_DIR CACHE) find_package(HDF5 CONFIG QUIET) endif() endif() + if(SEASTACK_ENABLE_HYDRO_IO AND NOT HDF5_FOUND) + find_package(HDF5 QUIET COMPONENTS CXX) + endif() # Use same C++ standard as Chrono for ABI compatibility if(DEFINED CHRONO_CXX_STANDARD) diff --git a/apps/seastack/gui/vsg_config.h b/apps/seastack/gui/vsg_config.h index bfe5bad..99d237d 100644 --- a/apps/seastack/gui/vsg_config.h +++ b/apps/seastack/gui/vsg_config.h @@ -25,14 +25,7 @@ inline constexpr int kColorVariationCycle = 8; inline constexpr float kWaterR = 0.01f; inline constexpr float kWaterG = 0.20f; inline constexpr float kWaterB = 0.35f; -// NOTE: Material opacity must stay at 1.0 on Linux. -// With opacity < 1.0, Chrono's wrapIfTransparent() wraps the runtime-added -// water node in vsg::DepthSorted (bin 10), which crashes the VSG renderer -// at vsg::Bin::add during the first record traversal. The animated water -// surface is added to the scene after pVis->Initialize(), bypassing the -// BindAll() compile path that built-in Chrono demos rely on. -// TODO: enable proper translucency via a runtime compile traversal. -inline constexpr float kWaterOpacity = 1.0f; +inline constexpr float kWaterOpacity = 0.55f; inline constexpr float kWaterSpecular = 0.6f; inline constexpr float kWaterRoughness = 0.05f; inline constexpr float kWaterMetallic = 0.0f; diff --git a/apps/seastack/gui/vsg_water_surface.cpp b/apps/seastack/gui/vsg_water_surface.cpp index 6c86e50..ecc097a 100644 --- a/apps/seastack/gui/vsg_water_surface.cpp +++ b/apps/seastack/gui/vsg_water_surface.cpp @@ -501,7 +501,7 @@ void AnimatedWaterSurface::InitializeWireframe() { // Faint blue-gray material. auto wire_material = ::chrono_types::make_shared<::chrono::ChVisualMaterial>(); wire_material->SetDiffuseColor(::chrono::ChColor(0.1f, 0.2f, 0.3f)); - wire_material->SetOpacity(1.0f); + wire_material->SetOpacity(0.35f); wire_material->SetRoughness(0.9f); wire_material->SetMetallic(0.0f); diff --git a/apps/seastack/single_run.cpp b/apps/seastack/single_run.cpp index 56d8918..3c3b36b 100644 --- a/apps/seastack/single_run.cpp +++ b/apps/seastack/single_run.cpp @@ -123,7 +123,7 @@ namespace { class HCParser : public ::chrono::parsers::ChParserMbsYAML { public: HCParser() : ChParserMbsYAML() {} - void SetScriptDir(const std::string& dir) { m_file_handler.SetReferenceDirectory(dir); } + void SetScriptDir(const std::string& dir) { m_script_directory = dir; } }; static std::shared_ptr<::chrono::ChBody> FindBodyByName(::chrono::ChSystem& system, diff --git a/scripts/unix/build.sh b/scripts/unix/build.sh index f0170f8..4cfbf31 100755 --- a/scripts/unix/build.sh +++ b/scripts/unix/build.sh @@ -318,14 +318,15 @@ else USE_VSG=0 fi +# HydroIO / HDF5: +# Do not force HydroIO OFF merely because build-config.json leaves HDF5Dir empty. +# On Ubuntu/Debian, libhdf5-dev is discovered by CMake FindHDF5 (module mode) +# without a config-mode HDF5_DIR. Passing -DHDF5_DIR is optional; Chrono's +# ChronoConfig may even set HDF5_DIR to NOTFOUND when it used module-mode HDF5. +# Only --no-hydro-io disables HydroIO here. If CMake cannot find HDF5, configure +# fails with a clear FindHDF5 error instead of a later missing-header failure. if [[ -z "${SEASTACK_HDF5_DIR:-}" && "${NO_HYDRO_IO}" -eq 0 ]]; then - echo " [WARN] HDF5 not found; HydroIO will be disabled." >&2 - if [[ "${USE_CHRONO}" -eq 1 ]]; then - echo " If Chrono was built without HDF5, set HDF5Dir in build-config.json." >&2 - else - echo " For Chrono-free builds, set HDF5Dir or use --no-hydro-io." >&2 - fi - NO_HYDRO_IO=1 + echo " [INFO] HDF5Dir unset; HydroIO left ON for CMake HDF5 discovery (module/config)." >&2 fi if [[ "${MOORDYN}" -eq 1 && ! -f "${REPO_ROOT}/extern/MoorDyn/CMakeLists.txt" ]]; then