vtkPistonMapper.cxx 17.8 KB
Newer Older
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
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPistonMapper.cxx

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#include "vtkPistonMapper.h"

#include "vtkFloatArray.h"
#include "vtkgl.h"
#include "vtkInformation.h"
#include "vtkMath.h"
#include "vtkObjectFactory.h"
#include "vtkOpenGLExtensionManager.h"
#include "vtkPistonDataObject.h"
#include "vtkPointData.h"
#include "vtkPolyData.h"
#include "vtkPistonDataObject.h"
#include "vtkPistonScalarsColors.h"
#include "vtkScalarsToColors.h"
#include "vtkStreamingDemandDrivenPipeline.h"
Burlen Loring's avatar
Burlen Loring committed
30
#include "vtkOpenGLError.h"
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

#include <limits>

struct cudaGraphicsResource; //keeps vtkpiston namespace decl from claiming it

//----------------------------------------------------------------------------
namespace vtkpiston {
  // Forward declarations of methods defined in the cuda implementation
  void CudaGLInit();
  void CopyFromGPU(vtkPistonDataObject *id, vtkPolyData *pd);
  int QueryNumVerts(vtkPistonDataObject *id);
  int QueryVertsPer(vtkPistonDataObject *id);
  void CudaRegisterBuffer(struct cudaGraphicsResource **vboResource,
                          GLuint vboBuffer);
  void CudaTransferToGL(vtkPistonDataObject *id, unsigned long dataObjectMTimeCache,
                        vtkPistonScalarsColors *psc,
                        struct cudaGraphicsResource **vboResources,
                        bool &hasNormals, bool &hasColors);
  bool AlmostEqualRelativeAndAbs(float A, float B,
                                 float maxDiff, float maxRelDiff);

  struct PistonGLRAII
    {
    PistonGLRAII(GLbitfield mask)
      {
Burlen Loring's avatar
Burlen Loring committed
56
      vtkOpenGLClearErrorMacro();
57
58
59
60
61
62
      glPushAttrib(mask);
      }

    ~PistonGLRAII()
      {
      glPopAttrib();
63
      vtkOpenGLStaticCheckErrorMacro("failed after ~PistonGLRAII");
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
      }
    };
}

//-----------------------------------------------------------------------------
class vtkPistonMapper::InternalInfo
{
public:
  InternalInfo()
    {
    this->BufferSize = 0;
    this->PistonScalarsColors = 0;

    this->DataObjectMTimeCache = 0;
    }

  int BufferSize;
  GLuint vboBuffers[3];
  struct cudaGraphicsResource* vboResources[3];

  unsigned long DataObjectMTimeCache;
  vtkPistonScalarsColors *PistonScalarsColors;
};

//-----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPistonMapper);

bool vtkPistonMapper::CudaGLInitted = false;

//-----------------------------------------------------------------------------
94
void vtkPistonMapper::InitCudaGL(vtkRenderWindow *rw)
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{
  if (!vtkPistonMapper::CudaGLInitted)
    {
    vtkOpenGLExtensionManager *em = vtkOpenGLExtensionManager::New();
    em->SetRenderWindow(rw);
    if (!em->LoadSupportedExtension("GL_VERSION_1_5"))
      {
      cerr << "WARNING: Can not use direct piston rendering,"
           << "reverting to CPU rendering path." << endl;
      em->Delete();
      return;
      }
    em->Delete();

    vtkPistonMapper::CudaGLInitted = true;
    vtkpiston::CudaGLInit();
   }
}

//-----------------------------------------------------------------------------
vtkPistonMapper::vtkPistonMapper()
{
  //cerr << "PM(" << this << ") create" << endl;
  vtkMath::UninitializeBounds(this->Bounds);
  this->Center[0] = this->Center[1] = this->Center[2] = 0.0;
  this->Piece = 0;
  this->NumberOfPieces = 1;
  this->GhostLevel = 0;

  this->Internal = new vtkPistonMapper::InternalInfo();
  this->Internal->PistonScalarsColors = vtkPistonScalarsColors::New();
  this->Internal->PistonScalarsColors->SetLookupTable(
    this->GetLookupTable());
}

//-----------------------------------------------------------------------------
vtkPistonMapper::~vtkPistonMapper()
{
  //cerr << "PM(" << this << ") destroy" << endl;
  this->PrepareDirectRenderBuffers(0);
  this->Internal->PistonScalarsColors->Delete();
  delete this->Internal;
}

