vtkPistonMapper.h 4.05 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPistonMapper.h

  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.

=========================================================================*/
// .NAME vtkPistonMapper - draws vtkPistonDataObjects to the screen
// .SECTION Description
// vtkPistonMapper is comparable to vtkDataSetMapper for vtkPistonDataObjects.
// The important capability it has is to produce images without bringing
// data back to the CPU.

#ifndef __vtkPistonMapper_h
#define __vtkPistonMapper_h

#include "vtkAcceleratorsPistonModule.h" // For export macro
#include "vtkMapper.h"

class vtkActor;
class vtkRenderer;
class vtkPistonDataObject;
class vtkPistonScalarsColors;
class vtkRenderWindow;
class vtkWindow;

class VTKACCELERATORSPISTON_EXPORT vtkPistonMapper : public vtkMapper
{
public:
  static vtkPistonMapper *New();
  vtkTypeMacro(vtkPistonMapper,vtkMapper);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Manually call this before any cuda filters are created
  // to use direct GPU rendering.
44
45
46
47
48
49
50
51
  static void InitCudaGL(vtkRenderWindow *rw);

  // Description:
  // Return true if using cuda interop feature otherwise false.
  inline static bool IsEnabledCudaGL()
    {
    return CudaGLInitted;
    }
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

  // Description:
  // A convenience method to reduce code duplication that gets
  // the input as the expected type or NULL.
  vtkPistonDataObject *GetPistonDataObjectInput(int port);

  // Description:
  // Make a shallow copy of this mapper.
  void ShallowCopy(vtkAbstractMapper *m);

  // Description:
  // Method initiates the mapping process. Generally sent by the actor
  // as each frame is rendered.
  virtual void Render(vtkRenderer *ren, vtkActor *a);

  // Description:
  // Release any graphics resources that are being consumed by this mapper.
  // The parameter window could be used to determine which graphic
  // resources to release.
71
  virtual void ReleaseGraphicsResources(vtkWindow *) {}
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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

  // Description:
  // Return bounding box (array of six doubles) of data expressed as
  // (xmin,xmax, ymin,ymax, zmin,zmax).
  virtual double *GetBounds();
  virtual void GetBounds(double bounds[6])
    {this->vtkAbstractMapper3D::GetBounds(bounds);};

  // Description:
  // WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
  // DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS
  // Used by vtkHardwareSelector to determine if the prop supports hardware
  // selection.
  virtual bool GetSupportsSelection()
    { return false; }

  // Description:
  // Bring this algorithm's outputs up-to-date.
  // Overridden to allow specification on streaming piece.
  virtual void Update();

  // Description:
  // If you want only a part of the data, specify by setting the piece.
  vtkSetMacro(Piece, int);
  vtkGetMacro(Piece, int);
  vtkSetMacro(NumberOfPieces, int);
  vtkGetMacro(NumberOfPieces, int);

  // Description:
  // Set the number of ghost cells to return.
  vtkSetMacro(GhostLevel, int);
  vtkGetMacro(GhostLevel, int);

protected:
  vtkPistonMapper();
  ~vtkPistonMapper();

  // Description:
  // Overridden to say that we take in vtkPistonDataObjects
  virtual int FillInputPortInformation(int port, vtkInformation* info);

  // Description:
  // Internal render methods
  void RenderOnCPU();
  void RenderOnGPU();
  void RenderImageDataOutline();

  int Piece;
  int NumberOfPieces;
  int GhostLevel;

private:
  vtkPistonMapper(const vtkPistonMapper&); // Not implemented.
  void operator=(const vtkPistonMapper&);  // Not implemented.

  // Description:
  // Allocates buffers that are shared between CUDA and GL
  void PrepareDirectRenderBuffers(int nPoints);

131
  static bool CudaGLInitted;
132
133
134
135
136
137

  class InternalInfo;
  InternalInfo *Internal;
};

#endif