VTK  9.3.1
vtkLightRepresentation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
19 #ifndef vtkLightRepresentation_h
20 #define vtkLightRepresentation_h
21 
22 #include "vtkInteractionWidgetsModule.h" // For export macro
23 #include "vtkNew.h" // Needed for vtkNew
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkActor;
28 class vtkBox;
29 class vtkCellPicker;
30 class vtkConeSource;
31 class vtkLineSource;
33 class vtkPolyDataMapper;
34 class vtkProperty;
35 class vtkSphereSource;
36 
37 class VTKINTERACTIONWIDGETS_EXPORT vtkLightRepresentation : public vtkWidgetRepresentation
38 {
39 public:
40  static vtkLightRepresentation* New();
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
45 
48  vtkSetMacro(Positional, bool);
49  vtkGetMacro(Positional, bool);
50  vtkBooleanMacro(Positional, bool);
52 
54 
57  void SetLightPosition(double pos[3]);
58  vtkGetVector3Macro(LightPosition, double);
60 
62 
65  void SetFocalPoint(double pos[3]);
66  vtkGetVector3Macro(FocalPoint, double);
68 
70 
74  void SetConeAngle(double angle);
75  vtkGetMacro(ConeAngle, double);
77 
79 
82  void SetLightColor(double* color);
83  double* GetLightColor() VTK_SIZEHINT(3);
85 
89  enum
90  {
91  Outside = 0,
95  ScalingConeAngle
96  };
97 
99 
108  vtkSetClampMacro(InteractionState, int, Outside, ScalingConeAngle);
110 
112 
115  vtkGetObjectMacro(Property, vtkProperty);
117 
119 
122  void BuildRepresentation() override;
123  int ComputeInteractionState(int X, int Y, int modify = 0) override;
124  void StartWidgetInteraction(double eventPosition[2]) override;
125  void WidgetInteraction(double eventPosition[2]) override;
126  double* GetBounds() override;
128 
130 
133  void ReleaseGraphicsResources(vtkWindow* w) override;
134  int RenderOpaqueGeometry(vtkViewport* viewport) override;
135  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
137 
138 protected:
140  ~vtkLightRepresentation() override;
141 
142  virtual void SizeHandles();
143  virtual void UpdateSources();
144  virtual void ScaleConeAngle(double* pickPoint, double* lastPickPoint);
145 
149  double LastScalingDistance2 = -1;
150  double LastEventPosition[3] = { 0, 0, 0 };
151 
152  // the Sphere
157 
158  // the Cone
163 
164  // the Line
169 
170  double LightPosition[3] = { 0, 0, 1 };
171  double FocalPoint[3] = { 0, 0, 0 };
172  double ConeAngle = 30;
173  bool Positional = false;
174 
175 private:
177  void operator=(const vtkLightRepresentation&) = delete;
178 };
179 
180 VTK_ABI_NAMESPACE_END
181 #endif
represent a vtkLight
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
vtkNew< vtkProperty > Property
vtkNew< vtkPolyDataMapper > ConeMapper
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:40
virtual int ComputeInteractionState(int X, int Y, int modify=0)
represent the position of a point in 3D space
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:56
virtual void StartWidgetInteraction(double eventPos[2])
vtkNew< vtkConeSource > Cone
generate polygonal cone
Definition: vtkConeSource.h:33
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
double * GetBounds() override
Methods to make this class behave as a vtkProp.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
vtkNew< vtkLineSource > Line
create a polygonal sphere centered at the origin
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
a simple class to control print indentation
Definition: vtkIndent.h:28
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
virtual void WidgetInteraction(double newEventPos[2])
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
#define VTK_SIZEHINT(...)
vtkNew< vtkCellPicker > SpherePicker
create a line defined by two end points
Definition: vtkLineSource.h:52
map vtkPolyData to graphics primitives
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:61
vtkNew< vtkCellPicker > LinePicker
vtkNew< vtkCellPicker > ConePicker
vtkNew< vtkSphereSource > Sphere
vtkNew< vtkPolyDataMapper > SphereMapper
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
implicit function for a bounding box
Definition: vtkBox.h:30
vtkNew< vtkPolyDataMapper > LineMapper
vtkNew< vtkActor > SphereActor