Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation against Ogre 1.10.12 #390

Merged
merged 4 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
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 @@ -409,7 +409,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 @@ -445,7 +445,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;

Ogre::MaterialManager &matManager = Ogre::MaterialManager::getSingleton();
#if OGRE_VERSION_LT_1_10_1
#if OGRE_VERSION_LT_1_11_0
if (!this->ogreMaterial.isNull())
{
matManager.remove(this->ogreMaterial->getName());
Expand Down Expand Up @@ -526,7 +526,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
4 changes: 2 additions & 2 deletions ogre/src/OgreRenderEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,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 @@ -724,7 +724,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 @@ -207,7 +207,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