//-----------------------------------------------------------------------------
void vtkPistonMapper::PrepareDirectRenderBuffers(int nPoints)
{
Burlen Loring's avatar
Burlen Loring committed
142
143
  vtkOpenGLClearErrorMacro();

144
145
146
147
148
149
150
151
  if (nPoints==this->Internal->BufferSize)
    {
    return;
    }
  if (this->Internal->BufferSize != 0)
    {
    // Release old buffer
    vtkgl::DeleteBuffers(3, this->Internal->vboBuffers);
Burlen Loring's avatar
Burlen Loring committed
152
    vtkOpenGLCheckErrorMacro("failed at glDeleteBuffers");
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
    }

  this->Internal->BufferSize = nPoints;
  if (this->Internal->BufferSize == 0)
    {
    return;
    }

  // Prep shared mem buffer between gl and cuda
  vtkgl::GenBuffers(3, this->Internal->vboBuffers);
  vtkgl::BindBuffer(vtkgl::ARRAY_BUFFER,
                    this->Internal->vboBuffers[0]);
  vtkgl::BufferData(vtkgl::ARRAY_BUFFER,
                    this->Internal->BufferSize*3*sizeof(float), 0,
                    vtkgl::DYNAMIC_DRAW);
  vtkgl::BindBuffer(vtkgl::ARRAY_BUFFER,
                    this->Internal->vboBuffers[1]);
  vtkgl::BufferData(vtkgl::ARRAY_BUFFER,
                    this->Internal->BufferSize*3*3*sizeof(float), 0,
                    vtkgl::DYNAMIC_DRAW);
  vtkgl::BindBuffer(vtkgl::ARRAY_BUFFER,
                    this->Internal->vboBuffers[2]);
  vtkgl::BufferData(vtkgl::ARRAY_BUFFER,
                    this->Internal->BufferSize*3*sizeof(float), 0,
                    vtkgl::DYNAMIC_DRAW);

Burlen Loring's avatar
Burlen Loring committed
179
180
  vtkOpenGLCheckErrorMacro("failed after allocate shared memory");

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
  vtkpiston::CudaRegisterBuffer(&this->Internal->vboResources[0],
                               this->Internal->vboBuffers[0]);
  vtkpiston::CudaRegisterBuffer(&this->Internal->vboResources[1],
                               this->Internal->vboBuffers[1]);
  vtkpiston::CudaRegisterBuffer(&this->Internal->vboResources[2],
                               this->Internal->vboBuffers[2]);
}

//-----------------------------------------------------------------------------
void vtkPistonMapper::PrintSelf(ostream& os, vtkIndent indent)
{
  this->Superclass::PrintSelf(os,indent);
  os << indent << "Piece : " << this->Piece << endl;
  os << indent << "NumberOfPieces : " << this->NumberOfPieces << endl;
  os << indent << "GhostLevel: " << this->GhostLevel << endl;
}

//-----------------------------------------------------------------------------
void vtkPistonMapper::ShallowCopy(vtkAbstractMapper *mapper)
{
  //cerr << "PM(" << this << ") shallow copy" << mapper << endl;
  vtkPistonMapper *m = vtkPistonMapper::SafeDownCast(mapper);
  if ( m != NULL )
    {
      this->SetPiece(m->GetPiece());
      this->SetNumberOfPieces(m->GetNumberOfPieces());
      this->SetGhostLevel(m->GetGhostLevel());
    }

  // Now do superclass
  this->vtkAbstractMapper3D::ShallowCopy(mapper);
}

//----------------------------------------------------------------------------
int vtkPistonMapper::FillInputPortInformation(
  int vtkNotUsed(port), vtkInformation* info)
{
  info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPistonDataObject");
  return 1;
}

