SplatCloudObject.cc 20.5 KB
Newer Older
Jan Möbius's avatar
Jan Möbius committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*===========================================================================*\
*                                                                            *
*                              OpenFlipper                                   *
*      Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen       *
*                           www.openflipper.org                              *
*                                                                            *
*--------------------------------------------------------------------------- *
*  This file is part of OpenFlipper.                                         *
*                                                                            *
*  OpenFlipper is free software: you can redistribute it and/or modify       *
*  it under the terms of the GNU Lesser General Public License as            *
*  published by the Free Software Foundation, either version 3 of            *
*  the License, or (at your option) any later version with the               *
*  following exceptions:                                                     *
*                                                                            *
*  If other files instantiate templates or use macros                        *
*  or inline functions from this file, or you compile this file and          *
*  link it with other files to produce an executable, this file does         *
*  not by itself cause the resulting executable to be covered by the         *
*  GNU Lesser General Public License. This exception does not however        *
*  invalidate any other reasons why the executable file might be             *
*  covered by the GNU Lesser General Public License.                         *
*                                                                            *
*  OpenFlipper is distributed in the hope that it will be useful,            *
*  but WITHOUT ANY WARRANTY; without even the implied warranty of            *
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
*  GNU Lesser General Public License for more details.                       *
*                                                                            *
*  You should have received a copy of the GNU LesserGeneral Public           *
*  License along with OpenFlipper. If not,                                   *
*  see <http://www.gnu.org/licenses/>.                                       *
*                                                                            *
\*===========================================================================*/

/*===========================================================================*\
*                                                                            *
*   $Revision$                                                       *
*   $LastChangedBy$                                                *
*   $Date$                     *
*                                                                            *
\*===========================================================================*/

//================================================================
//
//  SplatCloudObject
//
//================================================================


#define SPLATCLOUDOBJECT_C


//== INCLUDES ====================================================


#include "SplatCloud.hh"
#include <OpenFlipper/common/Types.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
59
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
Jan Möbius's avatar
Jan Möbius committed
60
61
62
63
#include <ACG/Scenegraph/DrawModes.hh>
#include <QString>


Jan Möbius's avatar
Jan Möbius committed
64
65
66
67
68
69
//== DEFINES =====================================================


//#define REPORT_UPDATE_TYPE


Jan Möbius's avatar
Jan Möbius committed
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//== IMPLEMENTATION ==============================================


/** Constructor for SplatCloud Objects. This object class gets a Separator Node giving
 *  the root node to which it should be connected. The SplatCloud is generated internally
 *  and all nodes for visualization will be added below the scenegraph node.\n
 *  You dont need to create an object of this type manually. Use
 *  PluginFunctions::addSplatCloud instead. ( see Types.hh::DataType )
 */
SplatCloudObject::SplatCloudObject() : 
BaseObjectData         (       ), 
backfaceCullingEnabled_( false ), 
pointsizeScale_        ( 1.0f  ), 
shaderNode_            ( 0     ), 
84
splatCloudNode_        ( 0     ) 
Jan Möbius's avatar
Jan Möbius committed
85
{
86
87
88
89
90
91
92
93
94
95
  // allocate memory for splat cloud
  splatCloud_ = new SplatCloud;
  if( !splatCloud_ )
  {
    std::cerr << "SplatCloudObject::SplatCloudObject() : Out of memory." << std::endl;
  }

  setDataType( DATA_SPLATCLOUD );
  setTypeIcon( DATA_SPLATCLOUD, "SplatCloudType.png" );
  init();
Jan Möbius's avatar
Jan Möbius committed
96
97
98
99
100
101
102
103
104
}


//----------------------------------------------------------------


/**
 * Copy Constructor - generates a copy of the given object
 */
105
SplatCloudObject::SplatCloudObject( const SplatCloudObject &_object ) : BaseObjectData( _object )
Jan Möbius's avatar
Jan Möbius committed
106
{
107
108
  init( _object.splatCloud_ );
  setName( name() );
Jan Möbius's avatar
Jan Möbius committed
109
110
111
112
113
114
115
116
117
118
119
}


//----------------------------------------------------------------


/** Destructor for SplatCloud Objects. The destructor deletes the Line and all
 *  Scenegraph nodes associated with the SplatCloud or the object.
 */
