Exemplo n.º 1
0
void
TransferFunctionEditorWidget::transferFunctionChanged(QImage lookupTable)
{
  update();
  emit transferFunctionUpdated(lookupTable);
  emit updateComposite();
}
Exemplo n.º 2
0
  void
  RVolume::initGTK()
  {
    _optList.reset(new Gtk::VBox);//The Vbox of options   

    {//Transfer function widget
      _transferFunction.reset(new magnet::gtk::TransferFunction
			      (magnet::function::MakeDelegate
			       (this, &RVolume::transferFunctionUpdated)));
      _transferFunction->set_size_request(-1, 100);
      
      _optList->add(*_transferFunction); _transferFunction->show();
      transferFunctionUpdated(); //Force an update of the transfer function now we have the widget
    }

    {//Volume renderer step size
      _stepSize.reset(new Gtk::Entry);
      Gtk::HBox* box = manage(new Gtk::HBox);	
      Gtk::Label* label = manage(new Gtk::Label("Raytrace Step Size"));
      box->pack_start(*label, false, false); label->show();
      box->pack_end(*_stepSize, false, false);
      _stepSize->show(); _stepSize->set_text("0.01");      
      _optList->add(*box); box->show();
    }

    {//Diffusive lighting
      Gtk::HBox* box = manage(new Gtk::HBox);	
      Gtk::Label* label = manage(new Gtk::Label("Diffuse Lighting"));
      box->pack_start(*label, false, false); label->show();
      _diffusiveLighting.reset(new Gtk::HScale);
      box->pack_end(*_diffusiveLighting, true, true);
      _diffusiveLighting->set_range(0,2);
      _diffusiveLighting->set_digits(3);
      _diffusiveLighting->show();      
      _diffusiveLighting->set_value(1.0);
      _optList->add(*box); box->show();
    }

    {//Specular lighting
      Gtk::HBox* box = manage(new Gtk::HBox);	
      Gtk::Label* label = manage(new Gtk::Label("Specular Lighting"));
      box->pack_start(*label, false, false); label->show();
      _specularLighting.reset(new Gtk::HScale);
      box->pack_end(*_specularLighting, true, true);
      _specularLighting->set_range(0,2);
      _specularLighting->set_digits(3);
      _specularLighting->show();      
      _specularLighting->set_value(1.0);
      _optList->add(*box); box->show();
    }

    {//Ray Dithering
      Gtk::HBox* box = manage(new Gtk::HBox);	
      Gtk::Label* label = manage(new Gtk::Label("Ray Dithering"));
      box->pack_start(*label, false, false); label->show();
      _ditherRay.reset(new Gtk::HScale);
      box->pack_end(*_ditherRay, true, true);
      _ditherRay->set_range(0, 1);
      _ditherRay->set_digits(3);
      _ditherRay->show();
      _ditherRay->set_value(1.0);
      _optList->add(*box); box->show();
    }
    
    _optList->show();
    //Callbacks
    _stepSize->signal_changed()
      .connect(sigc::bind<Gtk::Entry&>(&magnet::Gtk::forceNumericEntry, *_stepSize));
    _stepSize->signal_activate().connect(sigc::mem_fun(*this, &RVolume::guiUpdate));

    guiUpdate();
  }