From f8f631a647c7f989743ac51010391fcd915dc27c Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Sun, 25 Aug 2024 16:06:08 -0700 Subject: [PATCH 01/19] Update badges to point to gz-rendering9 branch (#1044) Signed-off-by: Ian Chen --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 92506a21f..184ba3c80 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,10 @@ Build | Status -- | -- -Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-rendering/branch/main/graph/badge.svg)](https://codecov.io/gh/gazebosim/gz-rendering/branch/main) -Ubuntu Noble | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_rendering-ci-main-noble-amd64)](https://build.osrfoundation.org/job/gz_rendering-ci-main-noble-amd64) -Homebrew | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_rendering-ci-main-homebrew-amd64)](https://build.osrfoundation.org/job/gz_rendering-ci-main-homebrew-amd64) -Windows | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_rendering-main-win)](https://build.osrfoundation.org/job/gz_rendering-main-win) +Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-rendering/tree/gz-rendering9/graph/badge.svg)](https://codecov.io/gh/gazebosim/gz-rendering/tree/gz-rendering9) +Ubuntu Noble | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_rendering-ci-gz-rendering9-noble-amd64)](https://build.osrfoundation.org/job/gz_rendering-ci-gz-rendering9-noble-amd64) +Homebrew | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_rendering-ci-gz-rendering9-homebrew-amd64)](https://build.osrfoundation.org/job/gz_rendering-ci-gz-rendering9-homebrew-amd64) +Windows | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_rendering-9-win)](https://build.osrfoundation.org/job/gz_rendering-9-win) Gazebo Rendering is a C++ library designed to provide an abstraction for different rendering engines. It offers unified APIs for creating From 77ef27d2e02529ba07ec737e53539ae014b887a6 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Tue, 27 Aug 2024 18:00:38 -0700 Subject: [PATCH 02/19] Prepare for gz-rendering9.0.0~pre1 release (#1045) Signed-off-by: Ian Chen --- CMakeLists.txt | 2 +- Changelog.md | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96ce89131..527f913c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ set(GZ_CMAKE_VER ${gz-cmake4_VERSION_MAJOR}) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -gz_configure_project(VERSION_SUFFIX) +gz_configure_project(VERSION_SUFFIX pre1) #============================================================================ # Set project-specific options diff --git a/Changelog.md b/Changelog.md index e6028e429..10a6d5368 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,14 @@ ### Gazebo Rendering 9.0.0 (2024-09-XX) +1. **Baseline:** this includes all changes from 8.2.0 and earlier. + +1. Update badges to point to gz-rendering9 branch + * [Pull request #1044](https://github.com/gazebosim/gz-rendering/pull/1044) + +1. Ionic Changelog + * [Pull request #1042](https://github.com/gazebosim/gz-rendering/pull/1042) + 1. Remove gl preference in cmake * [Pull request #1041](https://github.com/gazebosim/gz-rendering/pull/1041) From 22e05d50d1b3809e5f2ca4d70a206b5598e7fe21 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Wed, 28 Aug 2024 18:41:51 -0700 Subject: [PATCH 03/19] Prepare for gz-rendering9.0.0~pre2 release (#1046) Signed-off-by: Ian Chen --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 527f913c7..af46cc743 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ set(GZ_CMAKE_VER ${gz-cmake4_VERSION_MAJOR}) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -gz_configure_project(VERSION_SUFFIX pre1) +gz_configure_project(VERSION_SUFFIX pre2) #============================================================================ # Set project-specific options From 613673587b1cec920f89cec4ea92223aaac7ace5 Mon Sep 17 00:00:00 2001 From: Antoine Van Malleghem Date: Mon, 2 Sep 2024 16:14:33 +0200 Subject: [PATCH 04/19] Fix readme issues (#1051) Signed-off-by: Van Malleghem Antoine --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 184ba3c80..3e4c28e44 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,9 @@ of libraries designed to rapidly develop robot applications. [Folder Structure](#folder-structure) -[Code of Conduct](#code-of-conduct) +[Contributing](#contributing) -[Contributing](#code-of-contributing) +[Code of Conduct](#code-of-conduct) [Versioning](#versioning) @@ -80,8 +80,8 @@ Rendering engine plugin implementation code is stored in their own folders # Contributing -Please see -[CONTRIBUTING.md](https://gazebosim.org/docs/all/contributing). +Please see the +[contribution guide](https://gazebosim.org/docs/all/contributing). # Code of Conduct From 3ba2f1e056381b82679269f2a73cd1efd6301f1f Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Tue, 3 Sep 2024 11:29:51 -0500 Subject: [PATCH 05/19] Add Github Action for Windows and fix build (#1049) Signed-off-by: Addisu Z. Taddese --- .github/workflows/windows.yaml | 48 ++++++++++++++++++++++++++++++++++ ogre2/src/Ogre2Scene.cc | 8 ++++-- 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/windows.yaml diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml new file mode 100644 index 000000000..e3ed647a9 --- /dev/null +++ b/.github/workflows/windows.yaml @@ -0,0 +1,48 @@ +name: Windows +on: + pull_request: + +jobs: + build: + name: Window CI + env: + PACKAGE: gz-rendering9 + runs-on: windows-latest + steps: + - name: setup-pixi + uses: prefix-dev/setup-pixi@v0.8.1 + with: + run-install: false + + - name: Install build tools + run: | + pixi init + pixi add vcstool colcon-common-extensions pkgconfig + - name: Setup pixi env variables + shell: bash + run: | + eval "$(pixi shell-hook)" + echo CMAKE_PREFIX_PATH=$CONDA_PREFIX/Library >> $GITHUB_ENV + - name: Install base dependencies + run: | + # List adapted from https://github.com/gazebo-tooling/release-tools/blob/f89ac8cafc646260598eb8eb6d94be8093bdc9f7/jenkins-scripts/lib/windows_env_vars.bat#L22 + pixi add assimp dlfcn-win32 eigen ffmpeg freeimage gdal gflags ogre ogre-next spdlog tinyxml2 + - name: Clone source dependencies + run: | + mkdir src + cd src + pixi run vcs import --input https://raw.githubusercontent.com/gazebo-tooling/gazebodistro/master/${env:PACKAGE}.yaml + + - uses: actions/checkout@v4 + with: + path: src/gz-rendering + + - name: Build Dependencies + run: | + pixi run colcon build --merge-install --cmake-args -G"Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF --event-handlers console_direct+ --packages-up-to ${env:PACKAGE} + + - name: Build Package + run: pixi run colcon build --merge-install --cmake-args -G"Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DSKIP_ogre=ON --event-handlers console_direct+ --packages-select ${env:PACKAGE} + + - name: Test + run: pixi run colcon test --merge-install --event-handlers console_direct+ --packages-select ${env:PACKAGE} diff --git a/ogre2/src/Ogre2Scene.cc b/ogre2/src/Ogre2Scene.cc index d7bc1ff91..2d164e235 100644 --- a/ogre2/src/Ogre2Scene.cc +++ b/ogre2/src/Ogre2Scene.cc @@ -20,10 +20,14 @@ #include #include #else -#ifndef _WIN32 + #ifdef _WIN32 + // windows.h has to be included *before* GL/gl.h + // to avoid redefinition errors. + #include + #endif + #include #endif -#endif #include From 6ec0c520f28a61b9505ada49d21adcf92e31b291 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Thu, 5 Sep 2024 10:59:40 -0700 Subject: [PATCH 06/19] Fix using lightmap and emissive map together (#1047) Signed-off-by: Ian Chen --- ogre2/src/Ogre2Material.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/ogre2/src/Ogre2Material.cc b/ogre2/src/Ogre2Material.cc index 70cc66959..95db59a1c 100644 --- a/ogre2/src/Ogre2Material.cc +++ b/ogre2/src/Ogre2Material.cc @@ -753,14 +753,10 @@ void Ogre2Material::SetLightMap(const std::string &_name, this->dataPtr->lightMapData = _img; this->lightMapUvSet = _uvSet; - // in gz-rendering5 + ogre 2.1, we reserved detail map 0 for light map - // and set a blend mode (PBSM_BLEND_OVERLAY AND PBSM_BLEND_MULTIPLY2X - // produces better results) to blend with base albedo map. However, this - // creates unwanted red highlights with ogre 2.2. So switching to use the - // emissive map slot and calling setUseEmissiveAsLightmap(true) - // Ogre::PbsTextureTypes type = Ogre::PBSM_DETAIL0; - // this->ogreDatablock->setDetailMapBlendMode(0, Ogre::PBSM_BLEND_OVERLAY); - Ogre::PbsTextureTypes type = Ogre::PBSM_EMISSIVE; + // Apply lightmap by using the detail map slot to store the lightmap texture + // and blending it with the diffuse map. + Ogre::PbsTextureTypes type = Ogre::PBSM_DETAIL0; + this->ogreDatablock->setDetailMapBlendMode(0, Ogre::PBSM_BLEND_OVERLAY); // lightmap usually uses a different tex coord set if (_img == nullptr) @@ -768,7 +764,6 @@ void Ogre2Material::SetLightMap(const std::string &_name, else this->SetTextureMapDataImpl(this->lightMapName, _img, type); this->ogreDatablock->setTextureUvSource(type, this->lightMapUvSet); - this->ogreDatablock->setUseEmissiveAsLightmap(true); } ////////////////////////////////////////////////// From 12b6a153b956cba3c9faffaa59e914417296ca1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Fri, 6 Sep 2024 19:06:51 +0200 Subject: [PATCH 07/19] Use gz-rendering9 in links and lux_core_engine example (#1053) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero --- examples/lux_core_engine/CMakeLists.txt | 2 +- tutorials/03_rendering_plugins.md | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/lux_core_engine/CMakeLists.txt b/examples/lux_core_engine/CMakeLists.txt index 007ca5347..2f19c3bb2 100644 --- a/examples/lux_core_engine/CMakeLists.txt +++ b/examples/lux_core_engine/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) set(GZ_PLUGIN_VER 2) set(GZ_COMMON_VER 5) -find_package(gz-rendering7 REQUIRED) +find_package(gz-rendering9 REQUIRED) find_package(gz-plugin3 REQUIRED COMPONENTS all) if (NOT DEFINED ENV{LUXCORE_SDK_PATH}) diff --git a/tutorials/03_rendering_plugins.md b/tutorials/03_rendering_plugins.md index bc0527fed..16246e5eb 100644 --- a/tutorials/03_rendering_plugins.md +++ b/tutorials/03_rendering_plugins.md @@ -11,18 +11,18 @@ It is also possible to integrate your own selected rendering engine by writing a #### How to Write Your Own Rendering Engine Plugin -A mocked example of a custom rendering engine plugin can be found [here](https://github.com/gazebosim/gz-rendering/tree/gz-rendering7/examples/hello_world_plugin). In order +A mocked example of a custom rendering engine plugin can be found [here](https://github.com/gazebosim/gz-rendering/tree/gz-rendering9/examples/hello_world_plugin). In order to make your own custom rendering engine, this example is a good starting point. There are a few key things which will need to be done in order for a custom rendering engine to function: - * A singleton Render Engine class which implements the pure virtual functions in [`gz::rendering::BaseRenderEngine`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/include/gz/rendering/base/BaseRenderEngine.hh). - * A plugin class which implements the pure virtual functions in [`gz::rendering::RenderEnginePlugin`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/include/gz/rendering/RenderEnginePlugin.hh) - * Registering the plugin, this line can be seen at the bottom of the [`HelloWorldPlugin`](https://github.com/gazebosim/gz-rendering/tree/gz-rendering7/examples/hello_world_plugin/HelloWorldPlugin.cc) example + * A singleton Render Engine class which implements the pure virtual functions in [`gz::rendering::BaseRenderEngine`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/include/gz/rendering/base/BaseRenderEngine.hh). + * A plugin class which implements the pure virtual functions in [`gz::rendering::RenderEnginePlugin`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/include/gz/rendering/RenderEnginePlugin.hh) + * Registering the plugin, this line can be seen at the bottom of the [`HelloWorldPlugin`](https://github.com/gazebosim/gz-rendering/tree/gz-rendering9/examples/hello_world_plugin/HelloWorldPlugin.cc) example -Finally, for your custom rendering engine to actually have any functionality and at minimum, display something in a window, you will need to implement your own `Scene` and `Camera` classes, which inherit from and implement the pure virtual functions of [`gz::rendering::Scene`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/include/gz/rendering/Scene.hh) and [`gz::rendering::Camera`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/include/gz/rendering/Camera.hh), respectively. The mocked example simply returns `nullptr` for its `CreateSceneImpl(...)` function, so it may be useful to look at the current `Scene` implementations for the other rendering engines within `gz::rendering` such as [`OGRE`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/ogre/src/OgreScene.cc) or [`OGRE2`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/ogre2/src/Ogre2Scene.cc). Likewise, it may be helpful to look at the `Camera` implementations from [`OGRE`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/ogre/src/OgreCamera.cc) and [`OGRE2`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/ogre2/src/Ogre2Camera.cc) +Finally, for your custom rendering engine to actually have any functionality and at minimum, display something in a window, you will need to implement your own `Scene` and `Camera` classes, which inherit from and implement the pure virtual functions of [`gz::rendering::Scene`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/include/gz/rendering/Scene.hh) and [`gz::rendering::Camera`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/include/gz/rendering/Camera.hh), respectively. The mocked example simply returns `nullptr` for its `CreateSceneImpl(...)` function, so it may be useful to look at the current `Scene` implementations for the other rendering engines within `gz::rendering` such as [`OGRE`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/ogre/src/OgreScene.cc) or [`OGRE2`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/ogre2/src/Ogre2Scene.cc). Likewise, it may be helpful to look at the `Camera` implementations from [`OGRE`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/ogre/src/OgreCamera.cc) and [`OGRE2`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/ogre2/src/Ogre2Camera.cc) #### Building and Running Your Rendering Engine Plugin with Gazebo -Once you have your own rendering plugin written, you can build it similarly to how the example is built. It may be helpful to look at the [`CMakeLists.txt`](https://github.com/gazebosim/gz-rendering/tree/gz-rendering7/examples/hello_world_plugin) from the example as it contains the boilerplate code needed to get a custom rendering engine plugin built. +Once you have your own rendering plugin written, you can build it similarly to how the example is built. It may be helpful to look at the [`CMakeLists.txt`](https://github.com/gazebosim/gz-rendering/tree/gz-rendering9/examples/hello_world_plugin) from the example as it contains the boilerplate code needed to get a custom rendering engine plugin built. After you have your plugin built, you will need to set the `GZ_SIM_RENDER_ENGINE_PATH` environment variable to the path in which your built shared library resides. Note that you will need to do this for every command line instance unless you add the line to your startup shell script (`.bashrc`, `.zshrc`, etc.). From 3ee62e1aae6ce9dc984f894107e92bf04403878c Mon Sep 17 00:00:00 2001 From: Antoine Van Malleghem Date: Mon, 9 Sep 2024 10:10:27 +0200 Subject: [PATCH 08/19] fix prerequisites (#1054) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Van Malleghem Antoine Signed-off-by: Antoine Van Malleghem Co-authored-by: Alejandro Hernández Cordero --- tutorials/23_depth_camera_tutorial.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tutorials/23_depth_camera_tutorial.md b/tutorials/23_depth_camera_tutorial.md index a1204ec9b..40712202c 100644 --- a/tutorials/23_depth_camera_tutorial.md +++ b/tutorials/23_depth_camera_tutorial.md @@ -2,6 +2,14 @@ This example shows how to use the depth camera. +## Install prerequisites + +In order to compile this tutorial, you need to install some prerequisites : + +```bash +sudo apt-get install build-essential freeglut3-dev libglew-dev +``` + ## Compile and run the example Clone the source code, create a build directory and use `cmake` and `make` to compile the code: From 03060baea878b3d4aa9ad8232fa9949bcdb6ced6 Mon Sep 17 00:00:00 2001 From: Antoine Van Malleghem Date: Fri, 13 Sep 2024 20:44:36 +0200 Subject: [PATCH 09/19] Fix install tutorial (#1055) Signed-off-by: Van Malleghem Antoine --- tutorials/02_install.md | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/tutorials/02_install.md b/tutorials/02_install.md index cd8ffed3e..72b1f990e 100644 --- a/tutorials/02_install.md +++ b/tutorials/02_install.md @@ -135,11 +135,9 @@ sdk 4.0.2, comment out lines 167-206). # Windows -On Windows, only OGRE 1 is currently supported. +## Install Prerequisites -## Prerequisites - -First, follow the [gz-cmake](https://github.com/gazebosim/gz-cmake) tutorial for installing Conda, Visual Studio, CMake, and other prerequisites, and also for creating a Conda environment. +First, follow the [source installation](https://gazebosim.org/docs/ionic/install_windows_src/) tutorial until step 5 included for installing Conda, Visual Studio, CMake, etc., prerequisites, and creating a Conda environment. Navigate to ``condabin`` if necessary to use the ``conda`` command (i.e., if Conda is not in your `PATH` environment variable. You can find the location of ``condabin`` in Anaconda Prompt, ``where conda``). @@ -160,14 +158,9 @@ which version you need. ## Source Installation -This assumes you have created and activated a Conda environment while installing the Prerequisites. - -1. Install dependencies: - ``` - conda install ogre --channel conda-forge - ``` +This assumes you have created and activated a Conda environment while [installing the Prerequisites](#install-prerequisites). -2. Install Gazebo dependencies: +1. Install Gazebo dependencies: You can view available versions and their dependencies: ``` @@ -179,13 +172,13 @@ This assumes you have created and activated a Conda environment while installing conda install libgz-cmake<#> libgz-common<#> libgz-math<#> libgz-plugin<#> --channel conda-forge ``` -3. Navigate to where you would like to build the library, and clone the repository. +2. Navigate to where you would like to build the library, and clone the repository. ``` # Optionally, append `-b gz-rendering#` (replace # with a number) to check out a specific version git clone https://github.com/gazebosim/gz-rendering.git ``` -4. Configure and build +3. Configure and build ``` cd gz-rendering mkdir build @@ -194,7 +187,7 @@ This assumes you have created and activated a Conda environment while installing cmake --build . --config Release ``` -5. Optionally, install +4. Optionally, install ``` cmake --install . --config Release ``` From 9c9934f68d04cc75fe6d5c17774159e49acd9f85 Mon Sep 17 00:00:00 2001 From: Martin Pecka Date: Mon, 16 Sep 2024 10:31:03 +0200 Subject: [PATCH 10/19] examples/heightmap: Fixed Windows build (#1062) Signed-off-by: Martin Pecka --- examples/heightmap/CMakeLists.txt | 4 +++- examples/heightmap/Main.cc | 7 +++++++ tutorials/21_heightmap.md | 11 +++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/examples/heightmap/CMakeLists.txt b/examples/heightmap/CMakeLists.txt index c40dd33f8..c20213ff2 100644 --- a/examples/heightmap/CMakeLists.txt +++ b/examples/heightmap/CMakeLists.txt @@ -20,7 +20,9 @@ if (NOT APPLE) link_directories(${GLEW_LIBRARY_DIRS}) endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") +if(NOT MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") +endif() configure_file (example_config.hh.in ${PROJECT_BINARY_DIR}/example_config.hh) diff --git a/examples/heightmap/Main.cc b/examples/heightmap/Main.cc index 82db73326..32ea61ea4 100644 --- a/examples/heightmap/Main.cc +++ b/examples/heightmap/Main.cc @@ -22,6 +22,8 @@ #include #include #include +#else + #include #endif #include @@ -39,8 +41,13 @@ using namespace gz; using namespace rendering; +#if not defined(_WIN32) const std::string RESOURCE_PATH = common::joinPaths(std::string(PROJECT_BINARY_PATH), "media"); +#else +const std::string RESOURCE_PATH = + common::joinPaths(std::string(PROJECT_BINARY_PATH), "..", "media"); +#endif ////////////////////////////////////////////////// void createImageHeightmaps(const ScenePtr _scene, VisualPtr _root) diff --git a/tutorials/21_heightmap.md b/tutorials/21_heightmap.md index 93b24fd5f..894ed4d49 100644 --- a/tutorials/21_heightmap.md +++ b/tutorials/21_heightmap.md @@ -6,7 +6,7 @@ It loads 2 different heightmaps (image and Digital Elevation Model (DEM)) with d ## Compile and run the example -Clone the source code, create a build directory and use `cmake` and `make` to compile the code: +Clone the source code, create a build directory and use `cmake` to compile the code: ```{.sh} git clone https://github.com/gazebosim/gz-rendering @@ -14,12 +14,19 @@ cd gz-rendering/examples/heightmap mkdir build cd build cmake .. -make +# Linux +cmake --build . +# Windows +cmake --build . --config Release ``` Example 1 (image heightmap): ```{.sh} +# Linux ./heightmap + +# Windows +.\Release\heightmap.exe ``` You'll see: From ca37cf0c87ba1168ee85b4a5f0e3ddcf916be718 Mon Sep 17 00:00:00 2001 From: Martin Pecka Date: Mon, 16 Sep 2024 15:21:14 +0200 Subject: [PATCH 11/19] 18_simple_demo_tutorial: Add Windows instructions (#1061) Signed-off-by: Martin Pecka --- tutorials/18_simple_demo_tutorial.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tutorials/18_simple_demo_tutorial.md b/tutorials/18_simple_demo_tutorial.md index cf212cd8a..7fb573503 100644 --- a/tutorials/18_simple_demo_tutorial.md +++ b/tutorials/18_simple_demo_tutorial.md @@ -12,12 +12,19 @@ cd gz-rendering/examples/simple_demo mkdir build cd build cmake .. -make +# Linux +cmake --build . +# Windows +cmake --build . --config Release ``` Execute the example: ```{.sh} +# Linux ./simple_demo + +# Windows +.\Release\simple_demo ``` You'll see: From 6cf203d2285d31e27ff36b0e2ff54c9817a434d6 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Mon, 16 Sep 2024 13:21:48 -0700 Subject: [PATCH 12/19] Update homebrew install instruction (#1064) Signed-off-by: Ian Chen --- tutorials/02_install.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tutorials/02_install.md b/tutorials/02_install.md index 72b1f990e..a23046e4d 100644 --- a/tutorials/02_install.md +++ b/tutorials/02_install.md @@ -196,9 +196,11 @@ This assumes you have created and activated a Conda environment while [installin ## Binary Installation -On macOS, add OSRF packages: +Install [Homebrew](https://brew.sh/). + +Add OSRF packages: + ``` - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew tap osrf/simulation ``` @@ -207,7 +209,7 @@ Install Gazebo Rendering: brew install gz-rendering<#> ``` -Be sure to replace `<#>` with a number value, such as 7 or 8, depending on +Be sure to replace `<#>` with a number value, such as 8 or 9, depending on which version you need. ## Source Installation From 21993f033463d3a491022bb378d0d9aed79f233b Mon Sep 17 00:00:00 2001 From: Martin Pecka Date: Mon, 16 Sep 2024 22:40:43 +0200 Subject: [PATCH 13/19] examples/depth_camera: Fixed windows usage (#1060) Signed-off-by: Martin Pecka --- examples/depth_camera/CMakeLists.txt | 4 +++- examples/depth_camera/Main.cc | 5 +++++ tutorials/23_depth_camera_tutorial.md | 13 ++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/examples/depth_camera/CMakeLists.txt b/examples/depth_camera/CMakeLists.txt index a29651028..79d9a471c 100644 --- a/examples/depth_camera/CMakeLists.txt +++ b/examples/depth_camera/CMakeLists.txt @@ -20,7 +20,9 @@ if (NOT APPLE) link_directories(${GLEW_LIBRARY_DIRS}) endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") +if(NOT WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") +endif() configure_file (example_config.hh.in ${PROJECT_BINARY_DIR}/example_config.hh) diff --git a/examples/depth_camera/Main.cc b/examples/depth_camera/Main.cc index ac715ce5c..c461b5408 100644 --- a/examples/depth_camera/Main.cc +++ b/examples/depth_camera/Main.cc @@ -38,8 +38,13 @@ using namespace gz; using namespace rendering; +#if not defined(_WIN32) const std::string RESOURCE_PATH = common::joinPaths(std::string(PROJECT_BINARY_PATH), "media"); +#else +const std::string RESOURCE_PATH = + common::joinPaths(std::string(PROJECT_BINARY_PATH), "..", "media"); +#endif void buildScene(ScenePtr _scene) { diff --git a/tutorials/23_depth_camera_tutorial.md b/tutorials/23_depth_camera_tutorial.md index 40712202c..f4c7cb379 100644 --- a/tutorials/23_depth_camera_tutorial.md +++ b/tutorials/23_depth_camera_tutorial.md @@ -7,7 +7,11 @@ This example shows how to use the depth camera. In order to compile this tutorial, you need to install some prerequisites : ```bash +# Linux sudo apt-get install build-essential freeglut3-dev libglew-dev + +# Windows (via conda) +conda install glew --channel conda-forge ``` ## Compile and run the example @@ -20,13 +24,20 @@ cd gz-rendering/examples/depth_camera mkdir build cd build cmake .. -make +# On Linux +cmake --build . +# On Windows +cmake --build . --config Release ``` Execute the example: ```{.sh} +# Linux ./depth_camera ogre + +# Windows +.\Release\depth_camera.exe ogre ``` You'll see: From 8e4298558039720fb5c832cb661097f564ae5beb Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Tue, 17 Sep 2024 21:22:06 +0000 Subject: [PATCH 14/19] Revert "Fix using lightmap and emissive map together (#1047)" This reverts commit 6ec0c520f28a61b9505ada49d21adcf92e31b291. --- ogre2/src/Ogre2Material.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ogre2/src/Ogre2Material.cc b/ogre2/src/Ogre2Material.cc index 95db59a1c..70cc66959 100644 --- a/ogre2/src/Ogre2Material.cc +++ b/ogre2/src/Ogre2Material.cc @@ -753,10 +753,14 @@ void Ogre2Material::SetLightMap(const std::string &_name, this->dataPtr->lightMapData = _img; this->lightMapUvSet = _uvSet; - // Apply lightmap by using the detail map slot to store the lightmap texture - // and blending it with the diffuse map. - Ogre::PbsTextureTypes type = Ogre::PBSM_DETAIL0; - this->ogreDatablock->setDetailMapBlendMode(0, Ogre::PBSM_BLEND_OVERLAY); + // in gz-rendering5 + ogre 2.1, we reserved detail map 0 for light map + // and set a blend mode (PBSM_BLEND_OVERLAY AND PBSM_BLEND_MULTIPLY2X + // produces better results) to blend with base albedo map. However, this + // creates unwanted red highlights with ogre 2.2. So switching to use the + // emissive map slot and calling setUseEmissiveAsLightmap(true) + // Ogre::PbsTextureTypes type = Ogre::PBSM_DETAIL0; + // this->ogreDatablock->setDetailMapBlendMode(0, Ogre::PBSM_BLEND_OVERLAY); + Ogre::PbsTextureTypes type = Ogre::PBSM_EMISSIVE; // lightmap usually uses a different tex coord set if (_img == nullptr) @@ -764,6 +768,7 @@ void Ogre2Material::SetLightMap(const std::string &_name, else this->SetTextureMapDataImpl(this->lightMapName, _img, type); this->ogreDatablock->setTextureUvSource(type, this->lightMapUvSet); + this->ogreDatablock->setUseEmissiveAsLightmap(true); } ////////////////////////////////////////////////// From 8835b390e11cde01b1a6e71c4525b3efb174da83 Mon Sep 17 00:00:00 2001 From: "Athena Z." Date: Wed, 18 Sep 2024 16:09:54 -0500 Subject: [PATCH 15/19] Add macOS instructions for render_order tutorial (#1069) Signed-off-by: Athena Z --- tutorials/21_render_order.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tutorials/21_render_order.md b/tutorials/21_render_order.md index 334204ef5..d082303e0 100644 --- a/tutorials/21_render_order.md +++ b/tutorials/21_render_order.md @@ -48,5 +48,9 @@ make Execute the example: ```{.sh} +# Linux (defaults to using ogre1) ./simple_demo + +# macOS (ogre1 is not supported on macOS, but ogre2 is) +./simple_demo ogre2 ``` From 7ef4528d58601a4ecce1ac88fe39eae1f75e0683 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Mon, 23 Sep 2024 00:09:39 -0700 Subject: [PATCH 16/19] Update code for loading normal and albedo maps from image data (#1068) Signed-off-by: Ian Chen --- ogre2/src/Ogre2Material.cc | 135 +++++++++++++++++++++++++++++++++++-- 1 file changed, 131 insertions(+), 4 deletions(-) diff --git a/ogre2/src/Ogre2Material.cc b/ogre2/src/Ogre2Material.cc index 70cc66959..f3009d408 100644 --- a/ogre2/src/Ogre2Material.cc +++ b/ogre2/src/Ogre2Material.cc @@ -15,6 +15,8 @@ * */ +#include + // Note this include is placed in the src file because // otherwise ogre produces compile errors #ifdef _MSC_VER @@ -31,6 +33,8 @@ #include #include #include +#include +#include #include #include #ifdef _MSC_VER @@ -130,6 +134,23 @@ class gz::rendering::Ogre2MaterialPrivate return "invalid"; } } + + /// \brief Prepare for normal mapping by converting to two-component + /// normalized signed 8-bit format + /// \param[in] _texture Normal map texture + /// \param[in/out] _image Normal map image data + public: void PrepareForNormalMapping(Ogre::TextureGpu *_texture, + Ogre::Image2 &_image); + + /// \brief Allocate mimaps for the texture. This should be done when the + /// texture's residency status is still OnStorage. + /// \param[in] _texture Input texture to allocate mimaps + public: void AllocateMipmaps(Ogre::TextureGpu *_texture); + + /// \brief Generate mimaps for the texture. This should be done when the + /// texture's residency status is Resident. + /// \param[in] _texture Input texture to generate mimpas + public: void GenerateMipmaps(Ogre::TextureGpu *_texture); }; using namespace gz; @@ -1220,6 +1241,8 @@ void Ogre2Material::SetTextureMapDataImpl(const std::string& _name, root->getRenderSystem()->getTextureGpuManager(); // create the gpu texture + Ogre::uint32 filters = Ogre::TextureFilter::TypeGenerateDefaultMipmaps; + filters |= this->ogreDatablock->suggestFiltersForType(_type); Ogre::uint32 textureFlags = 0; textureFlags |= Ogre::TextureFlags::AutomaticBatching; Ogre::TextureGpu *texture = textureMgr->createOrRetrieveTexture( @@ -1228,7 +1251,7 @@ void Ogre2Material::SetTextureMapDataImpl(const std::string& _name, textureFlags | Ogre::TextureFlags::ManualTexture, Ogre::TextureTypes::Type2D, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, - 0u); + filters); // Has to be loaded if (texture->getWidth() == 0) @@ -1241,13 +1264,31 @@ void Ogre2Material::SetTextureMapDataImpl(const std::string& _name, texture->setTextureType(Ogre::TextureTypes::Type2D); texture->setNumMipmaps(1u); texture->setResolution(_img->Width(), _img->Height()); - texture->scheduleTransitionTo(Ogre::GpuResidency::Resident); - texture->waitForData(); - // upload raw color image data to gpu texture Ogre::Image2 img; img.loadDynamicImage(&data[0], false, texture); + + // Replicates the steps that ogre does when it loads a texture map from + // file. For normal maps, it is first converted to a two component signed + // 8 bit format. Albedo and normal maps will have mipmaps generated. + // \todo(iche033) See if there is a way to reuse these functions + // from ogre-next without copying the code here. + + // Normal maps - convert to two component signed 8 bit format: + // Ogre::PFG_RG8_SNORM format + if (_type == Ogre::PBSM_NORMAL) + this->dataPtr->PrepareForNormalMapping(texture, img); + + if (_type == Ogre::PBSM_DIFFUSE || _type == Ogre::PBSM_NORMAL) + this->dataPtr->AllocateMipmaps(texture); + + // Upload raw color image data to gpu texture + texture->scheduleTransitionTo(Ogre::GpuResidency::Resident); + texture->waitForData(); img.uploadTo(texture, 0, 0); + + if (_type == Ogre::PBSM_DIFFUSE || _type == Ogre::PBSM_NORMAL) + this->dataPtr->GenerateMipmaps(texture); } // Now assign it to the material @@ -1563,3 +1604,89 @@ ShaderParamsPtr Ogre2Material::FragmentShaderParams() { return this->dataPtr->fragmentShaderParams; } + +////////////////////////////////////////////////// +void Ogre2MaterialPrivate::PrepareForNormalMapping(Ogre::TextureGpu *_texture, + Ogre::Image2 &_image) +{ + // code adpated from PrepareForNormalMapping::_executeStreaming function in + // OgreMain/src/OgreTextureFilters.cpp (v2-3) + const Ogre::uint8 numMipmaps = _image.getNumMipmaps(); + const Ogre::PixelFormatGpu dstFormat = Ogre::PFG_RG8_SNORM; + const Ogre::uint32 rowAlignment = 4u; + const size_t dstSizeBytes = Ogre::PixelFormatGpuUtils::calculateSizeBytes( + _image.getWidth(), + _image.getHeight(), + _image.getDepth(), + _image.getNumSlices(), + dstFormat, numMipmaps, + rowAlignment ); + void *imgData = OGRE_MALLOC_SIMD( dstSizeBytes, Ogre::MEMCATEGORY_RESOURCE); + for (Ogre::uint8 mip = 0; mip < numMipmaps; ++mip) + { + Ogre::TextureBox srcBox = _image.getData( mip ); + const Ogre::uint32 width = srcBox.width; + const Ogre::uint32 height = srcBox.height; + + Ogre::TextureBox dstBox = srcBox; + dstBox.bytesPerPixel = + Ogre::PixelFormatGpuUtils::getBytesPerPixel(dstFormat); + dstBox.bytesPerRow = + Ogre::PixelFormatGpuUtils::getSizeBytes( + width, 1u, 1u, 1u, dstFormat, 4u); + dstBox.bytesPerImage = + Ogre::PixelFormatGpuUtils::getSizeBytes(width, height, 1u, 1u, + dstFormat, 4u); + dstBox.data = Ogre::PixelFormatGpuUtils::advancePointerToMip( + imgData, width, height, srcBox.depth, srcBox.numSlices, mip, dstFormat); + + Ogre::PixelFormatGpuUtils::convertForNormalMapping( + srcBox, _image.getPixelFormat(), + dstBox, dstFormat); + } + _image.loadDynamicImage(imgData, _image.getWidth(), _image.getHeight(), + _image.getDepthOrSlices(), _image.getTextureType(), dstFormat, false, + numMipmaps); + _texture->setPixelFormat(dstFormat); +} + +////////////////////////////////////////////////// +void Ogre2MaterialPrivate::AllocateMipmaps(Ogre::TextureGpu *_texture) +{ + // code adpated from GenerateHwMipmaps::_executeStreaming function in + // OgreMain/src/OgreTextureFilters.cpp (v2-3) + Ogre::uint8 maxMipmaps = Ogre::PixelFormatGpuUtils::getMaxMipmapCount( + _texture->getWidth(), + _texture->getHeight(), + _texture->getDepth() ); + _texture->setNumMipmaps(maxMipmaps); +} + +////////////////////////////////////////////////// +void Ogre2MaterialPrivate::GenerateMipmaps(Ogre::TextureGpu *_texture) +{ + // code adpated from GenerateHwMipmaps::_executeSerial function in + // OgreMain/src/OgreTextureFilters.cpp (v2-3) + Ogre::TextureGpuManager *textureManager = _texture->getTextureManager(); + Ogre::TextureGpu *tempTexture = textureManager->createTexture( + "___tempMipmapTexture", + Ogre::GpuPageOutStrategy::Discard, + Ogre::TextureFlags::RenderToTexture | + Ogre::TextureFlags::AllowAutomipmaps | + Ogre::TextureFlags::DiscardableContent, + _texture->getTextureType()); + tempTexture->copyParametersFrom(_texture); + tempTexture->unsafeScheduleTransitionTo(Ogre::GpuResidency::Resident); + Ogre::TextureBox box = _texture->getEmptyBox(0); + _texture->copyTo(tempTexture, box, 0, box, 0); + tempTexture->_autogenerateMipmaps(); + + Ogre::uint8 mipmaps = _texture->getNumMipmaps(); + for (size_t i = 1u; i < mipmaps; ++i) + { + box = _texture->getEmptyBox( i ); + tempTexture->copyTo(_texture, box, i, box, i); + } + textureManager->destroyTexture(tempTexture); + tempTexture = 0; +} From cd1d3f8858d896e84e9399314639ab10989e829c Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Thu, 26 Sep 2024 11:56:28 -0700 Subject: [PATCH 17/19] Prepare for 9.0.0 (#1070) Signed-off-by: Ian Chen --- CMakeLists.txt | 2 +- Changelog.md | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index af46cc743..96ce89131 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ set(GZ_CMAKE_VER ${gz-cmake4_VERSION_MAJOR}) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -gz_configure_project(VERSION_SUFFIX pre2) +gz_configure_project(VERSION_SUFFIX) #============================================================================ # Set project-specific options diff --git a/Changelog.md b/Changelog.md index 10a6d5368..c83802638 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,10 +2,31 @@ ### Gazebo Rendering 9.X -### Gazebo Rendering 9.0.0 (2024-09-XX) +### Gazebo Rendering 9.0.0 (2024-09-25) 1. **Baseline:** this includes all changes from 8.2.0 and earlier. +1. Update code for loading normal and albedo maps from image data + * [Pull request #1068](https://github.com/gazebosim/gz-rendering/pull/1068) + +1. examples/depth_camera: Fixed windows usage + * [Pull request #1060](https://github.com/gazebosim/gz-rendering/pull/1060) + +1. examples/heightmap: Fixed Windows build + * [Pull request #1062](https://github.com/gazebosim/gz-rendering/pull/1062) + +1. Add Github Action for Windows and fix build + * [Pull request #1049](https://github.com/gazebosim/gz-rendering/pull/1049) + +1. Miscellaneous documentation fixes + * [Pull request #1051](https://github.com/gazebosim/gz-rendering/pull/1051) + * [Pull request #1053](https://github.com/gazebosim/gz-rendering/pull/1053) + * [Pull request #1054](https://github.com/gazebosim/gz-rendering/pull/1054) + * [Pull request #1055](https://github.com/gazebosim/gz-rendering/pull/1055) + * [Pull request #1061](https://github.com/gazebosim/gz-rendering/pull/1061) + * [Pull request #1064](https://github.com/gazebosim/gz-rendering/pull/1064) + * [Pull request #1069](https://github.com/gazebosim/gz-rendering/pull/1069) + 1. Update badges to point to gz-rendering9 branch * [Pull request #1044](https://github.com/gazebosim/gz-rendering/pull/1044) From a9af9847376267ed31592892121b03841a27a492 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Mon, 30 Sep 2024 19:24:46 +0200 Subject: [PATCH 18/19] Fix installation with GZ_ENABLE_RELOCATABLE_INSTALL=ON (#1071) By adding the missing DL dependency Signed-off-by: Silvio Traversaro --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96ce89131..bf7aa7098 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,6 +154,11 @@ set(GZ_RENDERING_ENGINE_RELATIVE_INSTALL_DIR set(GZ_RENDERING_ENGINE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${GZ_RENDERING_ENGINE_RELATIVE_INSTALL_DIR}) +#-------------------------------------- +# Find DL if doing relocatable installation +if (GZ_ENABLE_RELOCATABLE_INSTALL) + gz_find_package(DL REQUIRED) +endif() #-------------------------------------- # Find dependencies that we ignore for Visual Studio From efb4bf5fa50e2489391abc9c524da79c53775e66 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Sat, 5 Oct 2024 00:22:42 +0000 Subject: [PATCH 19/19] update readme Signed-off-by: Ian Chen --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3e4c28e44..fea736f4a 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,10 @@ Build | Status -- | -- -Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-rendering/tree/gz-rendering9/graph/badge.svg)](https://codecov.io/gh/gazebosim/gz-rendering/tree/gz-rendering9) -Ubuntu Noble | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_rendering-ci-gz-rendering9-noble-amd64)](https://build.osrfoundation.org/job/gz_rendering-ci-gz-rendering9-noble-amd64) -Homebrew | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_rendering-ci-gz-rendering9-homebrew-amd64)](https://build.osrfoundation.org/job/gz_rendering-ci-gz-rendering9-homebrew-amd64) -Windows | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_rendering-9-win)](https://build.osrfoundation.org/job/gz_rendering-9-win) +Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-rendering/tree/main/graph/badge.svg)](https://codecov.io/gh/gazebosim/gz-rendering/tree/main) +Ubuntu Noble | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_rendering-ci-main-noble-amd64)](https://build.osrfoundation.org/job/gz_rendering-ci-main-noble-amd64) +Homebrew | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_rendering-ci-main-homebrew-amd64)](https://build.osrfoundation.org/job/gz_rendering-ci-main-homebrew-amd64) +Windows | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_rendering-main-win)](https://build.osrfoundation.org/job/gz_rendering-main-win) Gazebo Rendering is a C++ library designed to provide an abstraction for different rendering engines. It offers unified APIs for creating