55 #include "SplatCloudRenderingControlPlugin.hh" 63 #include <QHBoxLayout> 64 #include <QPushButton> 65 #include <QRadioButton> 75 SplatCloudRenderingControlPlugin::SplatCloudRenderingControlPlugin() :
76 toolboxPointsizeScale_ ( 0 ),
77 toolboxDefaultColorR_ ( 0 ),
78 toolboxDefaultColorG_ ( 0 ),
79 toolboxDefaultColorB_ ( 0 ),
80 toolboxDefaultNormalX_ ( 0 ),
81 toolboxDefaultNormalY_ ( 0 ),
82 toolboxDefaultNormalZ_ ( 0 ),
83 toolboxDefaultPointsize_( 0 ),
84 contextScaleAction_ ( 0 ),
85 contextCullingAction_ ( 0 ),
86 contextDefaultsAction_ ( 0 ),
87 contextReloadShadersAction_( 0 ),
88 contextRebuildVBOAction_ ( 0 ),
89 contextScaleWidget_ ( 0 ),
90 contextScaleWidgetPointsizeScale_( 0 ),
91 contextDefaultsWidget_ ( 0 ),
92 contextDefaultsWidgetDefaultColorR_ ( 0 ),
93 contextDefaultsWidgetDefaultColorG_ ( 0 ),
94 contextDefaultsWidgetDefaultColorB_ ( 0 ),
95 contextDefaultsWidgetDefaultNormalX_ ( 0 ),
96 contextDefaultsWidgetDefaultNormalY_ ( 0 ),
97 contextDefaultsWidgetDefaultNormalZ_ ( 0 ),
98 contextDefaultsWidgetDefaultPointsize_( 0 )
106 void SplatCloudRenderingControlPlugin::initializePlugin()
115 toolboxPointsizeScale_ =
new QDoubleSpinBox();
116 toolboxPointsizeScale_->setRange( 0.0, 100.0 );
117 toolboxPointsizeScale_->setDecimals( 4 );
118 toolboxPointsizeScale_->setSingleStep( 0.1 );
119 toolboxPointsizeScale_->setValue( 1.0 );
120 toolboxPointsizeScale_->setToolTip(
"The scaling factor of the pointsizes used during the rendering of objects" );
123 QHBoxLayout *toolboxPointsizeScaleLayout =
new QHBoxLayout();
124 toolboxPointsizeScaleLayout->setSpacing( 6 );
125 toolboxPointsizeScaleLayout->addWidget(
new QLabel(
"Pointsize Scaling Factor:" ) );
126 toolboxPointsizeScaleLayout->addWidget( toolboxPointsizeScale_ );
129 QPushButton *toolboxEnableBackfaceCullingButton =
new QPushButton (
"Enable Backface Culling" );
130 QPushButton *toolboxDisableBackfaceCullingButton =
new QPushButton (
"Disable Backface Culling" );
131 QPushButton *toolboxReloadShadersButton =
new QPushButton (
"Reload Shaders" );
132 QPushButton *toolboxRebuildVBOsButton =
new QPushButton (
"Rebuild VBOs" );
133 QRadioButton *toolboxPointSizeButton =
new QRadioButton(
"Use gl_PointSize" );
134 QRadioButton *toolboxGeometryShaderButton =
new QRadioButton(
"Use Geometry Shader" );
135 toolboxEnableBackfaceCullingButton->setToolTip (
"Enable the culling of backfaces" );
136 toolboxDisableBackfaceCullingButton->setToolTip(
"Disable the culling of backfaces" );
137 toolboxReloadShadersButton->setToolTip (
"Reload all shader files" );
138 toolboxRebuildVBOsButton->setToolTip (
"Rebuild all vertex-buffer-objects" );
139 toolboxPointSizeButton->setToolTip (
"Set gl_PointSize in vertex shader" );
140 toolboxGeometryShaderButton->setToolTip (
"Create quads in geometry shader" );
142 toolboxPointSizeButton->setChecked(
true);
145 QHBoxLayout *toolboxButtonsALayout =
new QHBoxLayout();
146 toolboxButtonsALayout->setSpacing( 6 );
147 toolboxButtonsALayout->addWidget( toolboxEnableBackfaceCullingButton );
148 toolboxButtonsALayout->addWidget( toolboxDisableBackfaceCullingButton );
151 QFrame *toolboxSeparatorFrame =
new QFrame();
152 toolboxSeparatorFrame->setFrameShape( QFrame::HLine );
153 toolboxSeparatorFrame->setFrameShadow( QFrame::Sunken );
156 QHBoxLayout *toolboxButtonsBLayout =
new QHBoxLayout();
157 toolboxButtonsBLayout->setSpacing( 6 );
158 toolboxButtonsBLayout->addWidget( toolboxReloadShadersButton );
159 toolboxButtonsBLayout->addWidget( toolboxRebuildVBOsButton );
162 QFrame *toolboxSeparatorFrameBC =
new QFrame();
163 toolboxSeparatorFrameBC->setFrameShape(QFrame::HLine);
164 toolboxSeparatorFrameBC->setFrameShadow(QFrame::Sunken);
167 QHBoxLayout *toolboxButtonsCLayout =
new QHBoxLayout();
168 toolboxButtonsCLayout->setSpacing(6);
169 toolboxButtonsCLayout->addWidget(toolboxPointSizeButton);
170 toolboxButtonsCLayout->addWidget(toolboxGeometryShaderButton);
173 QVBoxLayout *toolboxOptionsLayout =
new QVBoxLayout();
174 toolboxOptionsLayout->setAlignment( Qt::AlignTop );
175 toolboxOptionsLayout->setSpacing( 6 );
176 toolboxOptionsLayout->addItem ( toolboxPointsizeScaleLayout );
177 toolboxOptionsLayout->addItem ( toolboxButtonsALayout );
178 toolboxOptionsLayout->addItem (
new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
179 toolboxOptionsLayout->addWidget( toolboxSeparatorFrame );
180 toolboxOptionsLayout->addItem ( toolboxButtonsBLayout );
181 toolboxOptionsLayout->addItem (
new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
182 toolboxOptionsLayout->addWidget( toolboxSeparatorFrameBC );
183 toolboxOptionsLayout->addItem ( toolboxButtonsCLayout );
186 QWidget *toolboxOptionsWidget =
new QWidget();
187 toolboxOptionsWidget->setLayout( toolboxOptionsLayout );
188 toolboxOptionsWidget->setToolTip(
"Rendering options" );
193 toolboxDefaultColorR_ =
new QSpinBox();
194 toolboxDefaultColorG_ =
new QSpinBox();
195 toolboxDefaultColorB_ =
new QSpinBox();
196 toolboxDefaultColorR_->setRange( 0, 255 );
197 toolboxDefaultColorG_->setRange( 0, 255 );
198 toolboxDefaultColorB_->setRange( 0, 255 );
199 toolboxDefaultColorR_->setSingleStep( 1 );
200 toolboxDefaultColorG_->setSingleStep( 1 );
201 toolboxDefaultColorB_->setSingleStep( 1 );
202 toolboxDefaultColorR_->setValue( 255 );
203 toolboxDefaultColorG_->setValue( 255 );
204 toolboxDefaultColorB_->setValue( 255 );
205 toolboxDefaultColorR_->setToolTip(
"The default red-component of the color used when an object has no colors" );
206 toolboxDefaultColorG_->setToolTip(
"The default green-component of the color used when an object has no colors" );
207 toolboxDefaultColorB_->setToolTip(
"The default blue-component of the color used when an object has no colors" );
210 toolboxDefaultNormalX_ =
new QDoubleSpinBox();
211 toolboxDefaultNormalY_ =
new QDoubleSpinBox();
212 toolboxDefaultNormalZ_ =
new QDoubleSpinBox();
213 toolboxDefaultNormalX_->setRange( -1.0, 1.0 );
214 toolboxDefaultNormalY_->setRange( -1.0, 1.0 );
215 toolboxDefaultNormalZ_->setRange( -1.0, 1.0 );
216 toolboxDefaultNormalX_->setDecimals( 2 );
217 toolboxDefaultNormalY_->setDecimals( 2 );
218 toolboxDefaultNormalZ_->setDecimals( 2 );
219 toolboxDefaultNormalX_->setSingleStep( 0.1 );
220 toolboxDefaultNormalY_->setSingleStep( 0.1 );
221 toolboxDefaultNormalZ_->setSingleStep( 0.1 );
222 toolboxDefaultNormalX_->setValue( 0.0 );
223 toolboxDefaultNormalY_->setValue( 0.0 );
224 toolboxDefaultNormalZ_->setValue( 1.0 );
225 toolboxDefaultNormalX_->setToolTip(
"The default x-component of the normal used when an object has no normals" );
226 toolboxDefaultNormalY_->setToolTip(
"The default y-component of the normal used when an object has no normals" );
227 toolboxDefaultNormalZ_->setToolTip(
"The default z-component of the normal used when an object has no normals" );
230 toolboxDefaultPointsize_ =
new QDoubleSpinBox();
231 toolboxDefaultPointsize_->setRange( 0.0, 1000.0 );
232 toolboxDefaultPointsize_->setDecimals( 3 );
233 toolboxDefaultPointsize_->setSingleStep( 0.01 );
234 toolboxDefaultPointsize_->setValue( 0.1 );
235 toolboxDefaultPointsize_->setToolTip(
"The default pointsize used when an object has no pointsizes" );
238 QHBoxLayout *toolboxDefaultColorLayout =
new QHBoxLayout();
239 toolboxDefaultColorLayout->setSpacing( 6 );
240 toolboxDefaultColorLayout->addWidget( toolboxDefaultColorR_ );
241 toolboxDefaultColorLayout->addWidget( toolboxDefaultColorG_ );
242 toolboxDefaultColorLayout->addWidget( toolboxDefaultColorB_ );
245 QHBoxLayout *toolboxDefaultNormalLayout =
new QHBoxLayout();
246 toolboxDefaultNormalLayout->setSpacing( 6 );
247 toolboxDefaultNormalLayout->addWidget( toolboxDefaultNormalX_ );
248 toolboxDefaultNormalLayout->addWidget( toolboxDefaultNormalY_ );
249 toolboxDefaultNormalLayout->addWidget( toolboxDefaultNormalZ_ );
252 QHBoxLayout *toolboxDefaultPointsizeLayout =
new QHBoxLayout();
253 toolboxDefaultPointsizeLayout->setSpacing( 6 );
254 toolboxDefaultPointsizeLayout->addWidget( toolboxDefaultPointsize_ );
257 QGridLayout *toolboxDefaultsLayout =
new QGridLayout();
258 toolboxDefaultsLayout->setSpacing( 6 );
259 toolboxDefaultsLayout->addWidget(
new QLabel(
"Default Color:" ), 0, 0 );
260 toolboxDefaultsLayout->addWidget(
new QLabel(
"Default Normal:" ), 1, 0 );
261 toolboxDefaultsLayout->addWidget(
new QLabel(
"Default Pointsize:" ), 2, 0 );
262 toolboxDefaultsLayout->addItem ( toolboxDefaultColorLayout, 0, 1 );
263 toolboxDefaultsLayout->addItem ( toolboxDefaultNormalLayout, 1, 1 );
264 toolboxDefaultsLayout->addItem ( toolboxDefaultPointsizeLayout, 2, 1 );
267 QWidget *toolboxDefaultsWidget =
new QWidget();
268 toolboxDefaultsWidget->setLayout( toolboxDefaultsLayout );
269 toolboxDefaultsWidget->setToolTip(
"Default values" );
274 QTabWidget *toolboxTabWidget =
new QTabWidget();
275 toolboxTabWidget->addTab( toolboxOptionsWidget,
"Options" );
276 toolboxTabWidget->addTab( toolboxDefaultsWidget,
"Defaults" );
279 QVBoxLayout *toolboxLayout =
new QVBoxLayout();
280 toolboxLayout->setSpacing( 6 );
281 toolboxLayout->addWidget( toolboxTabWidget );
284 QWidget *toolbox =
new QWidget();
285 toolbox->setLayout( toolboxLayout );
288 QIcon *toolboxIcon =
new QIcon( OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"SplatCloudRenderingControl.png" );
293 connect( toolboxPointsizeScale_, SIGNAL( valueChanged(
double) ),
this, SLOT( slotToolboxPointsizeScaleValueChanged() ) );
294 connect( toolboxDefaultColorR_, SIGNAL( valueChanged(
int) ),
this, SLOT( slotToolboxDefaultColorValueChanged() ) );
295 connect( toolboxDefaultColorG_, SIGNAL( valueChanged(
int) ),
this, SLOT( slotToolboxDefaultColorValueChanged() ) );
296 connect( toolboxDefaultColorB_, SIGNAL( valueChanged(
int) ),
this, SLOT( slotToolboxDefaultColorValueChanged() ) );
297 connect( toolboxDefaultNormalX_, SIGNAL( valueChanged(
double) ),
this, SLOT( slotToolboxDefaultNormalValueChanged() ) );
298 connect( toolboxDefaultNormalY_, SIGNAL( valueChanged(
double) ),
this, SLOT( slotToolboxDefaultNormalValueChanged() ) );
299 connect( toolboxDefaultNormalZ_, SIGNAL( valueChanged(
double) ),
this, SLOT( slotToolboxDefaultNormalValueChanged() ) );
300 connect( toolboxDefaultPointsize_, SIGNAL( valueChanged(
double) ),
this, SLOT( slotToolboxDefaultPointsizeValueChanged() ) );
302 connect( toolboxEnableBackfaceCullingButton, SIGNAL( clicked() ),
this, SLOT( slotToolboxEnableBackfaceCullingButtonClicked() ) );
303 connect( toolboxDisableBackfaceCullingButton, SIGNAL( clicked() ),
this, SLOT( slotToolboxDisableBackfaceCullingButtonClicked() ) );
304 connect( toolboxReloadShadersButton, SIGNAL( clicked() ),
this, SLOT( slotToolboxReloadShadersButtonClicked() ) );
305 connect( toolboxRebuildVBOsButton, SIGNAL( clicked() ),
this, SLOT( slotToolboxRebuildVBOsButtonClicked() ) );
306 connect( toolboxPointSizeButton, SIGNAL( toggled(
bool) ),
this, SLOT( slotToolboxPointSizeButtonClicked() ) );
307 connect( toolboxGeometryShaderButton, SIGNAL( toggled(
bool) ),
this, SLOT( slotToolboxGeometryShaderButtonClicked() ) );
310 emit addToolbox( tr(
"SplatCloud Rendering Control") , toolbox , toolboxIcon );
317 contextScaleAction_ =
new QAction( tr(
"Pointsize Scaling Factor..."),
this );
318 contextCullingAction_ =
new QAction( tr(
"Backface Culling" ),
this );
319 contextDefaultsAction_ =
new QAction( tr(
"Defaults..." ),
this );
320 contextReloadShadersAction_ =
new QAction( tr(
"Reload Shaders" ),
this );
321 contextRebuildVBOAction_ =
new QAction( tr(
"Rebuild VBO" ),
this );
322 contextCullingAction_->setCheckable(
true );
325 QMenu *contextMenu =
new QMenu(
"SplatCloud Rendering Control" );
326 contextMenu->setIcon( QIcon( OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"SplatCloudRenderingControl.png" ) );
327 contextMenu->addAction( contextScaleAction_ );
328 contextMenu->addAction( contextCullingAction_ );
329 contextMenu->addSeparator();
330 contextMenu->addAction( contextDefaultsAction_ );
331 contextMenu->addSeparator();
332 contextMenu->addAction( contextReloadShadersAction_ );
333 contextMenu->addAction( contextRebuildVBOAction_ );
338 connect( contextScaleAction_, SIGNAL( triggered() ),
this, SLOT( slotContextScaleActionTriggered() ) );
339 connect( contextCullingAction_, SIGNAL( triggered() ),
this, SLOT( slotContextCullingActionTriggered() ) );
340 connect( contextDefaultsAction_, SIGNAL( triggered() ),
this, SLOT( slotContextDefaultsActionTriggered() ) );
341 connect( contextReloadShadersAction_, SIGNAL( triggered() ),
this, SLOT( slotContextReloadShadersActionTriggered() ) );
342 connect( contextRebuildVBOAction_, SIGNAL( triggered() ),
this, SLOT( slotContextRebuildVBOActionTriggered() ) );
352 contextScaleWidgetPointsizeScale_ =
new QDoubleSpinBox();
353 contextScaleWidgetPointsizeScale_->setRange( 0.0, 100.0 );
354 contextScaleWidgetPointsizeScale_->setDecimals( 4 );
355 contextScaleWidgetPointsizeScale_->setSingleStep( 0.1 );
356 contextScaleWidgetPointsizeScale_->setToolTip(
"The scaling factor of the pointsizes used during the rendering of the picked object" );
359 QHBoxLayout *contextScaleWidgetPointsizeScaleLayout =
new QHBoxLayout();
360 contextScaleWidgetPointsizeScaleLayout->setSpacing( 6 );
361 contextScaleWidgetPointsizeScaleLayout->addWidget(
new QLabel(
"Pointsize Scaling Factor:" ) );
362 contextScaleWidgetPointsizeScaleLayout->addWidget( contextScaleWidgetPointsizeScale_ );
365 QVBoxLayout *contextScaleWidgetLayout =
new QVBoxLayout();
366 contextScaleWidgetLayout->setAlignment( Qt::AlignTop );
367 contextScaleWidgetLayout->setSpacing( 6 );
368 contextScaleWidgetLayout->addItem( contextScaleWidgetPointsizeScaleLayout );
371 contextScaleWidget_ =
new QWidget();
372 contextScaleWidget_->setWindowTitle(
"Pointsize Scaling Factor" );
373 contextScaleWidget_->setLayout( contextScaleWidgetLayout );
378 connect( contextScaleWidgetPointsizeScale_, SIGNAL( valueChanged(
double) ),
this, SLOT( slotContextScaleWidgetPointsizeScaleValueChanged() ) );
385 contextDefaultsWidgetDefaultColorR_ =
new QSpinBox();
386 contextDefaultsWidgetDefaultColorG_ =
new QSpinBox();
387 contextDefaultsWidgetDefaultColorB_ =
new QSpinBox();
388 contextDefaultsWidgetDefaultColorR_->setRange( 0, 255 );
389 contextDefaultsWidgetDefaultColorG_->setRange( 0, 255 );
390 contextDefaultsWidgetDefaultColorB_->setRange( 0, 255 );
391 contextDefaultsWidgetDefaultColorR_->setSingleStep( 1 );
392 contextDefaultsWidgetDefaultColorG_->setSingleStep( 1 );
393 contextDefaultsWidgetDefaultColorB_->setSingleStep( 1 );
394 contextDefaultsWidgetDefaultColorR_->setToolTip(
"The default red-component of the color used when the picked object has no colors" );
395 contextDefaultsWidgetDefaultColorG_->setToolTip(
"The default green-component of the color used when the picked object has no colors" );
396 contextDefaultsWidgetDefaultColorB_->setToolTip(
"The default blue-component of the color used when the picked object has no colors" );
399 contextDefaultsWidgetDefaultNormalX_ =
new QDoubleSpinBox();
400 contextDefaultsWidgetDefaultNormalY_ =
new QDoubleSpinBox();
401 contextDefaultsWidgetDefaultNormalZ_ =
new QDoubleSpinBox();
402 contextDefaultsWidgetDefaultNormalX_->setRange( -1.0, 1.0 );
403 contextDefaultsWidgetDefaultNormalY_->setRange( -1.0, 1.0 );
404 contextDefaultsWidgetDefaultNormalZ_->setRange( -1.0, 1.0 );
405 contextDefaultsWidgetDefaultNormalX_->setDecimals( 2 );
406 contextDefaultsWidgetDefaultNormalY_->setDecimals( 2 );
407 contextDefaultsWidgetDefaultNormalZ_->setDecimals( 2 );
408 contextDefaultsWidgetDefaultNormalX_->setSingleStep( 0.1 );
409 contextDefaultsWidgetDefaultNormalY_->setSingleStep( 0.1 );
410 contextDefaultsWidgetDefaultNormalZ_->setSingleStep( 0.1 );
411 contextDefaultsWidgetDefaultNormalX_->setToolTip(
"The default x-component of the normal used when the picked object has no normals" );
412 contextDefaultsWidgetDefaultNormalY_->setToolTip(
"The default y-component of the normal used when the picked object has no normals" );
413 contextDefaultsWidgetDefaultNormalZ_->setToolTip(
"The default z-component of the normal used when the picked object has no normals" );
416 contextDefaultsWidgetDefaultPointsize_ =
new QDoubleSpinBox();
417 contextDefaultsWidgetDefaultPointsize_->setRange( 0.0, 1000.0 );
418 contextDefaultsWidgetDefaultPointsize_->setDecimals( 3 );
419 contextDefaultsWidgetDefaultPointsize_->setSingleStep( 0.01 );
420 contextDefaultsWidgetDefaultPointsize_->setToolTip(
"The default pointsize used when the picked object has no pointsizes" );
423 QHBoxLayout *contextDefaultsWidgetDefaultColorLayout =
new QHBoxLayout();
424 contextDefaultsWidgetDefaultColorLayout->setSpacing( 6 );
425 contextDefaultsWidgetDefaultColorLayout->addWidget( contextDefaultsWidgetDefaultColorR_ );
426 contextDefaultsWidgetDefaultColorLayout->addWidget( contextDefaultsWidgetDefaultColorG_ );
427 contextDefaultsWidgetDefaultColorLayout->addWidget( contextDefaultsWidgetDefaultColorB_ );
430 QHBoxLayout *contextDefaultsWidgetDefaultNormalLayout =
new QHBoxLayout();
431 contextDefaultsWidgetDefaultNormalLayout->setSpacing( 6 );
432 contextDefaultsWidgetDefaultNormalLayout->addWidget( contextDefaultsWidgetDefaultNormalX_ );
433 contextDefaultsWidgetDefaultNormalLayout->addWidget( contextDefaultsWidgetDefaultNormalY_ );
434 contextDefaultsWidgetDefaultNormalLayout->addWidget( contextDefaultsWidgetDefaultNormalZ_ );
437 QHBoxLayout *contextDefaultsWidgetDefaultPointsizeLayout =
new QHBoxLayout();
438 contextDefaultsWidgetDefaultPointsizeLayout->setSpacing( 6 );
439 contextDefaultsWidgetDefaultPointsizeLayout->addWidget( contextDefaultsWidgetDefaultPointsize_ );
442 QGridLayout *contextDefaultsWidgetDefaultOptionsLayout =
new QGridLayout();
443 contextDefaultsWidgetDefaultOptionsLayout->setSpacing( 6 );
444 contextDefaultsWidgetDefaultOptionsLayout->addWidget(
new QLabel(
"Default Color:" ), 0, 0 );
445 contextDefaultsWidgetDefaultOptionsLayout->addWidget(
new QLabel(
"Default Normal:" ), 1, 0 );
446 contextDefaultsWidgetDefaultOptionsLayout->addWidget(
new QLabel(
"Default Pointsize:" ), 2, 0 );
447 contextDefaultsWidgetDefaultOptionsLayout->addItem ( contextDefaultsWidgetDefaultColorLayout, 0, 1 );
448 contextDefaultsWidgetDefaultOptionsLayout->addItem ( contextDefaultsWidgetDefaultNormalLayout, 1, 1 );
449 contextDefaultsWidgetDefaultOptionsLayout->addItem ( contextDefaultsWidgetDefaultPointsizeLayout, 2, 1 );
452 QVBoxLayout *contextDefaultsWidgetLayout =
new QVBoxLayout();
453 contextDefaultsWidgetLayout->setAlignment( Qt::AlignTop );
454 contextDefaultsWidgetLayout->setSpacing( 6 );
455 contextDefaultsWidgetLayout->addItem( contextDefaultsWidgetDefaultOptionsLayout );
458 contextDefaultsWidget_ =
new QWidget();
459 contextDefaultsWidget_->setWindowTitle(
"Defaults" );
460 contextDefaultsWidget_->setLayout( contextDefaultsWidgetLayout );
465 connect( contextDefaultsWidgetDefaultColorR_, SIGNAL( valueChanged(
int) ),
this, SLOT( slotContextDefaultsWidgetDefaultColorValueChanged() ) );
466 connect( contextDefaultsWidgetDefaultColorG_, SIGNAL( valueChanged(
int) ),
this, SLOT( slotContextDefaultsWidgetDefaultColorValueChanged() ) );
467 connect( contextDefaultsWidgetDefaultColorB_, SIGNAL( valueChanged(
int) ),
this, SLOT( slotContextDefaultsWidgetDefaultColorValueChanged() ) );
468 connect( contextDefaultsWidgetDefaultNormalX_, SIGNAL( valueChanged(
double) ),
this, SLOT( slotContextDefaultsWidgetDefaultNormalValueChanged() ) );
469 connect( contextDefaultsWidgetDefaultNormalY_, SIGNAL( valueChanged(
double) ),
this, SLOT( slotContextDefaultsWidgetDefaultNormalValueChanged() ) );
470 connect( contextDefaultsWidgetDefaultNormalZ_, SIGNAL( valueChanged(
double) ),
this, SLOT( slotContextDefaultsWidgetDefaultNormalValueChanged() ) );
471 connect( contextDefaultsWidgetDefaultPointsize_, SIGNAL( valueChanged(
double) ),
this, SLOT( slotContextDefaultsWidgetDefaultPointsizeValueChanged() ) );
478 QStringList viewModeToolboxes;
479 viewModeToolboxes +=
"Data Control";
480 viewModeToolboxes +=
"Selections";
481 viewModeToolboxes +=
"SplatCloud Estimator";
482 viewModeToolboxes +=
"SplatCloud Rendering Control";
485 QStringList viewModeToolbars;
486 viewModeToolbars +=
"Main Toolbar";
487 viewModeToolbars +=
"Viewer Toolbar";
488 viewModeToolbars +=
"Color Toolbar";
489 viewModeToolbars +=
"Viewing Directions";
490 viewModeToolbars +=
"Selection Base";
491 viewModeToolbars +=
"Backup Toolbar";
494 QStringList viewModeContextMenus;
495 viewModeContextMenus +=
"DataControl->Material Properties";
496 viewModeContextMenus +=
"DataControl->Object";
497 viewModeContextMenus +=
"SplatCloudEstimatorPlugin->SplatCloud Estimator";
498 viewModeContextMenus +=
"SplatCloudRenderingControlPlugin->SplatCloud Rendering Control";
499 viewModeContextMenus +=
"ViewControl->Visualization";
500 viewModeContextMenus +=
"Backup->&Redo";
501 viewModeContextMenus +=
"Backup->&Undo";
504 emit defineViewModeToolboxes (
"SplatCloud", viewModeToolboxes );
505 emit defineViewModeToolbars (
"SplatCloud", viewModeToolbars );
506 emit defineViewModeContextMenus(
"SplatCloud", viewModeContextMenus );
507 emit defineViewModeIcon (
"SplatCloud",
"SplatCloudType.png" );
514 void SplatCloudRenderingControlPlugin::addedEmptyObject(
int _objectId )
516 if( _objectId == -1 )
528 if( splatCloudObject )
539 toolboxDefaultColorG_-> value(),
540 toolboxDefaultColorB_-> value() ) );
542 toolboxDefaultNormalY_-> value(),
543 toolboxDefaultNormalZ_-> value() ) );
544 splatCloudNode->setDefaultPointsize( SplatCloudNode::Pointsize( toolboxDefaultPointsize_->value() ) );
553 void SplatCloudRenderingControlPlugin::slotUpdateContextMenu(
int _objectId )
555 if( _objectId == -1 )
567 if( splatCloudObject )
570 contextCullingAction_->setChecked( splatCloudObject->isBackfaceCullingEnabled() );
578 void SplatCloudRenderingControlPlugin::slotToolboxPointsizeScaleValueChanged()
581 double scale = toolboxPointsizeScale_->value();
599 void SplatCloudRenderingControlPlugin::slotToolboxDefaultColorValueChanged()
610 toolboxDefaultColorG_->value(),
611 toolboxDefaultColorB_->value() ) );
619 void SplatCloudRenderingControlPlugin::slotToolboxDefaultNormalValueChanged()
630 toolboxDefaultNormalY_->value(),
631 toolboxDefaultNormalZ_->value() ) );
639 void SplatCloudRenderingControlPlugin::slotToolboxDefaultPointsizeValueChanged()
649 splatCloudNode->setDefaultPointsize( SplatCloudNode::Pointsize( toolboxDefaultPointsize_->value() ) );
652 emit updatedObject( objIter->id(),
UPDATE_ALL );
660 void SplatCloudRenderingControlPlugin::slotToolboxEnableBackfaceCullingButtonClicked()
678 void SplatCloudRenderingControlPlugin::slotToolboxDisableBackfaceCullingButtonClicked()
696 void SplatCloudRenderingControlPlugin::slotToolboxReloadShadersButtonClicked()
716 void SplatCloudRenderingControlPlugin::slotToolboxRebuildVBOsButtonClicked()
726 splatCloudNode->modifiedAll();
729 emit updatedObject( objIter->id(),
UPDATE_ALL );
736 void SplatCloudRenderingControlPlugin::slotToolboxPointSizeButtonClicked()
753 void SplatCloudRenderingControlPlugin::slotToolboxGeometryShaderButtonClicked()
771 void SplatCloudRenderingControlPlugin::slotContextScaleActionTriggered()
774 int objectId = contextScaleAction_->data().toInt();
786 if( splatCloudObject )
789 double ps = splatCloudObject->pointsizeScale();
792 contextScaleWidgetPointsizeScale_->setValue( ps );
795 contextScaleWidget_->move( contextScaleAction_->associatedWidgets()[0]->mapToGlobal( QPoint() ) );
798 contextScaleWidget_->show();
806 void SplatCloudRenderingControlPlugin::slotContextScaleWidgetPointsizeScaleValueChanged()
809 int objectId = contextScaleAction_->data().toInt();
821 if( splatCloudObject )
824 double scale = contextScaleWidgetPointsizeScale_->value();
835 void SplatCloudRenderingControlPlugin::slotContextDefaultsActionTriggered()
838 int objectId = contextDefaultsAction_->data().toInt();
853 int cr = splatCloudNode->defaultColor()[0];
854 int cg = splatCloudNode->defaultColor()[1];
855 int cb = splatCloudNode->defaultColor()[2];
856 double nx = splatCloudNode->defaultNormal()[0];
857 double ny = splatCloudNode->defaultNormal()[1];
858 double nz = splatCloudNode->defaultNormal()[2];
859 double ps = splatCloudNode->defaultPointsize();
862 contextDefaultsWidgetDefaultColorR_-> setValue( cr );
863 contextDefaultsWidgetDefaultColorG_-> setValue( cg );
864 contextDefaultsWidgetDefaultColorB_-> setValue( cb );
865 contextDefaultsWidgetDefaultNormalX_-> setValue( nx );
866 contextDefaultsWidgetDefaultNormalY_-> setValue( ny );
867 contextDefaultsWidgetDefaultNormalZ_-> setValue( nz );
868 contextDefaultsWidgetDefaultPointsize_->setValue( ps );
871 contextDefaultsWidget_->move( contextDefaultsAction_->associatedWidgets()[0]->mapToGlobal( QPoint() ) );
874 contextDefaultsWidget_->show();
882 void SplatCloudRenderingControlPlugin::slotContextDefaultsWidgetDefaultColorValueChanged()
885 int objectId = contextDefaultsAction_->data().toInt();
900 splatCloudNode->setDefaultColor(
SplatCloudNode::Color( contextDefaultsWidgetDefaultColorR_->value(),
901 contextDefaultsWidgetDefaultColorG_->value(),
902 contextDefaultsWidgetDefaultColorB_->value() ) );
913 void SplatCloudRenderingControlPlugin::slotContextDefaultsWidgetDefaultNormalValueChanged()
916 int objectId = contextDefaultsAction_->data().toInt();
932 contextDefaultsWidgetDefaultNormalY_->value(),
933 contextDefaultsWidgetDefaultNormalZ_->value() ) );
944 void SplatCloudRenderingControlPlugin::slotContextDefaultsWidgetDefaultPointsizeValueChanged()
947 int objectId = contextDefaultsAction_->data().toInt();
962 splatCloudNode->setDefaultPointsize( SplatCloudNode::Pointsize( contextDefaultsWidgetDefaultPointsize_->value() ) );
973 void SplatCloudRenderingControlPlugin::slotContextCullingActionTriggered()
976 int objectId = contextCullingAction_->data().toInt();
988 if( splatCloudObject )
991 bool enable = contextCullingAction_->isChecked();
1005 void SplatCloudRenderingControlPlugin::slotContextReloadShadersActionTriggered()
1008 int objectId = contextReloadShadersAction_->data().toInt();
1009 if( objectId == -1 )
1020 if( splatCloudObject )
1036 void SplatCloudRenderingControlPlugin::slotContextRebuildVBOActionTriggered()
1039 int objectId = contextRebuildVBOAction_->data().toInt();
1040 if( objectId == -1 )
1051 if( splatCloudNode )
1054 splatCloudNode->modifiedAll();
void setPointsizeScale(float _scale)
Set the scaling factor for pointsizes for all Shaders.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
const QStringList ALL_OBJECTS
Iterable object range.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
SplatCloudObject * splatCloudObject(BaseObjectData *_object)
Cast an SplatCloudObject to a SplatCloudObject if possible.
void enableBackfaceCulling(bool _enable)
Enable or disable backface culling for all Shaders.
void reloadShaders()
Reload standard and picking Shaders from file.
SplatCloudNode * splatCloudNode(BaseObjectData *_object)
Get a SplatCloudNode from an object.
SplatCloudNode * splatCloudNode()
Get SplatCloud's scenegraph Node.
void enableGeometryShaderQuads(bool _enable)
Enable or disable quad extrusion in geometry shader (shader pipeline)