SplatCloudObject::~SplatCloudObject()
{
120
121
122
123
124
125
126
127
128
129
130
131
132
133
  // Delete the data attached to this object ( this will remove all perObject data)
  // Not the best way to do it but it will work.
  // This is only necessary if people use references to the SplatCloud below and
  // they do something with the SplatCloud in the destructor of their
  // perObjectData.
  deleteData();

  // No need to delete the scenegraph Nodes as this will be managed by baseplugin
  shaderNode_     = 0;
  splatCloudNode_ = 0;

  // free memory of splat cloud
  delete splatCloud_;
  splatCloud_ = 0;
Jan Möbius's avatar
Jan Möbius committed
134
135
136
137
138
139
140
141
142
143
144
}


//----------------------------------------------------------------


/** Cleanup Function for SplatCloud Objects. Deletes the contents of the whole object and
 * calls SplatCloudObject::init afterwards.
 */
void SplatCloudObject::cleanup()
{
145
  BaseObjectData::cleanup();
Jan Möbius's avatar
Jan Möbius committed
146

147
148
  shaderNode_     = 0;
  splatCloudNode_ = 0;
Jan Möbius's avatar
Jan Möbius committed
149

150
  init();
Jan Möbius's avatar
Jan Möbius committed
151
152
153
154
155
156
157
158
159
160
161
}


//----------------------------------------------------------------


/**
 * Generate a copy
 */
BaseObject *SplatCloudObject::copy()
{
162
163
  SplatCloudObject *object = new SplatCloudObject( *this );
  return dynamic_cast<BaseObject *>( object );
Jan Möbius's avatar
Jan Möbius committed
164
165
166
167
168
169
170
171
172
173
174
}


//----------------------------------------------------------------


/**
 * Reload shaders from file
 */
