VTK  9.7.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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 class vtkActor;
29 class vtkBox;
30 class vtkCellPicker;
31 class vtkConeSource;
32 class vtkLineSource;
34 class vtkPolyDataMapper;
35 class vtkProperty;
36 class vtkSphereSource;
37 
38 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkLightRepresentation
40 {
41 public:
42  static vtkLightRepresentation* New();
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
47 
50  vtkSetMacro(Positional, bool);
51  vtkGetMacro(Positional, bool);
52  vtkBooleanMacro(Positional, bool);
54 
56 
59  void SetLightPosition(double pos[3]);
60  vtkGetVector3Macro(LightPosition, double);
62 
64 
67  void SetFocalPoint(double pos[3]);
68  vtkGetVector3Macro(FocalPoint, double);
70 
72 
76  void SetConeAngle(double angle);
77  vtkGetMacro(ConeAngle, double);
79 
81 
84  void SetLightColor(double* color);
85  double* GetLightColor() VTK_SIZEHINT(3);
87 
91  enum
92  {
93  Outside = 0,
97  ScalingConeAngle
98  };
99 
101 
110  vtkSetClampMacro(InteractionState, int, Outside, ScalingConeAngle);
112 
114 
117  vtkGetObjectMacro(Property, vtkProperty);
119 
121 
124  void BuildRepresentation() override;
125  int ComputeInteractionState(int X, int Y, int modify = 0) override;
126  void StartWidgetInteraction(double eventPosition[2]) override;
127  void WidgetInteraction(double eventPosition[2]) override;
128  double* GetBounds() override;
130 
132 
135  void ReleaseGraphicsResources(vtkWindow* w) override;
136  int RenderOpaqueGeometry(vtkViewport* viewport) override;
137  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
139 
145  void GetActors(vtkPropCollection*) override;
146 
147 protected:
149  ~vtkLightRepresentation() override;
150 
151  virtual void SizeHandles();
152  virtual void UpdateSources();
153  virtual void ScaleConeAngle(double* pickPoint, double* lastPickPoint);
154 
158  double LastScalingDistance2 = -1;
159  double LastEventPosition[3] = { 0, 0, 0 };
160 
161  // the Sphere
166 
167  // the Cone
172 
173  // the Line
178 
179  double LightPosition[3] = { 0, 0, 1 };
180  double FocalPoint[3] = { 0, 0, 0 };
181  double ConeAngle = 30;
182  bool Positional = false;
183 
184 private:
186  void operator=(const vtkLightRepresentation&) = delete;
187 };
188 
189 VTK_ABI_NAMESPACE_END
190 #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:41
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:46
represent surface properties of a geometric object
Definition: vtkProperty.h:59
virtual void StartWidgetInteraction(double eventPos[2])
vtkNew< vtkConeSource > Cone
generate polygonal cone
Definition: vtkConeSource.h:34
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
double * GetBounds() override
Methods to make this class behave as a vtkProp.
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
vtkNew< vtkLineSource > Line
create a polygonal sphere centered at the origin
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])
#define VTK_SIZEHINT(...)
vtkNew< vtkCellPicker > SpherePicker
create a line defined by two end points
Definition: vtkLineSource.h:53
map vtkPolyData to graphics primitives
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:62
vtkNew< vtkCellPicker > LinePicker
vtkNew< vtkCellPicker > ConePicker
vtkNew< vtkSphereSource > Sphere
#define VTK_MARSHALAUTO
vtkNew< vtkPolyDataMapper > SphereMapper
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes...
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