//-----------------------------------------------------------------------------
void vtkPistonMapper::RenderOnCPU()
{
Burlen Loring's avatar
Burlen Loring committed
225
226
  vtkOpenGLClearErrorMacro();

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
255
256
257
258
259
260
261
262
263
264
265
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
334
335
336
337
338
339
340
341
342
343
344
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
395
396
397
398
399
400
401
  vtkpiston::PistonGLRAII(GL_LIGHTING_BIT);

  vtkScalarsToColors *lut = this->GetLookupTable();

  vtkPistonDataObject *id = this->GetPistonDataObjectInput(0);

  vtkPolyData *od = vtkPolyData::New();
  vtkpiston::CopyFromGPU(id, od);

  int vertsPer = vtkpiston::QueryVertsPer(id);

  vtkFloatArray *normals = vtkFloatArray::SafeDownCast(
      od->GetPointData()->GetNormals());
  if (!normals)
    {
     normals = vtkFloatArray::SafeDownCast(
       od->GetPointData()->GetArray("Normals"));
    }

  vtkFloatArray *scalars = vtkFloatArray::SafeDownCast(
      od->GetPointData()->GetScalars());
  if (scalars)
    {
      //TODO: Remove this when piston gives us exactly same values for isocontour.
      float *scalarRange = scalars->GetValueRange();
      float tempRange[2] =
        {
          static_cast<float>(scalarRange[0]),
          static_cast<float>(scalarRange[1])
        };
      if (vtkpiston::AlmostEqualRelativeAndAbs(scalarRange[0], scalarRange[1],
                                               std::numeric_limits<float>::epsilon(),
                                               std::numeric_limits<float>::epsilon() * 10))
        {
        tempRange[1] = tempRange[0]+1.0;
        }

      lut->SetRange(tempRange[0], tempRange[1]);
      lut->Build();

      glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
      glEnable(GL_COLOR_MATERIAL);
    }

  double nextpt0[3];
  double nextpt1[3];
  double nextpt2[3];
  double nextpt3[3];

  double nextnorm0[3];
  double nextnorm1[3];
  double nextnorm2[3];
  double nextnorm3[3];

  unsigned char nextcolor0[3];
  unsigned char nextcolor1[3];
  unsigned char nextcolor2[3];
  unsigned char nextcolor3[3];

  switch (vertsPer) {
    case 4:
      glBegin(GL_QUADS);
      for (int i = 0; i < od->GetNumberOfPoints(); i+=4)
        {
          od->GetPoint(i+0, nextpt0);
          od->GetPoint(i+1, nextpt1);
          od->GetPoint(i+2, nextpt2);
          od->GetPoint(i+3, nextpt3);
          if (normals)
            {
            normals->GetTuple(i+0, nextnorm0);
            normals->GetTuple(i+1, nextnorm1);
            normals->GetTuple(i+2, nextnorm2);
            normals->GetTuple(i+3, nextnorm3);
            }
          if (scalars)
            {
              unsigned char *ptr;
              ptr = lut->MapValue(scalars->GetValue(i+0));
              nextcolor0[0] = ptr[0];
              nextcolor0[1] = ptr[1];
              nextcolor0[2] = ptr[2];
              ptr = lut->MapValue(scalars->GetValue(i+1));
              nextcolor1[0] = ptr[0];
              nextcolor1[1] = ptr[1];
              nextcolor1[2] = ptr[2];
              ptr = lut->MapValue(scalars->GetValue(i+2));
              nextcolor2[0] = ptr[0];
              nextcolor2[1] = ptr[1];
              nextcolor2[2] = ptr[2];
              ptr = lut->MapValue(scalars->GetValue(i+3));
              nextcolor3[0] = ptr[0];
              nextcolor3[1] = ptr[1];
              nextcolor3[2] = ptr[2];
            }
          if (normals) glNormal3dv(nextnorm0);
          if (scalars) glColor3ubv(nextcolor0);
          glVertex3dv(nextpt0);
          if (normals) glNormal3dv(nextnorm1);
          if (scalars) glColor3ubv(nextcolor1);
          glVertex3dv(nextpt1);
          if (normals) glNormal3dv(nextnorm2);
          if (scalars) glColor3ubv(nextcolor2);
          glVertex3dv(nextpt2);
          if (normals) glNormal3dv(nextnorm3);
          if (scalars) glColor3ubv(nextcolor3);
          glVertex3dv(nextpt3);
        }
      glEnd();
      break;
    case 3:
    {
      glBegin(GL_TRIANGLES);
      for (int i = 0; i < od->GetNumberOfPoints(); i+=3)
        {
        od->GetPoint(i+0, nextpt0);
        od->GetPoint(i+1, nextpt1);
        od->GetPoint(i+2, nextpt2);
        if (normals)
          {
          normals->GetTuple(i+0, nextnorm0);
          normals->GetTuple(i+1, nextnorm1);
          normals->GetTuple(i+2, nextnorm2);
          }
        if (scalars)
          {
            unsigned char *ptr;
            ptr = lut->MapValue(scalars->GetValue(i+0));
            nextcolor0[0] = ptr[0];
            nextcolor0[1] = ptr[1];
            nextcolor0[2] = ptr[2];
            ptr = lut->MapValue(scalars->GetValue(i+1));
            nextcolor1[0] = ptr[0];
            nextcolor1[1] = ptr[1];
            nextcolor1[2] = ptr[2];
            ptr = lut->MapValue(scalars->GetValue(i+2));
            nextcolor2[0] = ptr[0];
            nextcolor2[1] = ptr[1];
            nextcolor2[2] = ptr[2];
          }

        if (normals) glNormal3dv(nextnorm0);
        if (scalars) glColor3ubv(nextcolor0);
        glVertex3dv(nextpt0);
        if (normals) glNormal3dv(nextnorm1);
        if (scalars) glColor3ubv(nextcolor1);
        glVertex3dv(nextpt1);
        if (normals) glNormal3dv(nextnorm2);
        if (scalars) glColor3ubv(nextcolor2);
        glVertex3dv(nextpt2);
        }
      glEnd();
    }
    break;
    default:
      glBegin(GL_POINTS);
      for (int i = 0; i < od->GetNumberOfPoints(); i++)
        {
        od->GetPoint(i+0, nextpt0);
        if (normals)
          {
          normals->GetTuple(i+0, nextnorm0);
          glNormal3dv(nextnorm0);
          }
        if (scalars)
          {
            unsigned char *ptr;
            ptr = lut->MapValue(scalars->GetValue(i+0));
            glColor3ubv(ptr);
           }
        glVertex3dv(nextpt0);
        }
      glEnd();
  }
  od->Delete();
Burlen Loring's avatar
Burlen Loring committed
402
403

  vtkOpenGLCheckErrorMacro("failed after RenderOnCPU");
404
405
406
407
408
}

