0027667: OCAF binary persistence hangs on reading truncated CBF file
[occt.git] / src / V3d / V3d_DirectionalLight.hxx
1 // Created on: 1992-01-22
2 // Created by: GG
3 // Copyright (c) 1992-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_DirectionalLight_HeaderFile
18 #define _V3d_DirectionalLight_HeaderFile
19
20 #include <V3d_PositionLight.hxx>
21 #include <V3d_TypeOfOrientation.hxx>
22
23 class V3d_Viewer;
24 class V3d_DirectionalLight;
25 DEFINE_STANDARD_HANDLE(V3d_DirectionalLight, V3d_PositionLight)
26
27 //! Directional light source for a viewer.
28 class V3d_DirectionalLight : public V3d_PositionLight
29 {
30 public:
31
32   //! Creates a directional light source in the viewer.
33   Standard_EXPORT V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer,
34                                         const V3d_TypeOfOrientation theDirection = V3d_XposYposZpos,
35                                         const Quantity_NameOfColor theColor = Quantity_NOC_WHITE,
36                                         const Standard_Boolean theIsHeadlight = Standard_False);
37
38   //! Creates a directional light source in the viewer.
39   //! theXt, theYt, theZt : Coordinate of light source Target.
40   //! theXp, theYp, theZp : Coordinate of light source Position.
41   //! The others parameters describe before.
42   Standard_EXPORT V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer,
43                                         const V3d_Coordinate theXt,
44                                         const V3d_Coordinate theYt,
45                                         const V3d_Coordinate theZt,
46                                         const V3d_Coordinate theXp,
47                                         const V3d_Coordinate theYp,
48                                         const V3d_Coordinate theZp,
49                                         const Quantity_NameOfColor theColor = Quantity_NOC_WHITE,
50                                         const Standard_Boolean theIsHeadlight = Standard_False);
51
52   //! Defines the direction of the light source by a predefined orientation.
53   Standard_EXPORT void SetDirection (const V3d_TypeOfOrientation theDirection);
54
55   //! Defines the direction of the light source by the predefined vector theXm, theYm, theZm.
56   //! Warning: raises  BadValue from V3d if the vector is null.
57   Standard_EXPORT void SetDirection (const Quantity_Parameter theXm,
58                                      const Quantity_Parameter theYm,
59                                      const Quantity_Parameter theZm);
60
61   //! Defines the point of light source representation.
62   Standard_EXPORT void SetDisplayPosition (const V3d_Coordinate theX,
63                                            const V3d_Coordinate theY,
64                                            const V3d_Coordinate theZ);
65
66   //! Calls SetDisplayPosition method.
67   Standard_EXPORT virtual void SetPosition (const V3d_Coordinate theXp,
68                                             const V3d_Coordinate theYp,
69                                             const V3d_Coordinate theZp) Standard_OVERRIDE;
70
71   //! Modifies the smoothing angle (in radians)
72   Standard_EXPORT void SetSmoothAngle (const Standard_Real theValue);
73
74   //! Display the graphic structure of light source
75   //! in the chosen view. We have three type of representation
76   //! - SIMPLE   : Only the light source is displayed.
77   //! - PARTIAL  : The light source and the light space are
78   //! displayed.
79   //! - COMPLETE : The same representation as PARTIAL.
80   //! We can choose the "SAMELAST" as parameter of representation
81   //! In this case the graphic structure representation will be
82   //! the last displayed.
83   Standard_EXPORT void Display (const Handle(V3d_View)& theView,
84                                 const V3d_TypeOfRepresentation theRepresentation) Standard_OVERRIDE;
85
86   //! Calls DisplayPosition method.
87   Standard_EXPORT virtual void Position (V3d_Coordinate& theX,
88                                          V3d_Coordinate& theY,
89                                          V3d_Coordinate& theZ) const Standard_OVERRIDE;
90
91   //! Returns the chosen position to represent the light source.
92   Standard_EXPORT void DisplayPosition (V3d_Coordinate& theX,
93                                         V3d_Coordinate& theY,
94                                         V3d_Coordinate& theZ) const;
95
96   //! Returns the theVx, theVy, theVz direction of the light source.
97   Standard_EXPORT void Direction (Quantity_Parameter& theVx,
98                                   Quantity_Parameter& theVy,
99                                   Quantity_Parameter& theVz) const;
100
101   DEFINE_STANDARD_RTTIEXT(V3d_DirectionalLight,V3d_PositionLight)
102
103 private:
104
105   //! Defines the representation of the directional light source.
106   Standard_EXPORT void Symbol (const Handle(Graphic3d_Group)& theSymbol,
107                                const Handle(V3d_View)& theView) const Standard_OVERRIDE;
108
109 private:
110
111   Graphic3d_Vertex myDisplayPosition;
112 };
113
114 #endif // _V3d_DirectionalLight_HeaderFile