Ejemplo n.º 1
0
void GridDisplay::updateColor()
{
  QColor color = color_property_->getColor();
  color.setAlphaF( alpha_property_->getFloat() );
  grid_->setColor( qtToOgre( color ));
  context_->queueRender();
}
Ejemplo n.º 2
0
void GridDisplay::onInitialize()
{
  QColor color = color_property_->getColor();
  color.setAlphaF( alpha_property_->getFloat() );

  frame_property_->setFrameManager( context_->getFrameManager() );
  grid_ = new Grid( scene_manager_, scene_node_,
                    (Grid::Style) style_property_->getOptionInt(),
                    cell_count_property_->getInt(),
                    cell_size_property_->getFloat(),
                    line_width_property_->getFloat(),
                    qtToOgre( color ));

  grid_->getSceneNode()->setVisible( false );
  updatePlane();
}
Ejemplo n.º 3
0
void PolygonDisplay::processMessage(const geometry_msgs::PolygonStamped::ConstPtr& msg)
{
  if( !validateFloats( *msg ))
  {
    setStatus( StatusProperty::Error, "Topic", "Message contained invalid floating point values (nans or infs)" );
    return;
  }

  Ogre::Vector3 position;
  Ogre::Quaternion orientation;
  if( !context_->getFrameManager()->getTransform( msg->header, position, orientation ))
  {
    ROS_DEBUG( "Error transforming from frame '%s' to frame '%s'",
               msg->header.frame_id.c_str(), qPrintable( fixed_frame_ ));
  }

  scene_node_->setPosition( position );
  scene_node_->setOrientation( orientation );

  manual_object_->clear();

  Ogre::ColourValue color = qtToOgre( color_property_->getColor() );
  color.a = alpha_property_->getFloat();
  // TODO: this does not actually support alpha as-is.  The
  // "BaseWhiteNoLighting" material ends up ignoring the alpha
  // component of the color values we set at each point.  Need to make
  // a material and do the whole setSceneBlending() rigamarole.

  uint32_t num_points = msg->polygon.points.size();
  if( num_points > 0 )
  {
    manual_object_->estimateVertexCount( num_points );
    manual_object_->begin( "BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_STRIP );
    for( uint32_t i=0; i < num_points + 1; ++i )
    {
      const geometry_msgs::Point32& msg_point = msg->polygon.points[ i % num_points ];
      manual_object_->position( msg_point.x, msg_point.y, msg_point.z );
      manual_object_->colour( color );
    }

    manual_object_->end();
  }
}
void VisualizationManager::updateBackgroundColor()
{
    render_panel_->setBackgroundColor( qtToOgre( background_color_property_->getColor() ));

    queueRender();
}