//-----------------------------------------------------------------------------
void vtkPistonMapper::RenderOnGPU()
{
Burlen Loring's avatar
Burlen Loring committed
409
410
  vtkOpenGLClearErrorMacro();

411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
  vtkPistonDataObject *id = this->GetPistonDataObjectInput(0);

  int nPoints = vtkpiston::QueryNumVerts(id);
  this->PrepareDirectRenderBuffers(nPoints);

  // Transfer what is in tdo to buffer and render it directly on card
  bool hasNormals = false;
  bool hasColors = false;

  vtkpiston::CudaTransferToGL(id, this->Internal->DataObjectMTimeCache,
    this->Internal->PistonScalarsColors,
    this->Internal->vboResources, hasNormals, hasColors);

  // Draw the result
  glEnableClientState(GL_VERTEX_ARRAY);
  vtkgl::BindBuffer(vtkgl::ARRAY_BUFFER, this->Internal->vboBuffers[0]);
  glVertexPointer(3, GL_FLOAT, 0, 0);

  if (hasNormals)
    {
    glEnableClientState(GL_NORMAL_ARRAY);
    vtkgl::BindBuffer(vtkgl::ARRAY_BUFFER, this->Internal->vboBuffers[1]);
    glNormalPointer(GL_FLOAT, 0, 0);
    }

  if (hasColors)
    {
    glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
    glEnable(GL_COLOR_MATERIAL);
    glEnableClientState(GL_COLOR_ARRAY);
    vtkgl::BindBuffer(vtkgl::ARRAY_BUFFER, this->Internal->vboBuffers[2]);
    glColorPointer(3, GL_FLOAT, 0, 0);
    }

  int vertsPer = vtkpiston::QueryVertsPer(id);
  switch (vertsPer) {
    case 4:
      glDrawArrays(GL_QUADS, 0, nPoints);
      break;
    case 3:
      glDrawArrays(GL_TRIANGLES, 0, nPoints);
      break;
    default:
      glDrawArrays(GL_POINTS, 0, nPoints);
  }

  glDisableClientState(GL_VERTEX_ARRAY);
  if (hasNormals) glDisableClientState(GL_NORMAL_ARRAY);
  if (hasColors) glDisableClientState(GL_COLOR_ARRAY);
Burlen Loring's avatar
Burlen Loring committed
460
461

  vtkOpenGLCheckErrorMacro("failed after RenderOnGPU");
462
463
464
465
466
}

