VTK  9.2.6
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 =========================================================================*/
31 #ifndef vtkLightRepresentation_h
32 #define vtkLightRepresentation_h
33 
34 #include "vtkInteractionWidgetsModule.h" // For export macro
35 #include "vtkNew.h" // Needed for vtkNew
37 
38 class vtkActor;
39 class vtkBox;
40 class vtkCellPicker;
41 class vtkConeSource;
42 class vtkLineSource;
44 class vtkPolyDataMapper;
45 class vtkProperty;
46 class vtkSphereSource;
47 
48 class VTKINTERACTIONWIDGETS_EXPORT vtkLightRepresentation : public vtkWidgetRepresentation
49 {
50 public:
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
56 
59  vtkSetMacro(Positional, bool);
60  vtkGetMacro(Positional, bool);
61  vtkBooleanMacro(Positional, bool);
63 
65 
68  void SetLightPosition(double pos[3]);
69  vtkGetVector3Macro(LightPosition, double);
71 
73 
76  void SetFocalPoint(double pos[3]);
77  vtkGetVector3Macro(FocalPoint, double);
79 
81 
85  void SetConeAngle(double angle);
86  vtkGetMacro(ConeAngle, double);
88 
90 
93  void SetLightColor(double* color);
96 
100  enum
101  {
102  Outside = 0,
106  ScalingConeAngle
107  };
108 
110 
119  vtkSetClampMacro(InteractionState, int, Outside, ScalingConeAngle);
121 
123 
126  vtkGetObjectMacro(Property, vtkProperty);
128 
130 
133  void BuildRepresentation() override;
134  int ComputeInteractionState(int X, int Y, int modify = 0) override;
135  void StartWidgetInteraction(double eventPosition[2]) override;
136  void WidgetInteraction(double eventPosition[2]) override;
137  double* GetBounds() override;
139 
141 
145  int RenderOpaqueGeometry(vtkViewport* viewport) override;
148 
149 protected:
152 
153  virtual void SizeHandles();
154  virtual void UpdateSources();
155  virtual void ScaleConeAngle(double* pickPoint, double* lastPickPoint);
156 
160  double LastScalingDistance2 = -1;
161  double LastEventPosition[3] = { 0, 0, 0 };
162 
163  // the Sphere
168 
169  // the Cone
174 
175  // the Line
180 
181  double LightPosition[3] = { 0, 0, 1 };
182  double FocalPoint[3] = { 0, 0, 0 };
183  double ConeAngle = 30;
184  bool Positional = false;
185 
186 private:
188  void operator=(const vtkLightRepresentation&) = delete;
189 };
190 
191 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
implicit function for a bounding box
Definition: vtkBox.h:141
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
a simple class to control print indentation
Definition: vtkIndent.h:119
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
represent the position of a point in 3D space
map vtkPolyData to graphics primitives
represent surface properties of a geometric object
Definition: vtkProperty.h:177
create a polygonal sphere centered at the origin
abstract specification for Viewports
Definition: vtkViewport.h:56
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ color
Definition: vtkX3D.h:227
#define VTK_SIZEHINT(...)