void SplatCloudObject::reloadShaders()
{
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
  // standard shader filenames
  static const char SPLATS_VERTEXSHADER_FILENAME[]   = "SplatCloud_Splats/Vertex.glsl";
  static const char SPLATS_FRAGMENTSHADER_FILENAME[] = "SplatCloud_Splats/Fragment.glsl";
  static const char DOTS_VERTEXSHADER_FILENAME[]     = "SplatCloud_Dots/Vertex.glsl";
  static const char DOTS_FRAGMENTSHADER_FILENAME[]   = "SplatCloud_Dots/Fragment.glsl";
  static const char POINTS_VERTEXSHADER_FILENAME[]   = "SplatCloud_Points/Vertex.glsl";
  static const char POINTS_FRAGMENTSHADER_FILENAME[] = "SplatCloud_Points/Fragment.glsl";

  // picking shader filenames
  static const char SPLATS_PICK_VERTEXSHADER_FILENAME[]   = "SplatCloud_Splats/PickVertex.glsl";
  static const char SPLATS_PICK_FRAGMENTSHADER_FILENAME[] = "SplatCloud_Splats/Fragment.glsl";
  static const char DOTS_PICK_VERTEXSHADER_FILENAME[]     = "SplatCloud_Dots/PickVertex.glsl";
  static const char DOTS_PICK_FRAGMENTSHADER_FILENAME[]   = "SplatCloud_Dots/Fragment.glsl";
  static const char POINTS_PICK_VERTEXSHADER_FILENAME[]   = "SplatCloud_Points/PickVertex.glsl";
  static const char POINTS_PICK_FRAGMENTSHADER_FILENAME[] = "SplatCloud_Points/Fragment.glsl";

  // get drawmodes
  ACG::SceneGraph::DrawModes::DrawMode splatsDrawMode = ACG::SceneGraph::DrawModes::getDrawMode( "Splats" );
  ACG::SceneGraph::DrawModes::DrawMode dotsDrawMode   = ACG::SceneGraph::DrawModes::getDrawMode( "Dots"   );
  ACG::SceneGraph::DrawModes::DrawMode pointsDrawMode = ACG::SceneGraph::DrawModes::getDrawMode( "Points" );

  // if drawmodes don't exist something went wrong
  if( splatsDrawMode == ACG::SceneGraph::DrawModes::NONE || 
      dotsDrawMode   == ACG::SceneGraph::DrawModes::NONE || 
      pointsDrawMode == ACG::SceneGraph::DrawModes::NONE )
  {
    std::cerr << "Shader DrawModes for SplatCloud not existent!" << std::endl;
    return;
  }

  // get shader directory
  QString shaderDir = OpenFlipper::Options::shaderDirStr() + OpenFlipper::Options::dirSeparator();
  std::string shaderDirectory = std::string( shaderDir.toUtf8() );

  // set shader directory
  shaderNode_->setShaderDir( shaderDirectory );

  // load shaders

  if( QFile( shaderDir + SPLATS_VERTEXSHADER_FILENAME        ).exists() && 
      QFile( shaderDir + SPLATS_PICK_VERTEXSHADER_FILENAME   ).exists() &&
      QFile( shaderDir + SPLATS_FRAGMENTSHADER_FILENAME      ).exists() &&
      QFile( shaderDir + SPLATS_PICK_FRAGMENTSHADER_FILENAME ).exists() )
  {
    shaderNode_->setShader( splatsDrawMode, 
      SPLATS_VERTEXSHADER_FILENAME,      SPLATS_FRAGMENTSHADER_FILENAME, 
      SPLATS_PICK_VERTEXSHADER_FILENAME, SPLATS_PICK_FRAGMENTSHADER_FILENAME );
  }
  else
  {
    std::cerr << "Shader Files for SplatCloud/Splats not found!" << std::endl;
  }

  if( QFile( shaderDir + DOTS_VERTEXSHADER_FILENAME        ).exists() && 
      QFile( shaderDir + DOTS_PICK_VERTEXSHADER_FILENAME   ).exists() &&
      QFile( shaderDir + DOTS_FRAGMENTSHADER_FILENAME      ).exists() &&
      QFile( shaderDir + DOTS_PICK_FRAGMENTSHADER_FILENAME ).exists() )
  {
    shaderNode_->setShader( dotsDrawMode, 
      DOTS_VERTEXSHADER_FILENAME,      DOTS_FRAGMENTSHADER_FILENAME, 
      DOTS_PICK_VERTEXSHADER_FILENAME, DOTS_PICK_FRAGMENTSHADER_FILENAME );
  }
  else
  {
    std::cerr << "Shader Files for SplatCloud/Dots not found!" << std::endl;
  }

  if( QFile( shaderDir + POINTS_VERTEXSHADER_FILENAME        ).exists() && 
      QFile( shaderDir + POINTS_PICK_VERTEXSHADER_FILENAME   ).exists() &&
      QFile( shaderDir + POINTS_FRAGMENTSHADER_FILENAME      ).exists() &&
      QFile( shaderDir + POINTS_PICK_FRAGMENTSHADER_FILENAME ).exists() )
  {
    shaderNode_->setShader( pointsDrawMode, 
      POINTS_VERTEXSHADER_FILENAME,      POINTS_FRAGMENTSHADER_FILENAME, 
      POINTS_PICK_VERTEXSHADER_FILENAME, POINTS_PICK_FRAGMENTSHADER_FILENAME );
  }
  else
  {
    std::cerr << "Shader Files for SplatCloud/Points not found!" << std::endl;
  }
Jan Möbius's avatar
Jan Möbius committed
255
256
257
258
259
260
261
262
263
264
265
}


//----------------------------------------------------------------


/**
 * Enable or disable backface culling
 */
