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

Address todo in Ogre2ParticleEmitter - override PreRender function #871

Merged
merged 2 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all 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: 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