Skip to content

Commit f606a32

Browse files
authored
Merge pull request #1027 from gazebosim/merge_7_8_20240801
Merge 7 -> 8
2 parents 6a2217f + 1cc9d51 commit f606a32

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

ogre/src/OgreDistortionPass.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ void OgreDistortionPass::CreateRenderPass()
196196
distortedLocation,
197197
newDistortedCoordinates,
198198
currDistortedCoordinates;
199-
unsigned int distortedIdx,
200-
distortedCol,
199+
unsigned int distortedIdx;
200+
int distortedCol,
201201
distortedRow;
202202
double normalizedColLocation, normalizedRowLocation;
203203

@@ -223,9 +223,9 @@ void OgreDistortionPass::CreateRenderPass()
223223
focalLength);
224224

225225
// compute the index in the distortion map
226-
distortedCol = static_cast<unsigned int>(round(distortedLocation.X() *
226+
distortedCol = static_cast<int>(round(distortedLocation.X() *
227227
this->dataPtr->distortionTexWidth));
228-
distortedRow = static_cast<unsigned int>(round(distortedLocation.Y() *
228+
distortedRow = static_cast<int>(round(distortedLocation.Y() *
229229
this->dataPtr->distortionTexHeight));
230230

231231
// Note that the following makes sure that, for significant distortions,
@@ -235,8 +235,11 @@ void OgreDistortionPass::CreateRenderPass()
235235
// nonlegacy distortion modes.
236236

237237
// Make sure the distorted pixel is within the texture dimensions
238-
if (distortedCol < this->dataPtr->distortionTexWidth &&
239-
distortedRow < this->dataPtr->distortionTexHeight)
238+
if (distortedCol >= 0 && distortedRow >= 0 &&
239+
static_cast<unsigned int>(distortedCol) <
240+
this->dataPtr->distortionTexWidth &&
241+
static_cast<unsigned int>(distortedRow) <
242+
this->dataPtr->distortionTexHeight)
240243
{
241244
distortedIdx = distortedRow * this->dataPtr->distortionTexWidth +
242245
distortedCol;

ogre2/src/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ set(engine_name "ogre2")
1717
gz_add_component(${engine_name} SOURCES ${sources} GET_TARGET_NAME ogre2_target)
1818

1919
set(OGRE2_RESOURCE_PATH_STR "${OGRE2_RESOURCE_PATH}")
20-
string(REPLACE ";" ":" OGRE2_RESOURCE_PATH_STR "${OGRE2_RESOURCE_PATH}")
20+
# On non-Windows, we need to convert the CMake list delimited (;) to the
21+
# list delimiter used in list of paths in code (:)
22+
# On Windows, the list delimiter in code is already ;, not need to change it to :
23+
if(NOT WIN32)
24+
string(REPLACE ";" ":" OGRE2_RESOURCE_PATH_STR "${OGRE2_RESOURCE_PATH}")
25+
endif()
26+
2127
set_property(
2228
SOURCE Ogre2RenderEngine.cc
2329
PROPERTY COMPILE_DEFINITIONS

ogre2/src/Ogre2RenderEngine.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#endif
2323
#include <gz/common/Console.hh>
2424
#include <gz/common/Filesystem.hh>
25+
#include <gz/common/StringUtils.hh>
26+
#include <gz/common/SystemPaths.hh>
2527
#include <gz/common/Util.hh>
2628

2729
#include <gz/plugin/Register.hh>
@@ -153,14 +155,15 @@ Ogre2RenderEngine::Ogre2RenderEngine() :
153155
this->dummyWindowId = 0;
154156

155157
std::string ogrePath = std::string(OGRE2_RESOURCE_PATH);
156-
std::vector<std::string> paths = common::split(ogrePath, ":");
158+
std::vector<std::string> paths = common::Split(ogrePath,
159+
common::SystemPaths::Delimiter());
157160
for (const auto &path : paths)
158161
this->ogrePaths.push_back(path);
159162

160163
const char *env = std::getenv("OGRE2_RESOURCE_PATH");
161164
if (env)
162165
{
163-
paths = common::split(std::string(env), ":");
166+
paths = common::Split(std::string(env), common::SystemPaths::Delimiter());
164167
for (const auto &path : paths)
165168
this->ogrePaths.push_back(path);
166169
}

0 commit comments

Comments
 (0)