void GPUBillboardSet::setBillboards(const std::vector<PhotoSynth::Vertex>& vertices, bool useGeometryShader)
{
	if (mRenderOp.vertexData)
		OGRE_DELETE mRenderOp.vertexData;
	
	if (useGeometryShader)
		createVertexDataForVertexAndGeometryShaders(vertices);
	else
		createVertexDataForVertexShaderOnly(vertices);
	
	// Update bounding box and sphere 
	updateBoundingBoxAndSphereFromBillboards(vertices);

	// Update billboard size
	setBillboardSize(mBillboardSize);
}
LaserScanVisualizer::LaserScanVisualizer( Ogre::SceneManager* scene_manager, ros::node* node, rosTFClient* tf_client, const std::string& name )
: VisualizerBase( scene_manager, node, tf_client, name )
, r_( 1.0 )
, g_( 0.0 )
, b_( 0.0 )
, intensity_min_( 999999.0f )
, intensity_max_( -999999.0f )
, point_decay_time_( 20.0f )
, style_( Billboards )
, billboard_size_( 0.003 )
{
  cloud_ = new ogre_tools::PointCloud( scene_manager_ );

  setStyle( style_ );
  setBillboardSize( billboard_size_ );
}
示例#3
0
PointCloudBase::PointCloudBase( const std::string& name, VisualizationManager* manager )
: Display( name, manager )
, spinner_(1, &cbqueue_)
, new_cloud_(false)
, new_xyz_transformer_(false)
, new_color_transformer_(false)
, needs_retransform_(false)
, style_( Billboards )
, billboard_size_( 0.01 )
, point_decay_time_(0.0f)
, selectable_(false)
, coll_handle_(0)
, messages_received_(0)
, total_point_count_(0)
{
  cloud_ = new ogre_tools::PointCloud();
  scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode();
  scene_node_->attachObject(cloud_);
  coll_handler_ = PointCloudSelectionHandlerPtr(new PointCloudSelectionHandler(this));

  setStyle( style_ );
  setBillboardSize( billboard_size_ );
  setAlpha(1.0f);

  setSelectable(true);

  PluginManager* pman = vis_manager_->getPluginManager();
  const L_Plugin& plugins = pman->getPlugins();
  L_Plugin::const_iterator it = plugins.begin();
  L_Plugin::const_iterator end = plugins.end();
  for (; it != end; ++it)
  {
    const PluginPtr& plugin = *it;
    PluginConns pc;
    pc.loaded = plugin->getLoadedSignal().connect(boost::bind(&PointCloudBase::onPluginLoaded, this, _1));
    pc.unloading = plugin->getUnloadingSignal().connect(boost::bind(&PointCloudBase::onPluginUnloading, this, _1));
    loadTransformers(plugin.get());
    plugin_conns_[plugin.get()] = pc;
  }

  threaded_nh_.setCallbackQueue(&cbqueue_);
  spinner_.start();
}
void LaserScanVisualizer::propertyChanged( wxPropertyGridEvent& event )
{
  wxPGProperty* property = event.GetProperty();

  const wxString& name = property->GetName();
  wxVariant value = property->GetValue();

  if ( name == property_prefix_ + SCAN_TOPIC_PROPERTY )
  {
    wxString topic = value.GetString();
    setScanTopic( std::string(topic.fn_str()) );
  }
  else if ( name == property_prefix_ + CLOUD_TOPIC_PROPERTY )
  {
    wxString topic = value.GetString();
    setCloudTopic( std::string(topic.fn_str()) );
  }
  else if ( name == property_prefix_ + COLOR_PROPERTY )
  {
    wxColour color;
    color << value;

    setColor( color.Red() / 255.0f, color.Green() / 255.0f, color.Blue() / 255.0f );
  }
  else if ( name == property_prefix_ + DECAY_TIME_PROPERTY )
  {
    float val = value.GetDouble();
    setDecayTime( val );
  }
  else if ( name == property_prefix_ + STYLE_PROPERTY )
  {
    int val = value.GetLong();
    setStyle( (Style)val );
  }
  else if ( name == property_prefix_ + BILLBOARD_SIZE_PROPERTY )
  {
    float val = value.GetDouble();
    setBillboardSize( val );
  }
}
void LaserScanVisualizer::loadProperties( wxConfigBase* config )
{
  wxString scan_topic, cloud_topic;
  double r, g, b;
  double decay_time;
  long style;
  double billboard_size;

  {
    config->Read( SCAN_TOPIC_PROPERTY, &scan_topic, wxString::FromAscii( scan_topic_.c_str() ) );
    config->Read( CLOUD_TOPIC_PROPERTY, &cloud_topic, wxString::FromAscii( cloud_topic_.c_str() ) );
  }

  {
    config->Read( wxString(COLOR_PROPERTY) + wxT("R"), &r, r_ );
    config->Read( wxString(COLOR_PROPERTY) + wxT("G"), &g, g_ );
    config->Read( wxString(COLOR_PROPERTY) + wxT("B"), &b, b_ );
  }

  {
    config->Read( DECAY_TIME_PROPERTY, &decay_time, point_decay_time_ );
  }

  {
    config->Read( STYLE_PROPERTY, &style, style_ );
  }

  {
    config->Read( BILLBOARD_SIZE_PROPERTY, &billboard_size, billboard_size_ );
  }

  setScanTopic( (const char*)scan_topic.fn_str() );
  setCloudTopic( (const char*)cloud_topic.fn_str() );
  setColor( r, g, b );
  setStyle( (Style)style );
  setBillboardSize( billboard_size );
}