vtkImplicitTextureCoords.h 4.04 KB
Newer Older
Will Schroeder's avatar
Will Schroeder committed
1 2
/*=========================================================================

Ken Martin's avatar
Ken Martin committed
3
  Program:   Visualization Toolkit
Ken Martin's avatar
Ken Martin committed
4
  Module:    vtkImplicitTextureCoords.h
Will Schroeder's avatar
Will Schroeder committed
5

6
  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 8
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
Ken Martin's avatar
Ken Martin committed
9

10 11
     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
     PURPOSE.  See the above copyright notice for more information.
Will Schroeder's avatar
Will Schroeder committed
13 14

=========================================================================*/
Ken Martin's avatar
Ken Martin committed
15
// .NAME vtkImplicitTextureCoords - generate 1D, 2D, or 3D texture coordinates based on implicit function(s)
Will Schroeder's avatar
Will Schroeder committed
16
// .SECTION Description
17 18
// vtkImplicitTextureCoords is a filter to generate 1D, 2D, or 3D texture
// coordinates from one, two, or three implicit functions, respectively.
Will Schroeder's avatar
Will Schroeder committed
19 20 21
// In combinations with a vtkBooleanTexture map (or another texture map of
// your own creation), the texture coordinates can be used to highlight
//(via color or intensity) or cut (via transparency) dataset geometry without
22
// any complex geometric processing. (Note: the texture coordinates are
Will Schroeder's avatar
Will Schroeder committed
23
// referred to as r-s-t coordinates.)
Ken Martin's avatar
Ken Martin committed
24
//
25 26 27 28 29 30
// The texture coordinates are automatically normalized to lie between (0,1).
// Thus, no matter what the implicit functions evaluate to, the resulting
// texture coordinates lie between (0,1), with the zero implicit function
// value mapped to the 0.5 texture coordinates value. Depending upon the
// maximum negative/positive implicit function values, the full (0,1) range
// may not be occupied (i.e., the positive/negative ranges are mapped using
Will Schroeder's avatar
Will Schroeder committed
31 32
// the same scale factor).
//
33 34
// A boolean variable InvertTexture is available to flip the texture
// coordinates around 0.5 (value 1.0 becomes 0.0, 0.25->0.75). This is
Will Schroeder's avatar
Will Schroeder committed
35 36
// equivalent to flipping the texture map (but a whole lot easier).

37 38
// .SECTION Caveats
// You can use the transformation capabilities of vtkImplicitFunction to
39 40
// orient, translate, and scale the implicit functions. Also, the dimension of
// the texture coordinates is implicitly defined by the number of implicit
41
// functions defined.
Will Schroeder's avatar
Will Schroeder committed
42

Will Schroeder's avatar
Will Schroeder committed
43
// .SECTION See Also
Will Schroeder's avatar
Will Schroeder committed
44
// vtkImplicitFunction vtkTexture vtkBooleanTexture vtkTransformTexture
Will Schroeder's avatar
Will Schroeder committed
45

Ken Martin's avatar
Ken Martin committed
46 47
#ifndef __vtkImplicitTextureCoords_h
#define __vtkImplicitTextureCoords_h
Will Schroeder's avatar
Will Schroeder committed
48

49
#include "vtkFiltersTextureModule.h" // For export macro
50
#include "vtkDataSetAlgorithm.h"
51 52

class vtkImplicitFunction;
Will Schroeder's avatar
Will Schroeder committed
53

54
class VTKFILTERSTEXTURE_EXPORT vtkImplicitTextureCoords : public vtkDataSetAlgorithm
Will Schroeder's avatar
Will Schroeder committed
55 56
{
public:
57
  vtkTypeMacro(vtkImplicitTextureCoords,vtkDataSetAlgorithm);
58
  void PrintSelf(ostream& os, vtkIndent indent);
Ken Martin's avatar
Ken Martin committed
59 60 61 62

  // Description:
  // Create object with texture dimension=2 and no r-s-t implicit functions
  // defined and FlipTexture turned off.
63
  static vtkImplicitTextureCoords *New();
64

Will Schroeder's avatar
Will Schroeder committed
65
  // Description:
66
  // Specify an implicit function to compute the r texture coordinate.
67
  virtual void SetRFunction(vtkImplicitFunction*);
Ken Martin's avatar
Ken Martin committed
68
  vtkGetObjectMacro(RFunction,vtkImplicitFunction);
Will Schroeder's avatar
Will Schroeder committed
69 70

  // Description:
71
  // Specify an implicit function to compute the s texture coordinate.
72
  virtual void SetSFunction(vtkImplicitFunction*);
Ken Martin's avatar
Ken Martin committed
73
  vtkGetObjectMacro(SFunction,vtkImplicitFunction);
Will Schroeder's avatar
Will Schroeder committed
74 75

  // Description:
76
  // Specify an implicit function to compute the t texture coordinate.
77
  virtual void SetTFunction(vtkImplicitFunction*);
Ken Martin's avatar
Ken Martin committed
78
  vtkGetObjectMacro(TFunction,vtkImplicitFunction);
Will Schroeder's avatar
Will Schroeder committed
79

Will Schroeder's avatar
Will Schroeder committed
80
  // Description:
Will Schroeder's avatar
Will Schroeder committed
81 82
  // If enabled, this will flip the sense of inside and outside the implicit
  // function (i.e., a rotation around the r-s-t=0.5 axis).
Will Schroeder's avatar
Will Schroeder committed
83 84
  vtkSetMacro(FlipTexture,int);
  vtkGetMacro(FlipTexture,int);
85 86
  vtkBooleanMacro(FlipTexture,int);

Will Schroeder's avatar
Will Schroeder committed
87
protected:
88 89 90
  vtkImplicitTextureCoords();
  ~vtkImplicitTextureCoords();

91
  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
Will Schroeder's avatar
Will Schroeder committed
92

Ken Martin's avatar
Ken Martin committed
93 94 95
  vtkImplicitFunction *RFunction;
  vtkImplicitFunction *SFunction;
  vtkImplicitFunction *TFunction;
Will Schroeder's avatar
Will Schroeder committed
96
  int FlipTexture;
97 98 99
private:
  vtkImplicitTextureCoords(const vtkImplicitTextureCoords&);  // Not implemented.
  void operator=(const vtkImplicitTextureCoords&);  // Not implemented.
Will Schroeder's avatar
Will Schroeder committed
100 101 102 103 104
};

#endif