VTK  9.3.0
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:
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);
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 
134  int RenderOpaqueGeometry(vtkViewport* viewport) override;
137 
138 protected:
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
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
implicit function for a bounding box
Definition: vtkBox.h:31
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:62
generate polygonal cone
Definition: vtkConeSource.h:34
a simple class to control print indentation
Definition: vtkIndent.h:29
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
Method to satisfy superclasses' API.
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
Method to satisfy superclasses' API.
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
Method to satisfy superclasses' API.
vtkNew< vtkPolyDataMapper > LineMapper
void StartWidgetInteraction(double eventPosition[2]) override
Method to satisfy superclasses' API.
virtual void UpdateSources()
int RenderOpaqueGeometry(vtkViewport *viewport) override
Methods required by vtkProp superclass.
vtkNew< vtkLineSource > Line
static vtkLightRepresentation * New()
vtkNew< vtkProperty > Property
double * GetLightColor()
Set/Get the light color.
~vtkLightRepresentation() override
vtkNew< vtkSphereSource > Sphere
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
Methods required by vtkProp superclass.
create a line defined by two end points
Definition: vtkLineSource.h:53
represent the position of a point in 3D space
map vtkPolyData to graphics primitives
represent surface properties of a geometric object
Definition: vtkProperty.h:57
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:28
@ color
Definition: vtkX3D.h:221
#define VTK_SIZEHINT(...)