1 // Created on: 1997-11-21
3 // Copyright (c) 1997-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_PositionLight_HeaderFile
18 #define _V3d_PositionLight_HeaderFile
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>
29 class V3d_PositionLight;
30 DEFINE_STANDARD_HANDLE(V3d_PositionLight, V3d_Light)
32 //! Base class for Positional, Spot and Directional Light classes.
33 class V3d_PositionLight : public V3d_Light
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;
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);
47 //! Define the radius.
48 Standard_EXPORT void SetRadius (const Quantity_Parameter theRadius);
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);
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);
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);
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
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);
79 //! Erase the graphic structure of light source.
80 Standard_EXPORT void Erase();
82 //! Returns the radius of the picking sphere.
83 Standard_EXPORT Quantity_Parameter Radius() const;
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;
90 //! Returns the position of the light source.
91 Standard_EXPORT virtual void Position (V3d_Coordinate& theX,
93 V3d_Coordinate& theZ) const = 0;
95 //! Returns the position of the target of the light source.
96 Standard_EXPORT void Target (V3d_Coordinate& theX,
98 V3d_Coordinate& theZ) const;
100 DEFINE_STANDARD_RTTI(V3d_PositionLight,V3d_Light)
104 Standard_EXPORT V3d_PositionLight (const Handle(V3d_Viewer)& theViewer);
106 Graphic3d_Vertex myTarget;
107 V3d_TypeOfRepresentation myTypeOfRepresentation;
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;
116 #endif // _V3d_PositionLight_HeaderFile