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 <V3d_Light.hxx>
22 #include <V3d_TypeOfPickLight.hxx>
23 #include <V3d_TypeOfRepresentation.hxx>
27 class V3d_PositionLight;
28 DEFINE_STANDARD_HANDLE(V3d_PositionLight, V3d_Light)
30 //! Base class for Positional, Spot and Directional Light classes.
31 class V3d_PositionLight : public V3d_Light
35 //! Defines the position of the light source. Should be redefined!
36 Standard_EXPORT virtual void SetPosition (Standard_Real theX,
38 Standard_Real theZ) = 0;
40 //! Defines the target of the light (the center of the sphere).
41 Standard_EXPORT void SetTarget (const Standard_Real theX,
42 const Standard_Real theY,
43 const Standard_Real theZ);
45 //! Define the radius.
46 Standard_EXPORT void SetRadius (const Standard_Real theRadius);
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);
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);
54 //! Tracking the light position, or the light space,
55 //! or the radius of the light space, that depends of
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);
64 //! Display the graphic structure of light source
65 //! in the chosen view. We have three type of representation
66 //! - SIMPLE : Only the light source is displayed.
67 //! - PARTIAL : The light source and the light space are
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.
74 Standard_EXPORT virtual void Display (const Handle(V3d_View)& theView,
75 const V3d_TypeOfRepresentation theRepresentation = V3d_SIMPLE);
77 //! Erase the graphic structure of light source.
78 Standard_EXPORT void Erase();
80 //! Returns the radius of the picking sphere.
81 Standard_EXPORT Standard_Real Radius() const;
83 //! Returns the visibility status
84 //! If True the source is visible.
85 //! If False it's hidden.
86 Standard_EXPORT Standard_Boolean SeeOrHide (const Handle(V3d_View)& theView) const;
88 //! Returns the position of the light source.
89 Standard_EXPORT virtual void Position (Standard_Real& theX,
91 Standard_Real& theZ) const = 0;
93 //! Returns the position of the target of the light source.
94 void Target (Standard_Real& theX,
96 Standard_Real& theZ) const { myTarget.Coord (theX, theY, theZ); }
98 DEFINE_STANDARD_RTTIEXT(V3d_PositionLight,V3d_Light)
102 Standard_EXPORT V3d_PositionLight (const Handle(V3d_Viewer)& theViewer);
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