-
Notifications
You must be signed in to change notification settings - Fork 486
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
Allow user to name a specific light that will generate lens flare. #3305
Conversation
This code doesn't work yet. It tries to select the light named by the user, but sometimes that light has not been added to the scene before the first run of LensFlare::Update(). In that case the first directional light is selected and Update() is never called again: https://github.com/gazebosim/gazebo-classic/pull/3305/files#diff-49074ecb941c9d3ea68dec38fb5d75cd9fe66f3f7a0822715dd11e4845d8189dR601 I would like to be able to be notified when the named light is added to the scene and then run Update() again, but I haven't found a way to do this. An alternative is to only stop running Update() once the named light is found, if there is one:
This introduces a bit of overhead while Update() is repeatedly running. It probably wouldn't be an issue most of the time as developers would not ordinarily name a light if they didn't plan on adding it to the scene. |
I think the LensFlare should only use the first directional light if you haven't specified the name of a light, so it would just wait for that named light to appear. I think that would be easier? |
…e, try to use the first directional light.
Sounds good to me. Just implemented this and it works in my sims with either a named light and a directional light. ca6eedc @scpeters Please promote this to non-draft PR if you like the changes. |
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
gazebo/rendering/LensFlare.cc
Outdated
@@ -40,6 +40,9 @@ namespace gazebo | |||
/// \brief Pointer to light | |||
public: LightPtr light; | |||
|
|||
/// \brief Pointer to light | |||
public: std::string lightName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this variable is not used in the LensFlareCompositorListenerPrivate. If not we can remove it and the corresponding LensFlareCompositorListener::SetLightName
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
gazebo/rendering/LensFlare.cc
Outdated
@@ -86,6 +89,12 @@ namespace gazebo | |||
this->dataPtr->light = _light; | |||
} | |||
|
|||
////////////////////////////////////////////////// | |||
void LensFlareCompositorListener::SetLightName(std::string _name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this method isn't needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
gazebo/rendering/LensFlare.hh
Outdated
public: void SetLight(LightPtr _light); | ||
|
||
/// \brief Set the name of light that generates lens flare | ||
/// \param[in] _name Light that generates lens flare | ||
public: void SetLightName(std::string _name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
🎉 New feature
Closes # not applicable
Summary
Allow user to name a specific light that will generate lens flare.
Test it
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.