Developer Documentation
SplatCloudRenderingControlPlugin.cc
1 //================================================================
2 //
3 /*===========================================================================*\
4 * *
5 * OpenFlipper *
6  * Copyright (c) 2001-2015, RWTH-Aachen University *
7  * Department of Computer Graphics and Multimedia *
8  * All rights reserved. *
9  * www.openflipper.org *
10  * *
11  *---------------------------------------------------------------------------*
12  * This file is part of OpenFlipper. *
13  *---------------------------------------------------------------------------*
14  * *
15  * Redistribution and use in source and binary forms, with or without *
16  * modification, are permitted provided that the following conditions *
17  * are met: *
18  * *
19  * 1. Redistributions of source code must retain the above copyright notice, *
20  * this list of conditions and the following disclaimer. *
21  * *
22  * 2. Redistributions in binary form must reproduce the above copyright *
23  * notice, this list of conditions and the following disclaimer in the *
24  * documentation and/or other materials provided with the distribution. *
25  * *
26  * 3. Neither the name of the copyright holder nor the names of its *
27  * contributors may be used to endorse or promote products derived from *
28  * this software without specific prior written permission. *
29  * *
30  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
31  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
32  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
33  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
34  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
35  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
36  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
37  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
38  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
39  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
40  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
41 * *
42 \*===========================================================================*/
43 
44 
45 //================================================================
46 //
47 // CLASS SplatCloudRenderingControlPlugin - IMPLEMENTATION
48 //
49 //================================================================
50 
51 
52 //== INCLUDES ====================================================
53 
54 
55 #include "SplatCloudRenderingControlPlugin.hh"
56 
58 
60 
62 
63 #include <QHBoxLayout>
64 #include <QPushButton>
65 #include <QRadioButton>
66 #include <QLabel>
67 #include <QMenu>
68 #include <QTabWidget>
69 
70 
71 
72 //== IMPLEMENTATION ==============================================
73 
74 
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 )
99 {
100 }
101 
102 
103 //----------------------------------------------------------------
104 
105 
106 void SplatCloudRenderingControlPlugin::initializePlugin()
107 {
108  // --------------------------------
109  // -------- create toolbox --------
110  // --------------------------------
111 
112  // ---- options tab ----
113 
114  // pointsize scale
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" );
121 
122  // pointsize scale layout
123  QHBoxLayout *toolboxPointsizeScaleLayout = new QHBoxLayout();
124  toolboxPointsizeScaleLayout->setSpacing( 6 );
125  toolboxPointsizeScaleLayout->addWidget( new QLabel( "Pointsize Scaling Factor:" ) );
126  toolboxPointsizeScaleLayout->addWidget( toolboxPointsizeScale_ );
127 
128  // buttons
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" );
141 
142  toolboxPointSizeButton->setChecked(true);
143 
144  // buttonsA layout
145  QHBoxLayout *toolboxButtonsALayout = new QHBoxLayout();
146  toolboxButtonsALayout->setSpacing( 6 );
147  toolboxButtonsALayout->addWidget( toolboxEnableBackfaceCullingButton );
148  toolboxButtonsALayout->addWidget( toolboxDisableBackfaceCullingButton );
149 
150  // separator frame
151  QFrame *toolboxSeparatorFrame = new QFrame();
152  toolboxSeparatorFrame->setFrameShape( QFrame::HLine );
153  toolboxSeparatorFrame->setFrameShadow( QFrame::Sunken );
154 
155  // buttonsB layout
156  QHBoxLayout *toolboxButtonsBLayout = new QHBoxLayout();
157  toolboxButtonsBLayout->setSpacing( 6 );
158  toolboxButtonsBLayout->addWidget( toolboxReloadShadersButton );
159  toolboxButtonsBLayout->addWidget( toolboxRebuildVBOsButton );
160 
161  // separator frame
162  QFrame *toolboxSeparatorFrameBC = new QFrame();
163  toolboxSeparatorFrameBC->setFrameShape(QFrame::HLine);
164  toolboxSeparatorFrameBC->setFrameShadow(QFrame::Sunken);
165 
166  // buttonsC layout
167  QHBoxLayout *toolboxButtonsCLayout = new QHBoxLayout();
168  toolboxButtonsCLayout->setSpacing(6);
169  toolboxButtonsCLayout->addWidget(toolboxPointSizeButton);
170  toolboxButtonsCLayout->addWidget(toolboxGeometryShaderButton);
171 
172  // options layout
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 );
184 
185  // options widget
186  QWidget *toolboxOptionsWidget = new QWidget();
187  toolboxOptionsWidget->setLayout( toolboxOptionsLayout );
188  toolboxOptionsWidget->setToolTip( "Rendering options" );
189 
190  // ---- defaults tab ----
191 
192  // default color
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" );
208 
209  // default normal
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" );
228 
229  // default pointsize
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" );
236 
237  // default color layout
238  QHBoxLayout *toolboxDefaultColorLayout = new QHBoxLayout();
239  toolboxDefaultColorLayout->setSpacing( 6 );
240  toolboxDefaultColorLayout->addWidget( toolboxDefaultColorR_ );
241  toolboxDefaultColorLayout->addWidget( toolboxDefaultColorG_ );
242  toolboxDefaultColorLayout->addWidget( toolboxDefaultColorB_ );
243 
244  // default normal layout
245  QHBoxLayout *toolboxDefaultNormalLayout = new QHBoxLayout();
246  toolboxDefaultNormalLayout->setSpacing( 6 );
247  toolboxDefaultNormalLayout->addWidget( toolboxDefaultNormalX_ );
248  toolboxDefaultNormalLayout->addWidget( toolboxDefaultNormalY_ );
249  toolboxDefaultNormalLayout->addWidget( toolboxDefaultNormalZ_ );
250 
251  // default pointsize layout
252  QHBoxLayout *toolboxDefaultPointsizeLayout = new QHBoxLayout();
253  toolboxDefaultPointsizeLayout->setSpacing( 6 );
254  toolboxDefaultPointsizeLayout->addWidget( toolboxDefaultPointsize_ );
255 
256  // default options layout
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 );
265 
266  // defaults widget
267  QWidget *toolboxDefaultsWidget = new QWidget();
268  toolboxDefaultsWidget->setLayout( toolboxDefaultsLayout );
269  toolboxDefaultsWidget->setToolTip( "Default values" );
270 
271  // ----
272 
273  // tab widget
274  QTabWidget *toolboxTabWidget = new QTabWidget();
275  toolboxTabWidget->addTab( toolboxOptionsWidget, "Options" );
276  toolboxTabWidget->addTab( toolboxDefaultsWidget, "Defaults" );
277 
278  // toolbox layout
279  QVBoxLayout *toolboxLayout = new QVBoxLayout();
280  toolboxLayout->setSpacing( 6 );
281  toolboxLayout->addWidget( toolboxTabWidget );
282 
283  // toolbox
284  QWidget *toolbox = new QWidget();
285  toolbox->setLayout( toolboxLayout );
286 
287  // toolbox icon
288  QIcon *toolboxIcon = new QIcon( OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() + "SplatCloudRenderingControl.png" );
289 
290  // ----
291 
292  // connect events to slots
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() ) );
301 
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() ) );
308 
309  // emit signal to add the new toolbox
310  emit addToolbox( tr("SplatCloud Rendering Control") , toolbox , toolboxIcon );
311 
312  // -------------------------------------
313  // -------- create context menu --------
314  // -------------------------------------
315 
316  // actions
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 );
323 
324  // context menu
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_ );
334 
335  // ----
336 
337  // connect events to slots
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() ) );
343 
344  // emit signal to add the new context menu
345  emit addContextMenuItem( contextMenu->menuAction(), DATA_SPLATCLOUD, CONTEXTOBJECTMENU );
346 
347  // --------------------------------------------------
348  // -------- create context menu scale widget --------
349  // --------------------------------------------------
350 
351  // pointsize scale
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" );
357 
358  // pointsize scale layout
359  QHBoxLayout *contextScaleWidgetPointsizeScaleLayout = new QHBoxLayout();
360  contextScaleWidgetPointsizeScaleLayout->setSpacing( 6 );
361  contextScaleWidgetPointsizeScaleLayout->addWidget( new QLabel( "Pointsize Scaling Factor:" ) );
362  contextScaleWidgetPointsizeScaleLayout->addWidget( contextScaleWidgetPointsizeScale_ );
363 
364  // widget layout
365  QVBoxLayout *contextScaleWidgetLayout = new QVBoxLayout();
366  contextScaleWidgetLayout->setAlignment( Qt::AlignTop );
367  contextScaleWidgetLayout->setSpacing( 6 );
368  contextScaleWidgetLayout->addItem( contextScaleWidgetPointsizeScaleLayout );
369 
370  // widget
371  contextScaleWidget_ = new QWidget();
372  contextScaleWidget_->setWindowTitle( "Pointsize Scaling Factor" );
373  contextScaleWidget_->setLayout( contextScaleWidgetLayout );
374 
375  // ----
376 
377  // connect events to slots
378  connect( contextScaleWidgetPointsizeScale_, SIGNAL( valueChanged(double) ), this, SLOT( slotContextScaleWidgetPointsizeScaleValueChanged() ) );
379 
380  // -----------------------------------------------------
381  // -------- create context menu defaults widget --------
382  // -----------------------------------------------------
383 
384  // default color
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" );
397 
398  // default normal
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" );
414 
415  // default pointsize
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" );
421 
422  // default color layout
423  QHBoxLayout *contextDefaultsWidgetDefaultColorLayout = new QHBoxLayout();
424  contextDefaultsWidgetDefaultColorLayout->setSpacing( 6 );
425  contextDefaultsWidgetDefaultColorLayout->addWidget( contextDefaultsWidgetDefaultColorR_ );
426  contextDefaultsWidgetDefaultColorLayout->addWidget( contextDefaultsWidgetDefaultColorG_ );
427  contextDefaultsWidgetDefaultColorLayout->addWidget( contextDefaultsWidgetDefaultColorB_ );
428 
429  // default normal layout
430  QHBoxLayout *contextDefaultsWidgetDefaultNormalLayout = new QHBoxLayout();
431  contextDefaultsWidgetDefaultNormalLayout->setSpacing( 6 );
432  contextDefaultsWidgetDefaultNormalLayout->addWidget( contextDefaultsWidgetDefaultNormalX_ );
433  contextDefaultsWidgetDefaultNormalLayout->addWidget( contextDefaultsWidgetDefaultNormalY_ );
434  contextDefaultsWidgetDefaultNormalLayout->addWidget( contextDefaultsWidgetDefaultNormalZ_ );
435 
436  // default pointsize layout
437  QHBoxLayout *contextDefaultsWidgetDefaultPointsizeLayout = new QHBoxLayout();
438  contextDefaultsWidgetDefaultPointsizeLayout->setSpacing( 6 );
439  contextDefaultsWidgetDefaultPointsizeLayout->addWidget( contextDefaultsWidgetDefaultPointsize_ );
440 
441  // default options layout
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 );
450 
451  // widget layout
452  QVBoxLayout *contextDefaultsWidgetLayout = new QVBoxLayout();
453  contextDefaultsWidgetLayout->setAlignment( Qt::AlignTop );
454  contextDefaultsWidgetLayout->setSpacing( 6 );
455  contextDefaultsWidgetLayout->addItem( contextDefaultsWidgetDefaultOptionsLayout );
456 
457  // widget
458  contextDefaultsWidget_ = new QWidget();
459  contextDefaultsWidget_->setWindowTitle( "Defaults" );
460  contextDefaultsWidget_->setLayout( contextDefaultsWidgetLayout );
461 
462  // ----
463 
464  // connect events to slots
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() ) );
472 
473  // ----------------------------------
474  // -------- create view mode --------
475  // ----------------------------------
476 
477  // toolboxes
478  QStringList viewModeToolboxes;
479  viewModeToolboxes += "Data Control";
480  viewModeToolboxes += "Selections";
481  viewModeToolboxes += "SplatCloud Estimator";
482  viewModeToolboxes += "SplatCloud Rendering Control";
483 
484  // toolbars
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";
492 
493  // context menus
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";
502 
503  // emit signals to add new viewmode
504  emit defineViewModeToolboxes ( "SplatCloud", viewModeToolboxes );
505  emit defineViewModeToolbars ( "SplatCloud", viewModeToolbars );
506  emit defineViewModeContextMenus( "SplatCloud", viewModeContextMenus );
507  emit defineViewModeIcon ( "SplatCloud", "SplatCloudType.png" );
508 }
509 
510 
511 //----------------------------------------------------------------
512 
513 
514 void SplatCloudRenderingControlPlugin::addedEmptyObject( int _objectId )
515 {
516  if( _objectId == -1 )
517  return;
518 
519  // get object by id
520  BaseObjectData *object;
521  if( !PluginFunctions::getObject( _objectId, object ) )
522  return;
523 
524  // get splatcloud-object
526 
527  // if object is a SplatCloud...
528  if( splatCloudObject )
529  {
530  // set current rendering options
531  splatCloudObject->enableBackfaceCulling( false );
532  splatCloudObject->setPointsizeScale ( toolboxPointsizeScale_->value() );
533 
534  // set default values
535  SplatCloudNode *splatCloudNode = splatCloudObject->splatCloudNode();
536  if( splatCloudNode )
537  {
538  splatCloudNode->setDefaultColor ( SplatCloudNode::Color ( toolboxDefaultColorR_-> value(),
539  toolboxDefaultColorG_-> value(),
540  toolboxDefaultColorB_-> value() ) );
541  splatCloudNode->setDefaultNormal ( SplatCloudNode::Normal ( toolboxDefaultNormalX_-> value(),
542  toolboxDefaultNormalY_-> value(),
543  toolboxDefaultNormalZ_-> value() ) );
544  splatCloudNode->setDefaultPointsize( SplatCloudNode::Pointsize( toolboxDefaultPointsize_->value() ) );
545  }
546  }
547 }
548 
549 
550 //----------------------------------------------------------------
551 
552 
553 void SplatCloudRenderingControlPlugin::slotUpdateContextMenu( int _objectId )
554 {
555  if( _objectId == -1 )
556  return;
557 
558  // get object by id
559  BaseObjectData *object;
560  if( !PluginFunctions::getObject( _objectId, object ) )
561  return;
562 
563  // get splatcloud-object
564  SplatCloudObject *splatCloudObject = PluginFunctions::splatCloudObject( object );
565 
566  // if object is a SplatCloud...
567  if( splatCloudObject )
568  {
569  // update context menu value
570  contextCullingAction_->setChecked( splatCloudObject->isBackfaceCullingEnabled() );
571  }
572 }
573 
574 
575 //----------------------------------------------------------------
576 
577 
578 void SplatCloudRenderingControlPlugin::slotToolboxPointsizeScaleValueChanged()
579 {
580  // get toolbox option value
581  double scale = toolboxPointsizeScale_->value();
582 
583  // for all splatcloud-objects...
585  for( ; objIter != PluginFunctions::objectsEnd(); ++objIter )
586  {
587  // get splatcloud-object
588  SplatCloudObject *splatCloudObject = PluginFunctions::splatCloudObject( *objIter );
589 
590  // apply update
591  splatCloudObject->setPointsizeScale( scale );
592  }
593 }
594 
595 
596 //----------------------------------------------------------------
597 
598 
599 void SplatCloudRenderingControlPlugin::slotToolboxDefaultColorValueChanged()
600 {
601  // for all splatcloud-objects...
603  for( ; objIter != PluginFunctions::objectsEnd(); ++objIter )
604  {
605  // get scenegraph splatcloud-node
606  SplatCloudNode *splatCloudNode = PluginFunctions::splatCloudNode( *objIter );
607 
608  // apply update (set default color)
609  splatCloudNode->setDefaultColor( SplatCloudNode::Color( toolboxDefaultColorR_->value(),
610  toolboxDefaultColorG_->value(),
611  toolboxDefaultColorB_->value() ) );
612  }
613 }
614 
615 
616 //----------------------------------------------------------------
617 
618 
619 void SplatCloudRenderingControlPlugin::slotToolboxDefaultNormalValueChanged()
620 {
621  // for all splatcloud-objects...
623  for( ; objIter != PluginFunctions::objectsEnd(); ++objIter )
624  {
625  // get scenegraph splatcloud-node
626  SplatCloudNode *splatCloudNode = PluginFunctions::splatCloudNode( *objIter );
627 
628  // apply update (set default normal)
629  splatCloudNode->setDefaultNormal( SplatCloudNode::Normal( toolboxDefaultNormalX_->value(),
630  toolboxDefaultNormalY_->value(),
631  toolboxDefaultNormalZ_->value() ) );
632  }
633 }
634 
635 
636 //----------------------------------------------------------------
637 
638 
639 void SplatCloudRenderingControlPlugin::slotToolboxDefaultPointsizeValueChanged()
640 {
641  // for all splatcloud-objects...
643  for( ; objIter != PluginFunctions::objectsEnd(); ++objIter )
644  {
645  // get scenegraph splatcloud-node
646  SplatCloudNode *splatCloudNode = PluginFunctions::splatCloudNode( *objIter );
647 
648  // apply update (set default pointsize)
649  splatCloudNode->setDefaultPointsize( SplatCloudNode::Pointsize( toolboxDefaultPointsize_->value() ) );
650 
651  // emit signal that object has to be updated
652  emit updatedObject( objIter->id(), UPDATE_ALL );
653  }
654 }
655 
656 
657 //----------------------------------------------------------------
658 
659 
660 void SplatCloudRenderingControlPlugin::slotToolboxEnableBackfaceCullingButtonClicked()
661 {
662  // for all splatcloud-objects...
664  for( ; objIter != PluginFunctions::objectsEnd(); ++objIter )
665  {
666  // get splatcloud-object
667  SplatCloudObject *splatCloudObject = PluginFunctions::splatCloudObject( *objIter );
668 
669  // apply update
670  splatCloudObject->enableBackfaceCulling( true );
671  }
672 }
673 
674 
675 //----------------------------------------------------------------
676 
677 
678 void SplatCloudRenderingControlPlugin::slotToolboxDisableBackfaceCullingButtonClicked()
679 {
680  // for all splatcloud-objects...
682  for( ; objIter != PluginFunctions::objectsEnd(); ++objIter )
683  {
684  // get splatcloud-object
685  SplatCloudObject *splatCloudObject = PluginFunctions::splatCloudObject( *objIter );
686 
687  // apply update
688  splatCloudObject->enableBackfaceCulling( false );
689  }
690 }
691 
692 
693 //----------------------------------------------------------------
694 
695 
696 void SplatCloudRenderingControlPlugin::slotToolboxReloadShadersButtonClicked()
697 {
698  // for all splatcloud-objects...
700  for( ; objIter != PluginFunctions::objectsEnd(); ++objIter )
701  {
702  // get scenegraph splatcloud-object
703  SplatCloudObject *splatCloudObject = PluginFunctions::splatCloudObject( *objIter );
704 
705  // apply update (reload standard and picking shaders and re-set uniforms)
706  splatCloudObject->reloadShaders();
707  splatCloudObject->setPointsizeScale ( splatCloudObject->pointsizeScale() );
708  splatCloudObject->enableBackfaceCulling( splatCloudObject->isBackfaceCullingEnabled() );
709  }
710 }
711 
712 
713 //----------------------------------------------------------------
714 
715 
716 void SplatCloudRenderingControlPlugin::slotToolboxRebuildVBOsButtonClicked()
717 {
718  // for all splatcloud-objects...
720  for( ; objIter != PluginFunctions::objectsEnd(); ++objIter )
721  {
722  // get scenegraph splatcloud-node
723  SplatCloudNode *splatCloudNode = PluginFunctions::splatCloudNode( *objIter );
724 
725  // rebuild the vertex-buffer-object the next time the node is drawn (or picked)
726  splatCloudNode->modifiedAll();
727 
728  // emit signal that object has to be updated
729  emit updatedObject( objIter->id(), UPDATE_ALL );
730  }
731 }
732 
733 //----------------------------------------------------------------
734 
735 
736 void SplatCloudRenderingControlPlugin::slotToolboxPointSizeButtonClicked()
737 {
738  // for all splatcloud-objects...
740  for (; objIter != PluginFunctions::objectsEnd(); ++objIter)
741  {
742  // get splatcloud-object
743  SplatCloudObject *splatCloudObject = PluginFunctions::splatCloudObject(*objIter);
744 
745  // apply update
746  splatCloudObject->enableGeometryShaderQuads(false);
747  }
748 }
749 
750 //----------------------------------------------------------------
751 
752 
753 void SplatCloudRenderingControlPlugin::slotToolboxGeometryShaderButtonClicked()
754 {
755  // for all splatcloud-objects...
757  for (; objIter != PluginFunctions::objectsEnd(); ++objIter)
758  {
759  // get splatcloud-object
760  SplatCloudObject *splatCloudObject = PluginFunctions::splatCloudObject(*objIter);
761 
762  // apply update
763  splatCloudObject->enableGeometryShaderQuads(true);
764  }
765 }
766 
767 
768 //----------------------------------------------------------------
769 
770 
771 void SplatCloudRenderingControlPlugin::slotContextScaleActionTriggered()
772 {
773  // get picked object by id
774  int objectId = contextScaleAction_->data().toInt();
775  if( objectId == -1 )
776  return;
777  //
778  BaseObjectData *object;
779  if( ! PluginFunctions::getObject( objectId, object ) )
780  return;
781 
782  // get splatcloud-object
783  SplatCloudObject *splatCloudObject = PluginFunctions::splatCloudObject( object );
784 
785  // if object is a SplatCloud...
786  if( splatCloudObject )
787  {
788  // get value from SplatCloud
789  double ps = splatCloudObject->pointsizeScale();
790 
791  // update widget option value
792  contextScaleWidgetPointsizeScale_->setValue( ps );
793 
794  // move widget to position of context menu entry
795  contextScaleWidget_->move( contextScaleAction_->associatedWidgets()[0]->mapToGlobal( QPoint() ) );
796 
797  // show widget
798  contextScaleWidget_->show();
799  }
800 }
801 
802 
803 //----------------------------------------------------------------
804 
805 
806 void SplatCloudRenderingControlPlugin::slotContextScaleWidgetPointsizeScaleValueChanged()
807 {
808  // get picked object by id
809  int objectId = contextScaleAction_->data().toInt();
810  if( objectId == -1 )
811  return;
812  //
813  BaseObjectData *object;
814  if( ! PluginFunctions::getObject( objectId, object ) )
815  return;
816 
817  // get splatcloud-object
818  SplatCloudObject *splatCloudObject = PluginFunctions::splatCloudObject( object );
819 
820  // if object is a SplatCloud...
821  if( splatCloudObject )
822  {
823  // get widget option value
824  double scale = contextScaleWidgetPointsizeScale_->value();
825 
826  // apply update (set pointsize scale)
827  splatCloudObject->setPointsizeScale( scale );
828  }
829 }
830 
831 
832 //----------------------------------------------------------------
833 
834 
835 void SplatCloudRenderingControlPlugin::slotContextDefaultsActionTriggered()
836 {
837  // get picked object by id
838  int objectId = contextDefaultsAction_->data().toInt();
839  if( objectId == -1 )
840  return;
841  //
842  BaseObjectData *object;
843  if( ! PluginFunctions::getObject( objectId, object ) )
844  return;
845 
846  // get splatcloud-node
847  SplatCloudNode *splatCloudNode = PluginFunctions::splatCloudNode( object );
848 
849  // if object is a SplatCloud...
850  if( splatCloudNode )
851  {
852  // get values from SplatCloud
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();
860 
861  // update widget option values
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 );
869 
870  // move defaults widget to position of context menu entry
871  contextDefaultsWidget_->move( contextDefaultsAction_->associatedWidgets()[0]->mapToGlobal( QPoint() ) );
872 
873  // show widget
874  contextDefaultsWidget_->show();
875  }
876 }
877 
878 
879 //----------------------------------------------------------------
880 
881 
882 void SplatCloudRenderingControlPlugin::slotContextDefaultsWidgetDefaultColorValueChanged()
883 {
884  // get picked object by id
885  int objectId = contextDefaultsAction_->data().toInt();
886  if( objectId == -1 )
887  return;
888  //
889  BaseObjectData *object;
890  if( ! PluginFunctions::getObject( objectId, object ) )
891  return;
892 
893  // get splatcloud-node
894  SplatCloudNode *splatCloudNode = PluginFunctions::splatCloudNode( object );
895 
896  // if object is a SplatCloud...
897  if( splatCloudNode )
898  {
899  // apply update (set default color)
900  splatCloudNode->setDefaultColor( SplatCloudNode::Color( contextDefaultsWidgetDefaultColorR_->value(),
901  contextDefaultsWidgetDefaultColorG_->value(),
902  contextDefaultsWidgetDefaultColorB_->value() ) );
903 
904  // emit signal that the object has to be updated
905  emit updatedObject( object->id(), UPDATE_ALL );
906  }
907 }
908 
909 
910 //----------------------------------------------------------------
911 
912 
913 void SplatCloudRenderingControlPlugin::slotContextDefaultsWidgetDefaultNormalValueChanged()
914 {
915  // get picked object by id
916  int objectId = contextDefaultsAction_->data().toInt();
917  if( objectId == -1 )
918  return;
919  //
920  BaseObjectData *object;
921  if( ! PluginFunctions::getObject( objectId, object ) )
922  return;
923 
924  // get splatcloud-node
925  SplatCloudNode *splatCloudNode = PluginFunctions::splatCloudNode( object );
926 
927  // if object is a SplatCloud...
928  if( splatCloudNode )
929  {
930  // apply update (set default normal)
931  splatCloudNode->setDefaultNormal( SplatCloudNode::Normal( contextDefaultsWidgetDefaultNormalX_->value(),
932  contextDefaultsWidgetDefaultNormalY_->value(),
933  contextDefaultsWidgetDefaultNormalZ_->value() ) );
934 
935  // emit signal that the object has to be updated
936  emit updatedObject( object->id(), UPDATE_ALL );
937  }
938 }
939 
940 
941 //----------------------------------------------------------------
942 
943 
944 void SplatCloudRenderingControlPlugin::slotContextDefaultsWidgetDefaultPointsizeValueChanged()
945 {
946  // get picked object by id
947  int objectId = contextDefaultsAction_->data().toInt();
948  if( objectId == -1 )
949  return;
950  //
951  BaseObjectData *object;
952  if( ! PluginFunctions::getObject( objectId, object ) )
953  return;
954 
955  // get splatcloud-node
956  SplatCloudNode *splatCloudNode = PluginFunctions::splatCloudNode( object );
957 
958  // if object is a SplatCloud...
959  if( splatCloudNode )
960  {
961  // apply update (set default pointsize)
962  splatCloudNode->setDefaultPointsize( SplatCloudNode::Pointsize( contextDefaultsWidgetDefaultPointsize_->value() ) );
963 
964  // emit signal that the object has to be updated
965  emit updatedObject( object->id(), UPDATE_ALL );
966  }
967 }
968 
969 
970 //----------------------------------------------------------------
971 
972 
973 void SplatCloudRenderingControlPlugin::slotContextCullingActionTriggered()
974 {
975  // get picked object by id
976  int objectId = contextCullingAction_->data().toInt();
977  if( objectId == -1 )
978  return;
979  //
980  BaseObjectData *object;
981  if( ! PluginFunctions::getObject( objectId, object ) )
982  return;
983 
984  // get splatcloud-object
985  SplatCloudObject *splatCloudObject = PluginFunctions::splatCloudObject( object );
986 
987  // if object is a SplatCloud...
988  if( splatCloudObject )
989  {
990  // get context menu option value
991  bool enable = contextCullingAction_->isChecked();
992 
993  // apply update
994  splatCloudObject->enableBackfaceCulling( enable );
995 
996  // emit signal that the object has to be updated
997  emit updatedObject( object->id(), UPDATE_ALL );
998  }
999 }
1000 
1001 
1002 //----------------------------------------------------------------
1003 
1004 
1005 void SplatCloudRenderingControlPlugin::slotContextReloadShadersActionTriggered()
1006 {
1007  // get picked object by id
1008  int objectId = contextReloadShadersAction_->data().toInt();
1009  if( objectId == -1 )
1010  return;
1011  //
1012  BaseObjectData *object;
1013  if( ! PluginFunctions::getObject( objectId, object ) )
1014  return;
1015 
1016  // get splatcloud-object
1017  SplatCloudObject *splatCloudObject = PluginFunctions::splatCloudObject( object );
1018 
1019  // if object is a SplatCloud...
1020  if( splatCloudObject )
1021  {
1022  // apply update (reload standard and picking shaders and re-set uniforms)
1023  splatCloudObject->reloadShaders();
1024  splatCloudObject->setPointsizeScale ( splatCloudObject->pointsizeScale() );
1025  splatCloudObject->enableBackfaceCulling( splatCloudObject->isBackfaceCullingEnabled() );
1026 
1027  // emit signal that object has to be updated
1028  emit updatedObject( object->id(), UPDATE_ALL );
1029  }
1030 }
1031 
1032 
1033 //----------------------------------------------------------------
1034 
1035 
1036 void SplatCloudRenderingControlPlugin::slotContextRebuildVBOActionTriggered()
1037 {
1038  // get picked object by id
1039  int objectId = contextRebuildVBOAction_->data().toInt();
1040  if( objectId == -1 )
1041  return;
1042  //
1043  BaseObjectData *object;
1044  if( ! PluginFunctions::getObject( objectId, object ) )
1045  return;
1046 
1047  // get splatcloud-node
1048  SplatCloudNode *splatCloudNode = PluginFunctions::splatCloudNode( object );
1049 
1050  // if object is a SplatCloud...
1051  if( splatCloudNode )
1052  {
1053  // rebuild the vertex-buffer-object the next time the node is drawn (or picked)
1054  splatCloudNode->modifiedAll();
1055 
1056  // emit signal that object has to be updated
1057  emit updatedObject( object->id(), UPDATE_ALL );
1058  }
1059 }
1060 
1061 
1062 //================================================================
1063 
1064 
1065 
1066 
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.
#define DATA_SPLATCLOUD
Definition: SplatCloud.hh:59
int id() const
Definition: BaseObject.cc:190
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&#39;s scenegraph Node.
The Menu will be shown when an object was picked.
void enableGeometryShaderQuads(bool _enable)
Enable or disable quad extrusion in geometry shader (shader pipeline)