-
Notifications
You must be signed in to change notification settings - Fork 489
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
LensFlare: initialize OGRE compositors during plugin initialization #2764
LensFlare: initialize OGRE compositors during plugin initialization #2764
Conversation
Initialize OGRE compositors in SetCamera() instead of Update() so the compositor order can be better controlled. Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
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.
looks good to me. Just very minor comments
gazebo/rendering/LensFlare.cc
Outdated
@@ -97,6 +97,12 @@ namespace gazebo | |||
Ogre::Vector3(static_cast<double>(this->camera->ViewportWidth()), | |||
static_cast<double>(this->camera->ViewportHeight()), 1.0)); | |||
|
|||
if (!this->light) |
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 you should be able move this check to the top of the function as we don't need to set the params
anymore
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.
gazebo/rendering/LensFlare.cc
Outdated
this->dataPtr->lensFlareInstance->addListener( | ||
this->dataPtr->lensFlareCompositorListener.get()); | ||
} | ||
else | ||
{ |
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.
remove brackets?
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.
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
There are several
SensorPlugin
s that create Ogre compositors (such as LensFlareSensorPlugin). It was reported by @mogumbo that the order in which compositors are applied affects the rendered output, but theLensFlareSensorPlugin
always seems to be applied last, regardless of the order in which plugins are specified in an SDFormat file. @iche033 suggested moving the code for initializing agazebo::rendering::LensFlare
compositor fromLensFlare::Update
toLensflare::SetCamera
, so that the compositor would be added during plugin initialization.The initialization code expects a pointer to a
DirectionalLight
, which is not available until the first render update. It seems to work to initialize with anullptr
for theDirectionalLight
since the light ptr is being set every update. I also added logic to exitnotifyMaterialRender
early if the light pointer isnullptr
.