void SplatCloudObject::enableBackfaceCulling( bool _enable )
{
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
  // get drawmodes
  ACG::SceneGraph::DrawModes::DrawMode splatsDrawMode = ACG::SceneGraph::DrawModes::getDrawMode( "Splats" );
  ACG::SceneGraph::DrawModes::DrawMode dotsDrawMode   = ACG::SceneGraph::DrawModes::getDrawMode( "Dots"   );
  ACG::SceneGraph::DrawModes::DrawMode pointsDrawMode = ACG::SceneGraph::DrawModes::getDrawMode( "Points" );

  // if drawmodes don't exist something went wrong
  if( splatsDrawMode == ACG::SceneGraph::DrawModes::NONE || 
      dotsDrawMode   == ACG::SceneGraph::DrawModes::NONE || 
      pointsDrawMode == ACG::SceneGraph::DrawModes::NONE )
  {
    std::cerr << "Shader DrawModes for SplatCloud not existent!" << std::endl;
    return;
  }

  // get standard and picking shaders
  GLSL::PtrProgram splatsShader     = shaderNode_->getShader( splatsDrawMode, false );
  GLSL::PtrProgram splatsPickShader = shaderNode_->getShader( splatsDrawMode, true  );
  GLSL::PtrProgram dotsShader       = shaderNode_->getShader( dotsDrawMode,   false );
  GLSL::PtrProgram dotsPickShader   = shaderNode_->getShader( dotsDrawMode,   true  );
  GLSL::PtrProgram pointsShader     = shaderNode_->getShader( pointsDrawMode, false );
  GLSL::PtrProgram pointsPickShader = shaderNode_->getShader( pointsDrawMode, true  );

  // update backface-culling uniform of shaders

  backfaceCullingEnabled_ = _enable;
  GLint backfaceCulling = (GLint) _enable;

  if( splatsShader )
  {
    splatsShader->use();
    splatsShader->setUniform( "backfaceCulling", backfaceCulling );
    splatsShader->disable();
  }

  if( splatsPickShader )
  {
    splatsPickShader->use();
    splatsPickShader->setUniform( "backfaceCulling", backfaceCulling );
    splatsPickShader->disable();
  }

  if( dotsShader )
  {
    dotsShader->use();
    dotsShader->setUniform( "backfaceCulling", backfaceCulling );
    dotsShader->disable();
  }

  if( dotsPickShader )
  {
    dotsPickShader->use();
    dotsPickShader->setUniform( "backfaceCulling", backfaceCulling );
    dotsPickShader->disable();
  }

  if( pointsShader )
  {
    pointsShader->use();
    pointsShader->setUniform( "backfaceCulling", backfaceCulling );
    pointsShader->disable();
  }

  if( pointsPickShader )
  {
    pointsPickShader->use();
    pointsPickShader->setUniform( "backfaceCulling", backfaceCulling );
    pointsPickShader->disable();
  }
Jan Möbius's avatar
Jan Möbius committed
334
335
336
337
338
339
340
341
342
343
344
}


//----------------------------------------------------------------


/**
 * Set scale for point sizes
 */
void SplatCloudObject::setPointsizeScale( float _scale )
{
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
  // get drawmodes
  ACG::SceneGraph::DrawModes::DrawMode splatsDrawMode = ACG::SceneGraph::DrawModes::getDrawMode( "Splats" );
  ACG::SceneGraph::DrawModes::DrawMode dotsDrawMode   = ACG::SceneGraph::DrawModes::getDrawMode( "Dots"   );

  // if drawmodes don't exist something went wrong
  if( splatsDrawMode == ACG::SceneGraph::DrawModes::NONE || 
      dotsDrawMode   == ACG::SceneGraph::DrawModes::NONE )
  {
    std::cerr << "Shader DrawModes for SplatCloud not existent!" << std::endl;
    return;
  }

  // get standard and picking shaders
  GLSL::PtrProgram splatsShader     = shaderNode_->getShader( splatsDrawMode, false );
  GLSL::PtrProgram splatsPickShader = shaderNode_->getShader( splatsDrawMode, true  );
  GLSL::PtrProgram dotsShader       = shaderNode_->getShader( dotsDrawMode,   false );
  GLSL::PtrProgram dotsPickShader   = shaderNode_->getShader( dotsDrawMode,   true  );

  // update pointsize-scale uniform of shaders

  pointsizeScale_ = _scale;
  GLfloat pointsizeScale = (GLfloat) _scale;

  if( splatsShader )
  {
    splatsShader->use();
    splatsShader->setUniform( "pointsizeScale", pointsizeScale );
    splatsShader->disable();
  }

  if( splatsPickShader )
  {
    splatsPickShader->use();
    splatsPickShader->setUniform( "pointsizeScale", pointsizeScale );
    splatsPickShader->disable();
  }

  if( dotsShader )
  {
    dotsShader->use();
    dotsShader->setUniform( "pointsizeScale", pointsizeScale );
    dotsShader->disable();
  }

  if( dotsPickShader )
  {
    dotsPickShader->use();
    dotsPickShader->setUniform( "pointsizeScale", pointsizeScale );
    dotsPickShader->disable();
  }
Jan Möbius's avatar
Jan Möbius committed
395
396
397
398
399
400
401
402
}


