Skip to content

Commit

Permalink
Remove code deprecated in ign-rendering5
Browse files Browse the repository at this point in the history
Syntax cosmetic changes for consistency

Signed-off-by: Matias N. Goldberg <[email protected]>
  • Loading branch information
darksylinc committed Jul 5, 2021
1 parent 84513fa commit 029cd59
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 73 deletions.
27 changes: 0 additions & 27 deletions ogre2/include/ignition/rendering/ogre2/Ogre2RenderTarget.hh
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,6 @@ namespace ignition
/// \param[in] _mask Visibility mask
public: virtual void SetVisibilityMask(uint32_t _mask);

/// \brief Deprecated. Use other overloads.
public: static IGN_DEPRECATED(5) void UpdateRenderPassChain(
Ogre::CompositorWorkspace *_workspace,
const std::string &_workspaceDefName,
const std::string &_baseNode, const std::string &_finalNode,
const std::vector<RenderPassPtr> &_renderPasses,
bool _recreateNodes);

/// \brief Deprecated. Use other overloads.
public: static IGN_DEPRECATED(6) void UpdateRenderPassChain(
Ogre::CompositorWorkspace *_workspace,
Expand Down Expand Up @@ -217,10 +209,6 @@ namespace ignition
/// \sa BaseRenderTarget::Rebuild()
protected: void RebuildMaterial();

/// Calls Ogre2RenderTexture::SetOgreTexture if appropiate to ensure
/// Ogre2RenderTexture::ogreTexture always has our outputs
protected: void SyncOgreTextureVars();

/// \brief Pointer to the internal ogre camera
protected: Ogre::Camera *ogreCamera = nullptr;

Expand Down Expand Up @@ -296,21 +284,6 @@ namespace ignition
/// \brief Build the render texture
protected: virtual void BuildTarget();

/// \brief Do not call this function directly.
///
/// It's used to keep ABI compatibility to sync ogreTexture
/// with the internal pointer from our base class.
/// \param[in] _ogreTexture texture from
/// Ogre2RenderTargetPrivate::ogreTexture[1]
public: void SetOgreTexture(Ogre::TextureGpu *_ogreTexture);

/// \brief Unused. Kept for ABI reasons.
///
/// Just in case we set this value to
/// Ogre2RenderTargetPrivate::ogreTexture[1] which is what most client
/// applications may want.
protected: IGN_DEPRECATED(5) Ogre::TextureGpu * ogreTexture = nullptr;

/// \brief Make scene our friend so it can create a ogre2 render texture
private: friend class Ogre2Scene;
};
Expand Down
4 changes: 2 additions & 2 deletions ogre2/src/Ogre2DepthCamera.cc
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void Ogre2DepthCamera::Destroy()
Ogre::CompositorManager2 *ogreCompMgr = ogreRoot->getCompositorManager2();

