VTK  9.0.2
vtkLightRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLightRepresentation.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
28 #ifndef vtkLightRepresentation_h
29 #define vtkLightRepresentation_h
30 
31 #include "vtkInteractionWidgetsModule.h" // For export macro
32 #include "vtkNew.h" // Needed for vtkNew
34 
35 class vtkActor;
36 class vtkBox;
37 class vtkCellPicker;
38 class vtkConeSource;
39 class vtkLineSource;
41 class vtkPolyDataMapper;
42 class vtkProperty;
43 class vtkSphereSource;
44 
45 class VTKINTERACTIONWIDGETS_EXPORT vtkLightRepresentation : public vtkWidgetRepresentation
46 {
47 public:
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
53 
56  vtkSetMacro(Positional, bool);
57  vtkGetMacro(Positional, bool);
58  vtkBooleanMacro(Positional, bool);
60 
62 
65  void SetLightPosition(double pos[3]);
66  vtkGetVector3Macro(LightPosition, double);
68 
70 
73  void SetFocalPoint(double pos[3]);
74  vtkGetVector3Macro(FocalPoint, double);
76 
78 
82  void SetConeAngle(double angle);
83  vtkGetMacro(ConeAngle, double);
85 
87 
90  void SetLightColor(double* color);
93 
97  enum
98  {
99  Outside = 0,
103  ScalingConeAngle
104  };
105 
107 
116  vtkSetClampMacro(InteractionState, int, Outside, ScalingConeAngle);
118 
120 
123  vtkGetObjectMacro(Property, vtkProperty);
125 
127 
130  void BuildRepresentation() override;
131  int ComputeInteractionState(int X, int Y, int modify = 0) override;
132  void StartWidgetInteraction(double eventPosition[2]) override;
133  void WidgetInteraction(double eventPosition[2]) override;
134  double* GetBounds() override;
136 
138 
142  int RenderOpaqueGeometry(vtkViewport* viewport) override;
145 
146 protected:
149 
150  virtual void SizeHandles();
151  virtual void UpdateSources();
152  virtual void ScaleConeAngle(double* pickPoint, double* lastPickPoint);
153 
157  double LastScalingDistance2 = -1;
158  double LastEventPosition[3] = { 0, 0, 0 };
159 
160  // the Sphere
165 
166  // the Cone
171 
172  // the Line
177 
178  double LightPosition[3] = { 0, 0, 1 };
179  double FocalPoint[3] = { 0, 0, 0 };
180  double ConeAngle = 30;
181  bool Positional = false;
182 
183 private:
185  void operator=(const vtkLightRepresentation&) = delete;
186 };
187 
188 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
implicit function for a bounding box
Definition: vtkBox.h:39
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:67
generate polygonal cone
Definition: vtkConeSource.h:39
a simple class to control print indentation
Definition: vtkIndent.h:34
virtual void ScaleConeAngle(double *pickPoint, double *lastPickPoint)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int ComputeInteractionState(int X, int Y, int modify=0) override
vtkNew< vtkActor > SphereActor
vtkNew< vtkPolyDataMapper > ConeMapper
vtkNew< vtkPolyDataMapper > SphereMapper
void BuildRepresentation() override
Method to satisfy superclasses' API.
void SetConeAngle(double angle)
Set/Get the cone angle, in degrees, for the light.
void SetFocalPoint(double pos[3])
Set/Get the coordinates of the focal point of the light representation.
vtkNew< vtkCellPicker > LinePicker
vtkNew< vtkCellPicker > SpherePicker
vtkNew< vtkCellPicker > ConePicker
double * GetBounds() override
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
void SetLightPosition(double pos[3])
Set/Get the coordinates of the position of the light representation.
void ReleaseGraphicsResources(vtkWindow *w) override
Methods required by vtkProp superclass.
vtkNew< vtkConeSource > Cone
void SetLightColor(double *color)
Set/Get the light color.
virtual void SizeHandles()
void WidgetInteraction(double eventPosition[2]) override
vtkNew< vtkPolyDataMapper > LineMapper
void StartWidgetInteraction(double eventPosition[2]) override
virtual void UpdateSources()
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkNew< vtkLineSource > Line
static vtkLightRepresentation * New()
vtkNew< vtkProperty > Property
~vtkLightRepresentation() override
vtkNew< vtkSphereSource > Sphere
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
create a line defined by two end points
Definition: vtkLineSource.h:61
represent the position of a point in 3D space
map vtkPolyData to graphics primitives
represent surface properties of a geometric object
Definition: vtkProperty.h:62
create a polygonal sphere centered at the origin
abstract specification for Viewports
Definition: vtkViewport.h:45
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
@ color
Definition: vtkX3D.h:227
#define VTK_SIZEHINT(...)