1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkProjectedTexture.h,v $
6 Date: $Date: 2002/12/09 13:39:05 $
7 Version: $Revision: 1.17 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notice for more information.
17 =========================================================================*/
18 // .NAME vtkProjectedTexture - assign texture coordinates for a projected texture
19 // .SECTION Description
20 // vtkProjectedTexture assigns texture coordinates to a dataset as if
21 // the texture was projected from a slide projected located somewhere in the
22 // scene. Methods are provided to position the projector and aim it at a
23 // location, to set the width of the projector's frustum, and to set the
24 // range of texture coordinates assigned to the dataset.
26 // Objects in the scene that appear behind the projector are also assigned
27 // texture coordinates; the projected image is left-right and top-bottom
28 // flipped, much as a lens' focus flips the rays of light that pass through
29 // it. A warning is issued if a point in the dataset falls at the focus
32 #ifndef __vtkProjectedTexture_h
33 #define __vtkProjectedTexture_h
35 #include "vtkDataSetToDataSetFilter.h"
37 #define VTK_PROJECTED_TEXTURE_USE_PINHOLE 0
38 #define VTK_PROJECTED_TEXTURE_USE_TWO_MIRRORS 1
40 class VTK_GRAPHICS_EXPORT vtkProjectedTexture : public vtkDataSetToDataSetFilter
43 static vtkProjectedTexture *New();
44 vtkTypeRevisionMacro(vtkProjectedTexture,vtkDataSetToDataSetFilter);
45 void PrintSelf(ostream& os, vtkIndent indent);
48 // Set/Get the position of the focus of the projector.
49 vtkSetVector3Macro(Position,float);
50 vtkGetVectorMacro(Position,float,3);
53 // Set/Get the focal point of the projector (a point that lies along
54 // the center axis of the projector's frustum).
55 void SetFocalPoint(float focalPoint[3]);
56 void SetFocalPoint(float x, float y, float z);
57 vtkGetVectorMacro(FocalPoint,float,3);
60 // Set/Get the camera mode of the projection -- pinhole projection or
61 // two mirror projection.
62 vtkSetMacro(CameraMode, int);
63 vtkGetMacro(CameraMode, int);
64 void SetCameraModeToPinhole() {this->SetCameraMode(VTK_PROJECTED_TEXTURE_USE_PINHOLE);}
65 void SetCameraModeToTwoMirror() {this->SetCameraMode(VTK_PROJECTED_TEXTURE_USE_TWO_MIRRORS);}
68 // Set/Get the mirror separation for the two mirror system.
69 vtkSetMacro(MirrorSeparation, float);
70 vtkGetMacro(MirrorSeparation, float);
73 // Get the normalized orientation vector of the projector.
74 vtkGetVectorMacro(Orientation,float,3);
76 // Set/Get the up vector of the projector.
77 vtkSetVector3Macro(Up,float);
78 vtkGetVectorMacro(Up,float,3);
80 // Set/Get the aspect ratio of a perpendicular cross-section of the
81 // the projector's frustum. The aspect ratio consists of three
82 // numbers: (x, y, z), where x is the width of the
83 // frustum, y is the height, and z is the perpendicular
84 // distance from the focus of the projector.
85 vtkSetVector3Macro(AspectRatio,float);
86 vtkGetVectorMacro(AspectRatio,float,3);
89 // Specify s-coordinate range for texture s-t coordinate pair.
90 vtkSetVector2Macro(SRange,float);
91 vtkGetVectorMacro(SRange,float,2);
94 // Specify t-coordinate range for texture s-t coordinate pair.
95 vtkSetVector2Macro(TRange,float);
96 vtkGetVectorMacro(TRange,float,2);
99 vtkProjectedTexture();
100 ~vtkProjectedTexture() {};
103 void ComputeNormal();
108 float Orientation[3];
111 float MirrorSeparation;
112 float AspectRatio[3];
116 vtkProjectedTexture(const vtkProjectedTexture&); // Not implemented.
117 void operator=(const vtkProjectedTexture&); // Not implemented.