// remove depth texture, material, compositor
for( size_t i = 0u; i < 2u; ++i )
for (size_t i = 0u; i < 2u; ++i)
{
if (this->dataPtr->ogreDepthTexture[i])
{
Expand Down Expand Up @@ -877,7 +877,7 @@ void Ogre2DepthCamera::CreateDepthTexture()
Ogre::TextureGpuManager *textureMgr =
ogreRoot->getRenderSystem()->getTextureGpuManager();
// create render texture - these textures pack the range data
for( size_t i = 0u; i < 2u; ++i )
for (size_t i = 0u; i < 2u; ++i)
{
this->dataPtr->ogreDepthTexture[i] =
textureMgr->createTexture(
Expand Down
49 changes: 5 additions & 44 deletions ogre2/src/Ogre2RenderTarget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,13 @@ void Ogre2RenderTarget::BuildCompositor()
}

Ogre::CompositorChannelVec externalTargets(2u);
for( size_t i = 0u; i < 2u; ++i )
for (size_t i = 0u; i < 2u; ++i)
{
// Connect them in reverse order
const size_t srcIdx = 2u - i - 1u;
externalTargets[i] = this->dataPtr->ogreTexture[srcIdx];
}

this->SyncOgreTextureVars();

this->ogreCompositorWorkspace =
ogreCompMgr->addWorkspace(
this->scene->OgreSceneManager(),
Expand All @@ -315,12 +313,11 @@ void Ogre2RenderTarget::DestroyCompositor()
// FSAA (which we need for BuildCompositor to connect correctly)
const Ogre::CompositorChannelVec &externalTargets =
this->ogreCompositorWorkspace->getExternalRenderTargets();
for( size_t i = 0u; i < 2u; ++i )
for (size_t i = 0u; i < 2u; ++i)
{
const size_t srcIdx = (2u - i - 1u);
this->dataPtr->ogreTexture[srcIdx] = externalTargets[i];
}
this->SyncOgreTextureVars();

auto engine = Ogre2RenderEngine::Instance();
auto ogreRoot = engine->OgreRoot();
Expand Down Expand Up @@ -516,7 +513,7 @@ void Ogre2RenderTarget::DestroyTargetImpl()

Ogre::TextureGpuManager *textureManager =
root->getRenderSystem()->getTextureGpuManager();
for( size_t i = 0u; i < 2u; ++i )
for (size_t i = 0u; i < 2u; ++i)
{
textureManager->destroyTexture(this->dataPtr->ogreTexture[i]);
this->dataPtr->ogreTexture[i] = nullptr;
Expand All @@ -525,8 +522,6 @@ void Ogre2RenderTarget::DestroyTargetImpl()
// TODO(anyone) there is memory leak when a render texture is destroyed.
// The RenderSystem::_cleanupDepthBuffers method used in ogre1 does not
// seem to work in ogre2

this->SyncOgreTextureVars();
}

//////////////////////////////////////////////////
Expand All @@ -537,7 +532,7 @@ void Ogre2RenderTarget::BuildTargetImpl()
Ogre::TextureGpuManager *textureMgr =
ogreRoot->getRenderSystem()->getTextureGpuManager();

for( size_t i = 0u; i < 2u; ++i )
for (size_t i = 0u; i < 2u; ++i)
{
this->dataPtr->ogreTexture[i] =
textureMgr->createTexture(
Expand All @@ -553,8 +548,6 @@ void Ogre2RenderTarget::BuildTargetImpl()
this->dataPtr->ogreTexture[i]->scheduleTransitionTo(
Ogre::GpuResidency::Resident);
}

this->SyncOgreTextureVars();
}

//////////////////////////////////////////////////
Expand Down Expand Up @@ -684,23 +677,9 @@ void Ogre2RenderTarget::UpdateRenderPassChain()
this->IsRenderWindow(),
this->dataPtr->usingFsaa);

this->SyncOgreTextureVars();

this->renderPassDirty = false;
}

//////////////////////////////////////////////////
void Ogre2RenderTarget::UpdateRenderPassChain(
Ogre::CompositorWorkspace * /*_workspace*/,
const std::string & /*_workspaceDefName*/,
const std::string & /*_baseNode*/, const std::string & /*_finalNode*/,
const std::vector<RenderPassPtr> & /*_renderPasses*/,
bool /*_recreateNodes*/)
{
ignwarn << "Warning: This Ogre2RenderTarget::UpdateRenderPassChain "
<< "overload is deprecated" << std::endl;
}

//////////////////////////////////////////////////
void Ogre2RenderTarget::UpdateRenderPassChain(
Ogre::CompositorWorkspace *_workspace, const std::string &_workspaceDefName,
Expand Down Expand Up @@ -845,7 +824,7 @@ void Ogre2RenderTarget::UpdateRenderPassChain(

const Ogre::CompositorChannelVec &externalTargets =
_workspace->getExternalRenderTargets();
for( size_t i = 0u; i < 2u; ++i )
for (size_t i = 0u; i < 2u; ++i)
{
const size_t srcIdx = bMustSwapRts ? (2u - i - 1u) : i;
(*_ogreTextures)[srcIdx] = externalTargets[i];
Expand Down Expand Up @@ -923,15 +902,6 @@ void Ogre2RenderTarget::RebuildMaterial()
}
}

//////////////////////////////////////////////////
void Ogre2RenderTarget::SyncOgreTextureVars()
{
Ogre2RenderTexture *asRenderTexture =
dynamic_cast<Ogre2RenderTexture*>(this);
if (asRenderTexture)
asRenderTexture->SetOgreTexture(this->dataPtr->ogreTexture[1]);
}

//////////////////////////////////////////////////
// Ogre2RenderTexture
//////////////////////////////////////////////////
Expand Down Expand Up @@ -996,15 +966,6 @@ Ogre::TextureGpu *Ogre2RenderTexture::RenderTarget() const
return Ogre2RenderTarget::RenderTargetImpl();
}

//////////////////////////////////////////////////
void Ogre2RenderTexture::SetOgreTexture(Ogre::TextureGpu *_ogreTexture)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
this->ogreTexture = _ogreTexture;
#pragma GCC diagnostic pop
}

//////////////////////////////////////////////////
// Ogre2RenderWindow
//////////////////////////////////////////////////
Expand Down

0 comments on commit 029cd59

Please sign in to comment.