Skip to content

Commit

Permalink
Override PreRender function in Ogre2ParticleEnitter (#871)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 authored Jul 25, 2023
1 parent 54e6140 commit e22380f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
7 changes: 3 additions & 4 deletions ogre2/include/gz/rendering/ogre2/Ogre2ParticleEmitter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,15 @@ namespace gz
public: virtual void SetColorRangeImage(const std::string &_image)
override;

// Documentation inherited.
public: virtual void PreRender() override;

/// \brief Particle system visibility flags
public: static const uint32_t kParticleVisibilityFlags;

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

/// \brief Internal pre-render function added to avoid breaking ABI
/// compatibility
private: void PreRenderImpl();

/// \brief Create the particle system
private: void CreateParticleSystem();

Expand Down
16 changes: 3 additions & 13 deletions ogre2/src/Ogre2ParticleEmitter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,8 @@ void Ogre2ParticleEmitter::SetType(
this->type = _type;

this->dataPtr->emitterDirty = true;
// todo(anyone) remove this call. We had to do this since we can't override
// PreRender() as it breaks ABI. We should rename PreRenderImpl to PreRender()
// in next release.
this->PreRenderImpl();
// Call PreRender to re-create the particle emitter
this->PreRender();
}

//////////////////////////////////////////////////
Expand Down Expand Up @@ -243,10 +241,6 @@ void Ogre2ParticleEmitter::SetParticleSize(
this->particleSize = _size;

this->dataPtr->emitterDirty = true;
// todo(anyone) remove this call. We had to do this since we can't override
// PreRender() as it breaks ABI. We should rename PreRenderImpl to PreRender()
// in next release.
this->PreRenderImpl();
}

//////////////////////////////////////////////////
Expand Down Expand Up @@ -434,12 +428,8 @@ void Ogre2ParticleEmitter::Init()
}

//////////////////////////////////////////////////
void Ogre2ParticleEmitter::PreRenderImpl()
void Ogre2ParticleEmitter::PreRender()
{
// todo(anyone) rename this function to PreRender() so it overrides function
// from base class. Since this rename breaks ABI, we should rename this
// function in the next release

// recreate the particle system if needed
// currently this is needed when user changes type or particle size
if (this->dataPtr->emitterDirty)
Expand Down

0 comments on commit e22380f

Please sign in to comment.