File: vtkCoincidentTopologyResolutionPainter.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 (106 lines) | stat: -rw-r--r-- 4,142 bytes parent folder | download | duplicates (5)
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
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkCoincidentTopologyResolutionPainter.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 vtkCoincidentTopologyResolutionPainter - painter that resolves
// conicident topology.
// .SECTION Description
// Provides the ability to shift the z-buffer to resolve coincident topology.
// For example, if you'd like to draw a mesh with some edges a different color,
// and the edges lie on the mesh, this feature can be useful to get nice
// looking lines.

#ifndef vtkCoincidentTopologyResolutionPainter_h
#define vtkCoincidentTopologyResolutionPainter_h

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

class vtkInformationIntegerKey;
class vtkInformationDoubleKey;
class vtkInformationDoubleVectorKey;

class VTKRENDERINGOPENGL_EXPORT vtkCoincidentTopologyResolutionPainter :
  public vtkPolyDataPainter
{
public:
  static vtkCoincidentTopologyResolutionPainter* New();
  vtkTypeMacro(vtkCoincidentTopologyResolutionPainter,
    vtkPolyDataPainter);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Set/Get a global flag that controls whether coincident topology (e.g., a
  // line on top of a polygon) is shifted to avoid z-buffer resolution (and
  // hence rendering problems). If not off, there are two methods to choose
  // from. PolygonOffset uses graphics systems calls to shift polygons, but
  // does not distinguish vertices and lines from one another. ShiftZBuffer
  // remaps the z-buffer to distinguish vertices, lines, and polygons, but
  // does not always produce acceptable results. If you use the ShiftZBuffer
  // approach, you may also want to set the ResolveCoincidentTopologyZShift
  // value. (Note: not all mappers/graphics systems implement this
  // functionality.)
  static vtkInformationIntegerKey* RESOLVE_COINCIDENT_TOPOLOGY();

  // Description:
  // Used to set the z-shift if ResolveCoincidentTopology is set to
  // ShiftZBuffer.
  static vtkInformationDoubleKey* Z_SHIFT();

  // Description:
  // Used to set the polygon offset scale factor and units. Used when
  // ResolveCoincidentTopology is set to PolygonOffset.
  static vtkInformationDoubleVectorKey* POLYGON_OFFSET_PARAMETERS();

  // Description:
  // When set and when RESOLVE_COINCIDENT_TOPOLOGY is set to use polygon offset,
  // solid polygonal faces will be offsetted, otherwise lines/vertices will be
  // offsetted.
  static vtkInformationIntegerKey* POLYGON_OFFSET_FACES();
protected:
  vtkCoincidentTopologyResolutionPainter();
  ~vtkCoincidentTopologyResolutionPainter();

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

  // These are method to set ivars. These are purpisefully protected.
  // The only means to affect these values is thru information object.
  vtkSetMacro(ResolveCoincidentTopology, int);
  vtkSetMacro(ZShift, double);
  vtkSetMacro(OffsetFaces, int);
  void SetPolygonOffsetParameters(double factor, double units)
    {
    if (this->PolygonOffsetFactor != factor ||
      this->PolygonOffsetUnits != units)
      {
      this->PolygonOffsetFactor = factor;
      this->PolygonOffsetUnits = units;
      this->Modified();
      }
    }

  int ResolveCoincidentTopology;
  double PolygonOffsetFactor;
  double PolygonOffsetUnits;
  double ZShift;
  int OffsetFaces;
private:
  vtkCoincidentTopologyResolutionPainter(const vtkCoincidentTopologyResolutionPainter&); // Not implemented.
  void operator=(const vtkCoincidentTopologyResolutionPainter&); // Not implemented.
};


#endif