File: vtkPrimitivePainter.h

package info (click to toggle)
vtk6 6.3.0%2Bdfsg2-8.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 118,972 kB
  • sloc: cpp: 1,442,790; ansic: 113,395; python: 72,383; tcl: 46,998; xml: 8,119; yacc: 4,525; java: 4,239; perl: 3,108; lex: 1,694; sh: 1,093; asm: 154; makefile: 68; objc: 17
file content (126 lines) | stat: -rw-r--r-- 4,648 bytes parent folder | download | duplicates (4)
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
59
60
61
62
63
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
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
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPrimitivePainter.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 vtkPrimitivePainter - superclass for class that handle single
// privmitives.
// .SECTION Description
// This is the abstract superclass for classes that handle single type
// of primitive i.e. verts, lines, polys or tstrips.
// Concrete subclasses will pass a Render() call to the delegate painter,
// if any, only if it could not render.
// .SECTION Thanks
// Support for generic vertex attributes in VTK was contributed in
// collaboration with Stephane Ploix at EDF.

#ifndef vtkPrimitivePainter_h
#define vtkPrimitivePainter_h

#include "vtkRenderingOpenGLModule.h" // For export macro
#include "vtkPolyDataPainter.h"

class vtkDataArray;
class vtkPoints;
class vtkUnsignedCharArray;

class VTKRENDERINGOPENGL_EXPORT vtkPrimitivePainter : public vtkPolyDataPainter
{
public:
  vtkTypeMacro(vtkPrimitivePainter, vtkPolyDataPainter);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Get the type of primitive supported by this painter.
  // This must be set by concrete subclasses.
  vtkGetMacro(SupportedPrimitive, int);

protected:
  vtkPrimitivePainter();
  ~vtkPrimitivePainter();

  //BTX
  enum {
    VTK_PDM_NORMALS = 0x001,
    VTK_PDM_COLORS = 0x002,
    VTK_PDM_TCOORDS = 0x004,
    VTK_PDM_CELL_COLORS = 0x008,
    VTK_PDM_CELL_NORMALS = 0x010,
    VTK_PDM_OPAQUE_COLORS = 0x020,
    VTK_PDM_FIELD_COLORS = 0x040,
    VTK_PDM_EDGEFLAGS = 0x080,
    VTK_PDM_GENERIC_VERTEX_ATTRIBUTES = 0x100
  };
  //ETX

  // Description:
  // Some subclasses may need to do some preprocessing
  // before the actual rendering can be done eg. build efficient
  // representation for the data etc. This should be done here.
  // This method get called after the ProcessInformation()
  // but before RenderInternal().
  // This method is overridden to update the output data
  // as per the input.
  virtual void PrepareForRendering(vtkRenderer*, vtkActor*);

  // Description:
  // Called before RenderInternal() if the Information has been changed
  // since the last time this method was called.
  virtual void ProcessInformation(vtkInformation*);

  // Description:
  // Subclasses need to override this to return the output of the pipeline.
  virtual vtkDataObject* GetOutput();

  // Description:
  // The actual rendering happens here. This method is called only when
  // SupportedPrimitive is present in typeflags when Render() is invoked.
  // This method returns 1 when the rendering was successful.
  // Concrete Primitive painters may support rendering a primitive only
  // when the input data satifies certain criteria. The return value is used
  // to decide if the subclasses succeeded in rendereing. If not the
  // render request is forwarded to the delegate. On success, the request
  // forwareded to the delegate does not include a request to render the
  // supported primitive type.
  virtual int RenderPrimitive(unsigned long flags, vtkDataArray* n,
    vtkUnsignedCharArray* c, vtkDataArray* t, vtkRenderer* ren) =0;

  // Description:
  // Based on the input polydata, setups certains flags and call
  // RenderPrimitive() which is overridden by subclasses. If RenderPrimitive()
  // is successful, the request forwarded to the delegate painter
  // is with typeflags = (typeflags & ~this->SupportedPrimitive) i.e.
  // the request is to render everything other than what the subclass rendered.
  virtual void RenderInternal(vtkRenderer* renderer, vtkActor* actor,
                              unsigned long typeflags,
                              bool forceCompileOnly);

  // Description:
  // Take part in garbage collection.
  virtual void ReportReferences(vtkGarbageCollector *collector);

  int SupportedPrimitive; // must be set by subclasses.
  vtkSetMacro(SupportedPrimitive, int);

  int DisableScalarColor;

  vtkPolyData* OutputData;
  vtkTimeStamp OutputUpdateTime;
  bool GenericVertexAttributes;
  bool MultiTextureAttributes;

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

#endif