Skip to content

Commit

Permalink
5 -> 6 (#476)
Browse files Browse the repository at this point in the history
* ogre: Do not assume that ogre plugins have lib prefix on macOS (#454)

Signed-off-by: Silvio <[email protected]>

* Fix compilation against Ogre 1.10.12 (#390)

Signed-off-by: GitHub <[email protected]>

Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Co-authored-by: Jose Luis Rivero <[email protected]>

* Avoid symbol redefition to fix armel builds (#457)

* Avoid symbol redefiniition on armel builds

Signed-off-by: Jose Luis Rivero <[email protected]>

* Fix logic on warning for ogre versions different than 1.9.x (#465)

* Fix logic on warning for ogre versions different than 1.9.x

Signed-off-by: Jose Luis Rivero <[email protected]>

* Fix context attributes of glXCreateContextAttribsARB. (#460)

Signed-off-by: Hill Ma <[email protected]>

Co-authored-by: Silvio Traversaro <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Co-authored-by: Jose Luis Rivero <[email protected]>
Co-authored-by: Hill Ma <[email protected]>
  • Loading branch information
5 people authored Oct 19, 2021
2 parents 7c1430d + 5a5f4cd commit a0d71f6
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 57 deletions.
23 changes: 7 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,19 @@ endif()
# Find OGRE
list(APPEND ign_ogre_components "RTShaderSystem" "Terrain" "Overlay" "Paging")

# Ogre versions greater than 1.9 are not officialy supported.
ign_find_package(IgnOGRE VERSION 1.9.0
COMPONENTS ${ign_ogre_components}
REQUIRED_BY ogre
PRIVATE_FOR ogre)

# Ogre versions greater than 1.9.x are not officialy supported.
# Display a warning for the users on this setup unless they provide
# USE_UNOFFICIAL_OGRE_VERSIONS flag
if (NOT USE_UNOFFICIAL_OGRE_VERSIONS)
# Only for checking the ogre version
ign_find_package(IgnOGRE VERSION 1.10 QUIET)

if (OGRE_FOUND)
if (${OGRE_VERSION} VERSION_GREATER_EQUAL 1.10.0)
IGN_BUILD_WARNING("Ogre 1.x versions greater than 1.9 are not officially supported."
"The software might compile and even work but support from upstream"
"could be reduced to accepting patches for newer versions")
ign_find_package(IgnOGRE VERSION 1.10
COMPONENTS ${ign_ogre_components}
REQUIRED_BY ogre
PRIVATE_FOR ogre)
else()
# If ogre 1.10 or greater was not found, then proceed to look for 1.9.x
# versions which are offically supported
ign_find_package(IgnOGRE VERSION 1.9.0
COMPONENTS ${ign_ogre_components}
REQUIRED_BY ogre
PRIVATE_FOR ogre)
endif()
endif()

Expand Down
5 changes: 5 additions & 0 deletions include/ignition/rendering/Storage.hh
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ namespace ignition
public: virtual ~StoreWrapper() { }
};

// armhf failed to build with this code. It can not be removed for the rest
// of arches to keep ABI but should be removed in major versions unreleased
// see https://github.com/ignitionrobotics/ign-rendering/pull/457
#ifndef __ARM_PCS_VFP
template class Store<Scene>;
template class Store<Node>;
template class Store<Light>;
Expand All @@ -303,6 +307,7 @@ namespace ignition
template class Store<SubMesh>;
template class Map<Material>;
template class CompositeStore<Node>;
#endif

/// \def SceneStore
/// \brief Store of Scene
Expand Down
7 changes: 6 additions & 1 deletion ogre/include/ignition/rendering/ogre/OgreStorage.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ namespace ignition
namespace rendering
{
inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
//

// armhf failed to build with this code. It can not be removed for the rest
// of arches to keep ABI but should be removed in major versions unreleased
// see https://github.com/ignitionrobotics/ign-rendering/pull/457
#ifndef __ARM_PCS_VFP
template class BaseSceneStore<OgreScene>;
template class BaseNodeStore<OgreNode>;
template class BaseLightStore<OgreLight>;
Expand All @@ -43,6 +47,7 @@ namespace ignition
template class BaseGeometryStore<OgreGeometry>;
template class BaseSubMeshStore<OgreSubMesh>;
template class BaseMaterialMap<OgreMaterial>;
#endif

typedef BaseSceneStore<OgreScene> OgreSceneStore;
typedef BaseNodeStore<OgreNode> OgreNodeStore;
Expand Down
7 changes: 2 additions & 5 deletions ogre/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ set(engine_name "ogre")

ign_add_component(${engine_name} SOURCES ${sources} GET_TARGET_NAME ogre_target)

if(OGRE_VERSION VERSION_LESS 1.10.3)
add_definitions(-DOGRE_VERSION_LT_1_10_3)
endif()
if(OGRE_VERSION VERSION_LESS 1.10.1)
add_definitions(-DOGRE_VERSION_LT_1_10_1)
if(OGRE_VERSION VERSION_LESS 1.11.0)
add_definitions(-DOGRE_VERSION_LT_1_11_0)
endif()
if(OGRE_VERSION VERSION_LESS 1.12.0)
add_definitions(-DOGRE_VERSION_LT_1_12_0)
Expand Down
4 changes: 2 additions & 2 deletions ogre/src/OgreGaussianNoisePass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace ignition
public: virtual void notifyMaterialRender(unsigned int _passId,
Ogre::MaterialPtr &_mat)
{
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
IGN_ASSERT(!_mat.isNull(), "Null OGRE material");
#else
IGN_ASSERT(_mat, "Null OGRE material");
Expand All @@ -68,7 +68,7 @@ namespace ignition
IGN_ASSERT(pass, "Null OGRE material pass");
Ogre::GpuProgramParametersSharedPtr params =
pass->getFragmentProgramParameters();
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
IGN_ASSERT(!params.isNull(), "Null OGRE material GPU parameters");
#else
IGN_ASSERT(params, "Null OGRE material GPU parameters");
Expand Down
4 changes: 2 additions & 2 deletions ogre/src/OgreGpuRays.cc
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ void OgreGpuRays::CreateGpuRaysTextures()
Ogre::TextureManager::getSingleton().createManual(
texName.str(), "General", Ogre::TEX_TYPE_2D,
this->dataPtr->w1st, this->dataPtr->h1st, 0,
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
Ogre::PF_FLOAT32_RGB, Ogre::TU_RENDERTARGET).getPointer();
#else
Ogre::PF_FLOAT32_RGB, Ogre::TU_RENDERTARGET).get();
Expand Down Expand Up @@ -451,7 +451,7 @@ void OgreGpuRays::CreateGpuRaysTextures()
Ogre::TEX_TYPE_2D,
this->dataPtr->w2nd, this->dataPtr->h2nd, 0,
Ogre::PF_FLOAT32_RGB,
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
Ogre::TU_RENDERTARGET).getPointer();
#else
Ogre::TU_RENDERTARGET).get();
Expand Down
4 changes: 2 additions & 2 deletions ogre/src/OgreMaterial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void OgreMaterial::Destroy()
return;
std::string materialName;
Ogre::MaterialManager &matManager = Ogre::MaterialManager::getSingleton();
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
if (!this->ogreMaterial.isNull())
{
materialName = this->ogreMaterial->getName();
Expand Down Expand Up @@ -594,7 +594,7 @@ Ogre::TexturePtr OgreMaterial::CreateTexture(const std::string &_name)

if (image.getWidth() == 0)
{
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
texture.setNull();
#else
texture.reset();
Expand Down
2 changes: 1 addition & 1 deletion ogre/src/OgreMaterialSwitcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Ogre::Technique *OgreMaterialSwitcher::handleSchemeNotFound(
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

// OGRE 1.9 changes the shared pointer definition
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
Ogre::MaterialPtr plainMaterial = res.staticCast<Ogre::Material>();
#else
Ogre::MaterialPtr plainMaterial =
Expand Down
14 changes: 7 additions & 7 deletions ogre/src/OgreRTShaderSystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ OgreRTShaderSystem::OgreRTShaderSystem()
{
this->dataPtr->initialized = false;
this->dataPtr->shadowsApplied = false;
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
this->dataPtr->pssmSetup.setNull();
#else
this->dataPtr->pssmSetup.reset();
Expand Down Expand Up @@ -157,7 +157,7 @@ void OgreRTShaderSystem::Fini()
#endif
this->dataPtr->shaderGenerator = nullptr;
}
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
this->dataPtr->pssmSetup.setNull();
#else
this->dataPtr->pssmSetup.reset();
Expand Down Expand Up @@ -300,7 +300,7 @@ void OgreRTShaderSystem::RemoveShaders(OgreSubMesh *_subMesh)
#ifdef OGRE_VERSION_LT_1_12_0
this->dataPtr->shaderGenerator->removeShaderBasedTechnique(
curMaterialName,
#ifndef OGRE_VERSION_LT_1_10_3
#ifndef OGRE_VERSION_LT_1_11_0
curSubEntity->getMaterial()->getGroup(),
#endif
Ogre::MaterialManager::DEFAULT_SCHEME_NAME,
Expand Down Expand Up @@ -380,7 +380,7 @@ void OgreRTShaderSystem::GenerateShaders(OgreSubMesh *subMesh)
try
{
success = this->dataPtr->shaderGenerator->createShaderBasedTechnique(
#if OGRE_VERSION_LT_1_10_3
#if OGRE_VERSION_LT_1_11_0
curMaterialName,
#else
*material->Material(),
Expand All @@ -407,7 +407,7 @@ void OgreRTShaderSystem::GenerateShaders(OgreSubMesh *subMesh)
this->dataPtr->scenes[s]->Name() +
Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME,
curMaterialName,
#ifndef OGRE_VERSION_LT_1_10_3
#ifndef OGRE_VERSION_LT_1_11_0
material->Material()->getGroup(),
#endif
0);
Expand Down Expand Up @@ -590,7 +590,7 @@ void OgreRTShaderSystem::ApplyShadows(OgreScenePtr _scene)
sceneMgr->setShadowTextureSelfShadow(false);
sceneMgr->setShadowCasterRenderBackFaces(true);

#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
// Set up caster material - this is just a standard depth/shadow map caster
sceneMgr->setShadowTextureCasterMaterial("PSSM/shadow_caster");
#else
Expand All @@ -607,7 +607,7 @@ void OgreRTShaderSystem::ApplyShadows(OgreScenePtr _scene)
// pssmCasterPass->setFog(true);

// shadow camera setup
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
if (this->dataPtr->pssmSetup.isNull())
#else
if (this->dataPtr->pssmSetup == nullptr)
Expand Down
15 changes: 6 additions & 9 deletions ogre/src/OgreRenderEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void OgreRenderEngine::AddResourcePath(const std::string &_uri)
fullPath);

bool matPtrNotNull;
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
matPtrNotNull = !matPtr.isNull();
#else
matPtrNotNull = matPtr != nullptr;
Expand Down Expand Up @@ -425,20 +425,17 @@ void OgreRenderEngine::LoadPlugins()
std::vector<std::string>::iterator piter;

#ifdef __APPLE__
std::string prefix = "lib";
std::string extension = ".dylib";
#elif _WIN32
std::string prefix = "";
std::string extension = ".dll";
#else
std::string prefix = "";
std::string extension = ".so";
#endif

plugins.push_back(path+"/"+prefix+"RenderSystem_GL");
plugins.push_back(path+"/"+prefix+"Plugin_ParticleFX");
plugins.push_back(path+"/"+prefix+"Plugin_BSPSceneManager");
plugins.push_back(path+"/"+prefix+"Plugin_OctreeSceneManager");
plugins.push_back(path+"/RenderSystem_GL");
plugins.push_back(path+"/Plugin_ParticleFX");
plugins.push_back(path+"/Plugin_BSPSceneManager");
plugins.push_back(path+"/Plugin_OctreeSceneManager");

#ifdef HAVE_OCULUS
plugins.push_back(path+"/Plugin_CgProgramManager");
Expand Down Expand Up @@ -728,7 +725,7 @@ void OgreRenderEngine::CheckCapabilities()
bool hasVertexPrograms =
capabilities->hasCapability(Ogre::RSC_VERTEX_PROGRAM);

#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
bool hasFBO =
capabilities->hasCapability(Ogre::RSC_FBO);
#else
Expand Down
2 changes: 1 addition & 1 deletion ogre/src/OgreScene.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void OgreScene::SetGradientBackgroundColor(
// Create background rectangle covering the whole screen
rect = new ColoredRectangle2D();
rect->setCorners(-1.0, 1.0, 1.0, -1.0);
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
rect->setMaterial("Background");
#else
rect->setMaterial(material);
Expand Down
14 changes: 7 additions & 7 deletions ogre/src/OgreText.cc
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ void OgreMovableText::SetFontNameImpl(const std::string &_newFontName)
}

if (this->fontName != _newFontName ||
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
this->ogreMaterial.isNull() || !this->font)
#else
this->ogreMaterial == nullptr || !this->font)
Expand All @@ -369,15 +369,15 @@ void OgreMovableText::SetFontNameImpl(const std::string &_newFontName)

this->font->load();

#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
if (!this->ogreMaterial.isNull())
#else
if (this->ogreMaterial)
#endif
{
Ogre::MaterialManager::getSingletonPtr()->remove(
this->ogreMaterial->getName());
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
this->ogreMaterial.setNull();
#else
this->ogreMaterial = nullptr;
Expand All @@ -403,7 +403,7 @@ void OgreMovableText::SetFontNameImpl(const std::string &_newFontName)
void OgreMovableText::SetupGeometry()
{
IGN_ASSERT(this->font, "font class member is null");
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
IGN_ASSERT(!this->ogreMaterial.isNull(), "ogreMaterial class member is null");
#else
IGN_ASSERT(this->ogreMaterial, "ogreMaterial class member is null");
Expand Down Expand Up @@ -740,7 +740,7 @@ void OgreMovableText::UpdateColors()
unsigned int i;

IGN_ASSERT(this->font, "font class member is null");
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
IGN_ASSERT(!this->ogreMaterial.isNull(), "ogreMaterial class member is null");
#else
IGN_ASSERT(this->ogreMaterial, "ogreMaterial class member is null");
Expand Down Expand Up @@ -769,7 +769,7 @@ void OgreMovableText::UpdateColors()
//////////////////////////////////////////////////
void OgreMovableText::UpdateMaterial()
{
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
if (this->ogreMaterial.isNull())
#else
if (!this->ogreMaterial)
Expand Down Expand Up @@ -859,7 +859,7 @@ void OgreMovableText::getRenderOperation(Ogre::RenderOperation &_op)
//////////////////////////////////////////////////
const Ogre::MaterialPtr &OgreMovableText::getMaterial(void) const
{
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
IGN_ASSERT(!this->ogreMaterial.isNull(), "ogreMaterial class member is null");
#else
IGN_ASSERT(this->ogreMaterial, "ogreMaterial class member is null");
Expand Down
4 changes: 2 additions & 2 deletions ogre/src/OgreThermalCamera.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ OgreThermalCameraMaterialSwitcher::OgreThermalCameraMaterialSwitcher(
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

// OGRE 1.9 changes the shared pointer definition
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
this->heatSourceMaterial = res.staticCast<Ogre::Material>();
#else
this->heatSourceMaterial =
Expand Down Expand Up @@ -422,7 +422,7 @@ void OgreThermalCamera::CreateThermalTexture()
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

// OGRE 1.9 changes the shared pointer definition
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
this->dataPtr->thermalMaterial = res.staticCast<Ogre::Material>();
#else
this->dataPtr->thermalMaterial =
Expand Down
7 changes: 6 additions & 1 deletion ogre2/include/ignition/rendering/ogre2/Ogre2Storage.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,19 @@ namespace ignition
namespace rendering
{
inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
//

// armhf failed to build with this code. It can not be removed for the rest
// of arches to keep ABI but should be removed in major versions unreleased
// see https://github.com/ignitionrobotics/ign-rendering/pull/457
#ifndef __ARM_PCS_VFP
template class BaseGeometryStore<Ogre2Geometry>;
template class BaseLightStore<Ogre2Light>;
template class BaseNodeStore<Ogre2Node>;
template class BaseSceneStore<Ogre2Scene>;
template class BaseSensorStore<Ogre2Sensor>;
template class BaseSubMeshStore<Ogre2SubMesh>;
template class BaseVisualStore<Ogre2Visual>;
#endif

typedef BaseGeometryStore<Ogre2Geometry> Ogre2GeometryStore;
typedef BaseLightStore<Ogre2Light> Ogre2LightStore;
Expand Down
1 change: 0 additions & 1 deletion ogre2/src/Ogre2RenderEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ void Ogre2RenderEngine::CreateContext()
int contextAttribs[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 3,
GLX_CONTEXT_FLAGS_ARB , GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
None
};
this->dummyContext =
Expand Down

0 comments on commit a0d71f6

Please sign in to comment.