1 // Created on: 1992-01-22
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _V3d_DirectionalLight_HeaderFile
18 #define _V3d_DirectionalLight_HeaderFile
20 #include <V3d_PositionLight.hxx>
21 #include <V3d_TypeOfOrientation.hxx>
24 class V3d_DirectionalLight;
25 DEFINE_STANDARD_HANDLE(V3d_DirectionalLight, V3d_PositionLight)
27 //! Directional light source for a viewer.
28 class V3d_DirectionalLight : public V3d_PositionLight
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_Color& theColor = Quantity_NOC_WHITE,
36 const Standard_Boolean theIsHeadlight = Standard_False);
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 Standard_Real theXt,
44 const Standard_Real theYt,
45 const Standard_Real theZt,
46 const Standard_Real theXp,
47 const Standard_Real theYp,
48 const Standard_Real theZp,
49 const Quantity_Color& theColor = Quantity_NOC_WHITE,
50 const Standard_Boolean theIsHeadlight = Standard_False);
52 //! Defines the direction of the light source by a predefined orientation.
53 Standard_EXPORT void SetDirection (const V3d_TypeOfOrientation theDirection);
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 Standard_Real theXm,
58 const Standard_Real theYm,
59 const Standard_Real theZm);
61 //! Defines the point of light source representation.
62 Standard_EXPORT void SetDisplayPosition (const Standard_Real theX,
63 const Standard_Real theY,
64 const Standard_Real theZ);
66 //! Calls SetDisplayPosition method.
67 Standard_EXPORT virtual void SetPosition (const Standard_Real theXp,
68 const Standard_Real theYp,
69 const Standard_Real theZp) Standard_OVERRIDE;
71 //! Modifies the smoothing angle (in radians)
72 Standard_EXPORT void SetSmoothAngle (const Standard_Real theValue);
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
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;
86 //! Calls DisplayPosition method.
87 Standard_EXPORT virtual void Position (Standard_Real& theX,
89 Standard_Real& theZ) const Standard_OVERRIDE;
91 //! Returns the chosen position to represent the light source.
92 Standard_EXPORT void DisplayPosition (Standard_Real& theX,
94 Standard_Real& theZ) const;
96 //! Returns the theVx, theVy, theVz direction of the light source.
97 Standard_EXPORT void Direction (Standard_Real& theVx,
99 Standard_Real& theVz) const;
101 DEFINE_STANDARD_RTTIEXT(V3d_DirectionalLight,V3d_PositionLight)
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;
111 Graphic3d_Vertex myDisplayPosition;
114 #endif // _V3d_DirectionalLight_HeaderFile