//----------------------------------------------------------------


/** This function initalizes the SplatCloud object. It creates the scenegraph nodes.
*/
403
void SplatCloudObject::init( const SplatCloud *_splatCloud )
Jan Möbius's avatar
Jan Möbius committed
404
{
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
  if( materialNode() == NULL )
    std::cerr << "Error when creating SplatCloud Object! materialNode is NULL!" << std::endl;

  // if _splatCloud is *not* 0, copy it's contents
  if( _splatCloud )
  {
    delete splatCloud_;

    splatCloud_ = new SplatCloud( *_splatCloud );
    if( !splatCloud_ )
    {
      std::cerr << "SplatCloudObject::init() : Out of memory." << std::endl;
    }
  }

  // if something went wrong during initialization, abort
  if( !splatCloud_ )
  {
    shaderNode_     = 0;
    splatCloudNode_ = 0;
    return;
  }

  // create new scenegraph nodes
  shaderNode_     = new ShaderNode    (               materialNode(), "NEW ShaderNode for" );
  splatCloudNode_ = new SplatCloudNode( *splatCloud_, shaderNode_,    "NEW SplatCloudNode" );

  // load shaders
  reloadShaders();
Jan Möbius's avatar
Jan Möbius committed
434
435
436
}


Jan Möbius's avatar
Jan Möbius committed
437
438
439
440
441
442
443
444
//----------------------------------------------------------------


/**
 * Update object and scenegraph nodes
 */
void SplatCloudObject::update( UpdateType _type )
{
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
  if( _type == UPDATE_ALL )
  {
#   ifdef REPORT_UPDATE_TYPE
    std::cout << "SplatCloudObject::update() : UPDATE_ALL" << std::endl;
    std::cout << std::endl;
#   endif

    if( splatCloudNode_ )
      splatCloudNode_->modifiedAll();
    return;
  }

  if( _type.contains( UPDATE_GEOMETRY ) )
  {
#   ifdef REPORT_UPDATE_TYPE
    std::cout << "SplatCloudObject::update() : UPDATE_GEOMETRY" << std::endl;
#   endif

    if( splatCloudNode_ )
      splatCloudNode_->modifiedPositions();
  }

  if( _type.contains( UPDATE_COLOR ) )
  {
#   ifdef REPORT_UPDATE_TYPE
    std::cout << "SplatCloudObject::update() : UPDATE_COLOR" << std::endl;
#   endif

    if( splatCloudNode_ )
      splatCloudNode_->modifiedColors();
  }

  if( _type.contains( updateType("Normals") ) )
  {
#   ifdef REPORT_UPDATE_TYPE
    std::cout << "SplatCloudObject::update() : UPDATE_Normals" << std::endl;
#   endif

    if( splatCloudNode_ )
      splatCloudNode_->modifiedNormals();
  }

  if( _type.contains( updateType("Pointsizes") ) )
  {
#   ifdef REPORT_UPDATE_TYPE
    std::cout << "SplatCloudObject::update() : UPDATE_Pointsizes" << std::endl;
#   endif

    if( splatCloudNode_ )
      splatCloudNode_->modifiedPointsizes();
  }

  if( _type.contains( updateType("Indices") ) )
  {
#   ifdef REPORT_UPDATE_TYPE
    std::cout << "SplatCloudObject::update() : UPDATE_Indices" << std::endl;
#   endif
  }

  if( _type.contains( UPDATE_SELECTION ) )
  {
#   ifdef REPORT_UPDATE_TYPE
    std::cout << "SplatCloudObject::update() : UPDATE_SELECTION" << std::endl;
#   endif

    if( splatCloudNode_ )
      splatCloudNode_->modifiedSelections();
  }

# ifdef REPORT_UPDATE_TYPE
  std::cout << std::endl;
# endif
Jan Möbius's avatar
Jan Möbius committed
517
518
519
}


Jan Möbius's avatar
Jan Möbius committed
520
521
522
523
524
525
526
527
528
529
//----------------------------------------------------------------
//  Name/Path Handling
//----------------------------------------------------------------


