Skip to content

Commit

Permalink
Fix ABI problems
Browse files Browse the repository at this point in the history
I gave up on commit undoing

It's clear that on the next release, Ogre2RenderTarget and
Ogre2RenderTexture need to be merged together.

Signed-off-by: Matias N. Goldberg <[email protected]>
  • Loading branch information
darksylinc committed May 23, 2021
1 parent b52af92 commit a095aba
Show file tree
Hide file tree
Showing 4 changed files with 222 additions and 78 deletions.
56 changes: 47 additions & 9 deletions ogre2/include/ignition/rendering/ogre2/Ogre2RenderTarget.hh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ namespace ignition
/// see changes made and revert
public: bool isRenderWindow() const;

// Documentation inherited
public: unsigned int GLIdImpl() const;

/// \brief Destroy the render texture
protected: void DestroyTargetImpl();

/// \brief Build the render texture
protected: void BuildTargetImpl();

/// \brief Get a pointer to the ogre render target containing
/// the results of the render
public: virtual Ogre::RenderTarget *RenderTarget() const;
Expand All @@ -136,6 +145,14 @@ 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 Update the render pass chain
public: static void UpdateRenderPassChain(
Ogre::CompositorWorkspace *_workspace,
Expand Down Expand Up @@ -179,6 +196,10 @@ 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 All @@ -198,15 +219,12 @@ namespace ignition
/// \brief a material used by for the render target
protected: MaterialPtr material;

/// \brief Helper class that applies the material to the render target
protected: Ogre2RenderTargetMaterialPtr materialApplicator[2];

/// \brief Pointer to the internal ogre render texture objects
/// There's two because we ping pong postprocessing effects
/// and the final result is always in ogreTexture[1]
/// RenderWindows may have a 3rd texture which is the
/// actual window
protected: Ogre::Texture *ogreTexture[2] = {nullptr, nullptr};
/// \brief Unused. Kept for ABI reasons.
///
/// Just in case we set this value to
/// Ogre2RenderTargetPrivate::materialApplicator[0] which is what
/// most client applications may want.
protected: Ogre2RenderTargetMaterialPtr materialApplicator;

/// \brief Flag to indicate if the render target color has changed
protected: bool colorDirty = true;
Expand Down Expand Up @@ -247,6 +265,11 @@ namespace ignition
// Documentation inherited
public: virtual unsigned int GLId() const override;

// Documentation inherited
// TODO(anyone): this function should be removed.
// We didn't do it to preserve ABI.
public: virtual Ogre::RenderTarget *RenderTarget() const override;

// Documentation inherited.
protected: virtual void RebuildTarget() override;

Expand All @@ -256,6 +279,21 @@ 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::Texture *_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: Ogre::Texture * IGN_DEPRECATED(5) ogreTexture = nullptr;

/// \brief Make scene our friend so it can create a ogre2 render texture
private: friend class Ogre2Scene;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ namespace ignition
Ogre::Material *_originalMaterial, uint16_t _lodIndex,
const Ogre::Renderable *_rend) override;

/// \brief Returns this->renderTarget == _renderTarget
public: bool isSameRenderTarget(Ogre::RenderTarget *_renderTarget);

/// \brief scene manager responsible for rendering
private: Ogre::SceneManager *scene = nullptr;

Expand Down
Loading

0 comments on commit a095aba

Please sign in to comment.