42cf5bc1 |
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 | |
42cf5bc1 |
20 | #include <Graphic3d_Vertex.hxx> |
c357e426 |
21 | #include <V3d_Light.hxx> |
42cf5bc1 |
22 | #include <V3d_TypeOfPickLight.hxx> |
c357e426 |
23 | #include <V3d_TypeOfRepresentation.hxx> |
42cf5bc1 |
24 | |
c357e426 |
25 | class V3d_View; |
26 | class V3d_Viewer; |
42cf5bc1 |
27 | class V3d_PositionLight; |
28 | DEFINE_STANDARD_HANDLE(V3d_PositionLight, V3d_Light) |
29 | |
c357e426 |
30 | //! Base class for Positional, Spot and Directional Light classes. |
42cf5bc1 |
31 | class V3d_PositionLight : public V3d_Light |
32 | { |
42cf5bc1 |
33 | public: |
34 | |
42cf5bc1 |
35 | //! Defines the position of the light source. Should be redefined! |
ee2be2a8 |
36 | Standard_EXPORT virtual void SetPosition (const Standard_Real theX, |
37 | const Standard_Real theY, |
38 | const Standard_Real theZ) = 0; |
c357e426 |
39 | |
40 | //! Defines the target of the light (the center of the sphere). |
ee2be2a8 |
41 | Standard_EXPORT void SetTarget (const Standard_Real theX, |
42 | const Standard_Real theY, |
43 | const Standard_Real theZ); |
c357e426 |
44 | |
42cf5bc1 |
45 | //! Define the radius. |
ee2be2a8 |
46 | Standard_EXPORT void SetRadius (const Standard_Real theRadius); |
c357e426 |
47 | |
48 | //! Calculate the position of the light, on the hide face of the picking sphere. |
49 | Standard_EXPORT void OnHideFace (const Handle(V3d_View)& theView); |
50 | |
51 | //! Calculate the position of the light, on the seen face of the picking sphere. |
52 | Standard_EXPORT void OnSeeFace (const Handle(V3d_View)& theView); |
53 | |
42cf5bc1 |
54 | //! Tracking the light position, or the light space, |
55 | //! or the radius of the light space, that depends of |
c357e426 |
56 | //! initial picking "theWhatPick" (see the pick method). |
57 | //! If theWhatPick is SPACELIGHT, then the parameters |
58 | //! theXpix, theYpix are the coordinates of a translation vector. |
59 | Standard_EXPORT void Tracking (const Handle(V3d_View)& theView, |
60 | const V3d_TypeOfPickLight theWathPick, |
61 | const Standard_Integer theXpix, |
62 | const Standard_Integer theYpix); |
63 | |
42cf5bc1 |
64 | //! Display the graphic structure of light source |
c357e426 |
65 | //! in the chosen view. We have three type of representation |
42cf5bc1 |
66 | //! - SIMPLE : Only the light source is displayed. |
67 | //! - PARTIAL : The light source and the light space are |
68 | //! displayed. |
69 | //! - COMPLETE : The light source, the light space and the |
70 | //! radius of light space are displayed. |
71 | //! We can choose the "SAMELAST" as parameter of representation |
72 | //! In this case the graphic structure representation will be |
73 | //! the last displayed. |
c357e426 |
74 | Standard_EXPORT virtual void Display (const Handle(V3d_View)& theView, |
75 | const V3d_TypeOfRepresentation theRepresentation = V3d_SIMPLE); |
76 | |
42cf5bc1 |
77 | //! Erase the graphic structure of light source. |
78 | Standard_EXPORT void Erase(); |
c357e426 |
79 | |
42cf5bc1 |
80 | //! Returns the radius of the picking sphere. |
ee2be2a8 |
81 | Standard_EXPORT Standard_Real Radius() const; |
c357e426 |
82 | |
42cf5bc1 |
83 | //! Returns the visibility status |
84 | //! If True the source is visible. |
85 | //! If False it's hidden. |
c357e426 |
86 | Standard_EXPORT Standard_Boolean SeeOrHide (const Handle(V3d_View)& theView) const; |
42cf5bc1 |
87 | |
c357e426 |
88 | //! Returns the position of the light source. |
ee2be2a8 |
89 | Standard_EXPORT virtual void Position (Standard_Real& theX, |
90 | Standard_Real& theY, |
91 | Standard_Real& theZ) const = 0; |
42cf5bc1 |
92 | |
c357e426 |
93 | //! Returns the position of the target of the light source. |
ee2be2a8 |
94 | Standard_EXPORT void Target (Standard_Real& theX, |
95 | Standard_Real& theY, |
96 | Standard_Real& theZ) const; |
42cf5bc1 |
97 | |
92efcf78 |
98 | DEFINE_STANDARD_RTTIEXT(V3d_PositionLight,V3d_Light) |
42cf5bc1 |
99 | |
100 | protected: |
101 | |
c357e426 |
102 | Standard_EXPORT V3d_PositionLight (const Handle(V3d_Viewer)& theViewer); |
42cf5bc1 |
103 | |
c357e426 |
104 | Graphic3d_Vertex myTarget; |
105 | V3d_TypeOfRepresentation myTypeOfRepresentation; |
42cf5bc1 |
106 | |
107 | private: |
108 | |
42cf5bc1 |
109 | //! Defines representation of the light source. |
c357e426 |
110 | Standard_EXPORT virtual void Symbol (const Handle(Graphic3d_Group)& theSymbol, |
111 | const Handle(V3d_View)& theView) const = 0; |
42cf5bc1 |
112 | }; |
113 | |
42cf5bc1 |
114 | #endif // _V3d_PositionLight_HeaderFile |