0024776: Visualization - inherit OpenGl_View from Graphic3d_CView
[occt.git] / src / V3d / V3d_PositionLight.hxx
1 // Created on: 1997-11-21
2 // Created by: ZOV
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _V3d_PositionLight_HeaderFile
18 #define _V3d_PositionLight_HeaderFile
19
20 #include <Graphic3d_Vertex.hxx>
21 #include <Quantity_Parameter.hxx>
22 #include <V3d_Coordinate.hxx>
23 #include <V3d_Light.hxx>
24 #include <V3d_TypeOfPickLight.hxx>
25 #include <V3d_TypeOfRepresentation.hxx>
26
27 class V3d_View;
28 class V3d_Viewer;
29 class V3d_PositionLight;
30 DEFINE_STANDARD_HANDLE(V3d_PositionLight, V3d_Light)
31
32 //! Base class for Positional, Spot and Directional Light classes.
33 class V3d_PositionLight : public V3d_Light
34 {
35 public:
36
37   //! Defines the position of the light source. Should be redefined!
38   Standard_EXPORT virtual void SetPosition (const V3d_Coordinate theX,
39                                             const V3d_Coordinate theY,
40                                             const V3d_Coordinate theZ) = 0;
41
42   //! Defines the target of the light (the center of the sphere).
43   Standard_EXPORT void SetTarget (const V3d_Coordinate theX,
44                                   const V3d_Coordinate theY,
45                                   const V3d_Coordinate theZ);
46
47   //! Define the radius.
48   Standard_EXPORT void SetRadius (const Quantity_Parameter theRadius);
49
50   //! Calculate the position of the light, on the hide face of the picking sphere.
51   Standard_EXPORT void OnHideFace (const Handle(V3d_View)& theView);
52
53   //! Calculate the position of the light, on the seen face of the picking sphere.
54   Standard_EXPORT void OnSeeFace (const Handle(V3d_View)& theView);
55
56   //! Tracking the light position, or the light space,
57   //! or the radius of the light space, that depends of
58   //! initial picking "theWhatPick" (see the pick method).
59   //! If theWhatPick is SPACELIGHT, then the parameters
60   //! theXpix, theYpix are the coordinates of a translation vector.
61   Standard_EXPORT void Tracking (const Handle(V3d_View)& theView,
62                                  const V3d_TypeOfPickLight theWathPick,
63                                  const Standard_Integer theXpix,
64                                  const Standard_Integer theYpix);
65
66   //! Display the graphic structure of light source
67   //! in the chosen view. We have three type of representation
68   //! - SIMPLE   : Only the light source is displayed.
69   //! - PARTIAL  : The light source and the light space are
70   //! displayed.
71   //! - COMPLETE : The light source, the light space and the
72   //! radius of light space are displayed.
73   //! We can choose the "SAMELAST" as parameter of representation
74   //! In this case the graphic structure representation will be
75   //! the last displayed.
76   Standard_EXPORT virtual void Display (const Handle(V3d_View)& theView,
77                                         const V3d_TypeOfRepresentation theRepresentation = V3d_SIMPLE);
78
79   //! Erase the graphic structure of light source.
80   Standard_EXPORT void Erase();
81
82   //! Returns the radius of the picking sphere.
83   Standard_EXPORT Quantity_Parameter Radius() const;
84
85   //! Returns the visibility status
86   //! If True the source is visible.
87   //! If False it's hidden.
88   Standard_EXPORT Standard_Boolean SeeOrHide (const Handle(V3d_View)& theView) const;
89
90   //! Returns the position of the light source.
91   Standard_EXPORT virtual void Position (V3d_Coordinate& theX,
92                                          V3d_Coordinate& theY,
93                                          V3d_Coordinate& theZ) const = 0;
94
95   //! Returns the position of the target of the light source.
96   Standard_EXPORT void Target (V3d_Coordinate& theX,
97                                V3d_Coordinate& theY,
98                                V3d_Coordinate& theZ) const;
99
100   DEFINE_STANDARD_RTTI(V3d_PositionLight,V3d_Light)
101
102 protected:
103
104   Standard_EXPORT V3d_PositionLight (const Handle(V3d_Viewer)& theViewer);
105
106   Graphic3d_Vertex myTarget;
107   V3d_TypeOfRepresentation myTypeOfRepresentation;
108
109 private:
110
111   //! Defines representation of the light source.
112   Standard_EXPORT virtual void Symbol (const Handle(Graphic3d_Group)& theSymbol,
113                                        const Handle(V3d_View)& theView) const = 0;
114 };
115
116 #endif // _V3d_PositionLight_HeaderFile