/** Set the name of an object. All Scenegraph nodes are renamed too. It also calls
* BaseObjectData::setName.
*/
void SplatCloudObject::setName( QString _name )
{
530
  BaseObjectData::setName( _name );
Jan Möbius's avatar
Jan Möbius committed
531

532
  std::string nodename;
Jan Möbius's avatar
Jan Möbius committed
533

534
535
  nodename = std::string( "ShaderNode for SplatCloud " + _name.toUtf8() );
  shaderNode_->name( nodename );
Jan Möbius's avatar
Jan Möbius committed
536

537
538
  nodename = std::string( "SplatCloudNode for SplatCloud " + _name.toUtf8() );
  splatCloudNode_->name( nodename );
Jan Möbius's avatar
Jan Möbius committed
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
}


//----------------------------------------------------------------
//  Object information
//----------------------------------------------------------------


/** Returns a string containing all information about the current object. This also
* includes the information provided by BaseObjectData::getObjectinfo
*
* @return String containing the object information
*/
QString SplatCloudObject::getObjectinfo()
{
554
555
556
557
558
559
560
561
562
563
564
565
566
  QString output;

  output += "========================================================================\n";
  output += BaseObjectData::getObjectinfo();

  if( dataType( DATA_SPLATCLOUD ) )
  {
    output += "Object Contains SplatCloud: ";

    if( splatCloud_ )
    {
      output += " #Splats: " + QString::number( splatCloud_->numSplats() );

Jan Möbius's avatar
Jan Möbius committed
567
      output += "; Splat-Properties: ";
568
569
      if( splatCloud_->splatProperties().empty() )
      {
Jan Möbius's avatar
Jan Möbius committed
570
        output += "-none-";
571
572
573
      }
      else
      {
Jan Möbius's avatar
Jan Möbius committed
574
575
576
577
578
579
580
581
582
583
        SplatCloud::SplatPropertyMap::const_iterator splatPropertyIter = splatCloud_->splatProperties().begin();
        while( true )
        {
          output += splatPropertyIter->first.c_str();

          if( ++splatPropertyIter == splatCloud_->splatProperties().end() )
            break;

          output += ", ";
        }
584
585
      }

Jan Möbius's avatar
Jan Möbius committed
586
      output += "; Cloud-Properties: ";
587
588
      if( splatCloud_->cloudProperties().empty() )
      {
Jan Möbius's avatar
Jan Möbius committed
589
        output += "-none-";
590
591
592
      }
      else
      {
Jan Möbius's avatar
Jan Möbius committed
593
594
595
596
597
598
599
600
601
602
        SplatCloud::CloudPropertyMap::const_iterator cloudPropertyIter = splatCloud_->cloudProperties().begin();
        while( true )
        {
          output += cloudPropertyIter->first.c_str();

          if( ++cloudPropertyIter == splatCloud_->cloudProperties().end() )
            break;

          output += ", ";
        }
603
604
605
606
607
608
609
610
      }
    }

    output += "\n";
  }

  output += "========================================================================\n";
  return output;
Jan Möbius's avatar
Jan Möbius committed
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
}


//----------------------------------------------------------------
//  Picking
//----------------------------------------------------------------


/** Given an node index from PluginFunctions::scenegraphPick this function can be used to
* check if the splatCloudNode of the object has been picked.
*
* @param _node_idx Index of the picked splatcloud node
* @return bool if the splatCloudNode of this object is the picking target.
*/
bool SplatCloudObject::picked( uint _node_idx )
{
627
  return ( _node_idx == splatCloudNode_->id() );
Jan Möbius's avatar
Jan Möbius committed
628
629
630
631
632
633
634
635
}


//----------------------------------------------------------------


void SplatCloudObject::enablePicking( bool _enable )
{
636
637
  splatCloudNode_->enablePicking( _enable );
  shaderNode_->enablePicking( _enable );
Jan Möbius's avatar
Jan Möbius committed
638
639
640
641
642
643
644
645
}


//----------------------------------------------------------------


bool SplatCloudObject::pickingEnabled()
{
646
  return splatCloudNode_->pickingEnabled();
Jan Möbius's avatar
Jan Möbius committed
647
}