Skip to content

Commit

Permalink
Add global option to disable default light (#1146)
Browse files Browse the repository at this point in the history
* Headlight attached to camera can now be disabled.

* Default material properties that better support a variety of lights.

* Updated variable and method names. No functional changes.

* Removed material property changes added in caa01a5

* Minimise PR diff
  • Loading branch information
mogumbo authored and dhood committed Dec 15, 2017
1 parent b329145 commit 043a163
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/rviz/visualization_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ VisualizationManager::VisualizationManager( RenderPanel* render_panel, WindowMan
"RViz will try to render this many frames per second.",
global_options_, SLOT( updateFps() ), this );

default_light_enabled_property_ = new BoolProperty( "Default Light", true,
"Light source attached to the current 3D view.",
global_options_, SLOT( updateDefaultLightVisible() ), this );

root_display_group_->initialize( this ); // only initialize() a Display after its sub-properties are created.
root_display_group_->setEnabled( true );

Expand Down Expand Up @@ -518,6 +522,11 @@ void VisualizationManager::updateFps()
}
}

void VisualizationManager::updateDefaultLightVisible()
{
directional_light_->setVisible(default_light_enabled_property_->getBool());
}

void VisualizationManager::handleMouseEvent( const ViewportMouseEvent& vme )
{
//process pending mouse events
Expand Down
3 changes: 3 additions & 0 deletions src/rviz/visualization_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class DisplayFactory;
class DisplayGroup;
class FrameManager;
class Property;
class BoolProperty;
class IntProperty;
class PropertyTreeModel;
class RenderPanel;
Expand Down Expand Up @@ -368,6 +369,7 @@ protected Q_SLOTS:
TfFrameProperty* fixed_frame_property_; ///< Frame to transform fixed data to
StatusList* global_status_;
IntProperty* fps_property_;
BoolProperty* default_light_enabled_property_;

RenderPanel* render_panel_;

Expand Down Expand Up @@ -396,6 +398,7 @@ private Q_SLOTS:
void updateFixedFrame();
void updateBackgroundColor();
void updateFps();
void updateDefaultLightVisible();

private:
DisplayFactory* display_factory_;
Expand Down

0 comments on commit 043a163

Please sign in to comment.