//-----------------------------------------------------------------------------
void vtkPistonMapper::RenderImageDataOutline()
{
Burlen Loring's avatar
Burlen Loring committed
467
468
  vtkOpenGLClearErrorMacro();

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
517
518
519
520
521
522
523
524
525
526
527
528
  vtkpiston::PistonGLRAII(GL_LIGHTING_BIT);
  glDisable(GL_LIGHTING);

  glBegin(GL_LINES);

  double nextpt[8][3];
  nextpt[0][0] = this->Bounds[0];
  nextpt[0][1] = this->Bounds[2];
  nextpt[0][2] = this->Bounds[4];
  nextpt[1][0] = this->Bounds[1];
  nextpt[1][1] = this->Bounds[2];
  nextpt[1][2] = this->Bounds[4];
  nextpt[2][0] = this->Bounds[1];
  nextpt[2][1] = this->Bounds[3];
  nextpt[2][2] = this->Bounds[4];
  nextpt[3][0] = this->Bounds[0];
  nextpt[3][1] = this->Bounds[3];
  nextpt[3][2] = this->Bounds[4];
  nextpt[4][0] = this->Bounds[0];
  nextpt[4][1] = this->Bounds[2];
  nextpt[4][2] = this->Bounds[5];
  nextpt[5][0] = this->Bounds[1];
  nextpt[5][1] = this->Bounds[2];
  nextpt[5][2] = this->Bounds[5];
  nextpt[6][0] = this->Bounds[1];
  nextpt[6][1] = this->Bounds[3];
  nextpt[6][2] = this->Bounds[5];
  nextpt[7][0] = this->Bounds[0];
  nextpt[7][1] = this->Bounds[3];
  nextpt[7][2] = this->Bounds[5];

  glVertex3dv(nextpt[0]);
  glVertex3dv(nextpt[1]);
  glVertex3dv(nextpt[1]);
  glVertex3dv(nextpt[2]);
  glVertex3dv(nextpt[2]);
  glVertex3dv(nextpt[3]);
  glVertex3dv(nextpt[3]);
  glVertex3dv(nextpt[0]);

  glVertex3dv(nextpt[4]);
  glVertex3dv(nextpt[5]);
  glVertex3dv(nextpt[5]);
  glVertex3dv(nextpt[6]);
  glVertex3dv(nextpt[6]);
  glVertex3dv(nextpt[7]);
  glVertex3dv(nextpt[7]);
  glVertex3dv(nextpt[4]);

  glVertex3dv(nextpt[0]);
  glVertex3dv(nextpt[4]);

  glVertex3dv(nextpt[1]);
  glVertex3dv(nextpt[5]);

  glVertex3dv(nextpt[2]);
  glVertex3dv(nextpt[6]);
  glVertex3dv(nextpt[3]);
  glVertex3dv(nextpt[7]);
  glEnd();
Burlen Loring's avatar
Burlen Loring committed
529
530

  vtkOpenGLCheckErrorMacro("failed after RenderImageDataOutline");
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
}

//----------------------------------------------------------------------------
vtkPistonDataObject* vtkPistonMapper::GetPistonDataObjectInput(int port)
{
  return vtkPistonDataObject::SafeDownCast(this->GetInputDataObject(port, 0));
}

//-----------------------------------------------------------------------------
// Get the bounds for the input of this mapper as
// (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
double *vtkPistonMapper::GetBounds()
{
  vtkPistonDataObject *id = this->GetPistonDataObjectInput(0);
  if (id)
    {
    id->GetBounds(this->Bounds);
    //cerr << "FOUND BOUNDS " << this->Bounds[0] << "," << this->Bounds[1] << endl;
    }
  else
    {
    vtkMath::UninitializeBounds(this->Bounds);
    }
  return this->Bounds;
}

//-----------------------------------------------------------------------------
void vtkPistonMapper::Render(vtkRenderer *vtkNotUsed(ren), vtkActor *vtkNotUsed(a))
{
  vtkPistonDataObject *id = this->GetPistonDataObjectInput(0);
  if (id->GetReferredType() == VTK_IMAGE_DATA)
  {
    this->RenderImageDataOutline();
    return;
  }

  if (!vtkPistonMapper::CudaGLInitted)
    {
    this->RenderOnCPU();
    }
  else
    {
    this->RenderOnGPU();
    }

  // Update object modified time
  this->Internal->DataObjectMTimeCache = id->GetMTime();
}

//-----------------------------------------------------------------------------
void vtkPistonMapper::Update()
{
  this->UpdateInformation();

  vtkInformation* inInfo = this->GetInputInformation();

  // If the estimated pipeline memory usage is larger than
  // the memory limit, break the current piece into sub-pieces.
  if (inInfo)
    {
    vtkStreamingDemandDrivenPipeline::SetUpdateExtent(
      inInfo,
      this->Piece,
      this->NumberOfPieces,
      this->GhostLevel);
    }

  this->vtkMapper::Update();
}