0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / V3d / V3d_DirectionalLight.hxx
CommitLineData
42cf5bc1 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
42cf5bc1 20#include <V3d_PositionLight.hxx>
21#include <V3d_TypeOfOrientation.hxx>
42cf5bc1 22
c357e426 23class V3d_Viewer;
42cf5bc1 24class V3d_DirectionalLight;
25DEFINE_STANDARD_HANDLE(V3d_DirectionalLight, V3d_PositionLight)
26
c357e426 27//! Directional light source for a viewer.
42cf5bc1 28class V3d_DirectionalLight : public V3d_PositionLight
29{
42cf5bc1 30public:
31
42cf5bc1 32 //! Creates a directional light source in the viewer.
c357e426 33 Standard_EXPORT V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer,
34 const V3d_TypeOfOrientation theDirection = V3d_XposYposZpos,
87432b82 35 const Quantity_Color& theColor = Quantity_NOC_WHITE,
c357e426 36 const Standard_Boolean theIsHeadlight = Standard_False);
37
42cf5bc1 38 //! Creates a directional light source in the viewer.
c357e426 39 //! theXt, theYt, theZt : Coordinate of light source Target.
40 //! theXp, theYp, theZp : Coordinate of light source Position.
42cf5bc1 41 //! The others parameters describe before.
c357e426 42 Standard_EXPORT V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer,
ee2be2a8 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,
87432b82 49 const Quantity_Color& theColor = Quantity_NOC_WHITE,
c357e426 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.
42cf5bc1 56 //! Warning: raises BadValue from V3d if the vector is null.
ee2be2a8 57 Standard_EXPORT void SetDirection (const Standard_Real theXm,
58 const Standard_Real theYm,
59 const Standard_Real theZm);
c357e426 60
42cf5bc1 61 //! Defines the point of light source representation.
ee2be2a8 62 Standard_EXPORT void SetDisplayPosition (const Standard_Real theX,
63 const Standard_Real theY,
64 const Standard_Real theZ);
c357e426 65
42cf5bc1 66 //! Calls SetDisplayPosition method.
ee2be2a8 67 Standard_EXPORT virtual void SetPosition (const Standard_Real theXp,
68 const Standard_Real theYp,
69 const Standard_Real theZp) Standard_OVERRIDE;
c357e426 70
42cf5bc1 71 //! Modifies the smoothing angle (in radians)
72 Standard_EXPORT void SetSmoothAngle (const Standard_Real theValue);
c357e426 73
42cf5bc1 74 //! Display the graphic structure of light source
c357e426 75 //! in the chosen view. We have three type of representation
42cf5bc1 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.
c357e426 83 Standard_EXPORT void Display (const Handle(V3d_View)& theView,
84 const V3d_TypeOfRepresentation theRepresentation) Standard_OVERRIDE;
42cf5bc1 85
c357e426 86 //! Calls DisplayPosition method.
ee2be2a8 87 Standard_EXPORT virtual void Position (Standard_Real& theX,
88 Standard_Real& theY,
89 Standard_Real& theZ) const Standard_OVERRIDE;
42cf5bc1 90
c357e426 91 //! Returns the chosen position to represent the light source.
ee2be2a8 92 Standard_EXPORT void DisplayPosition (Standard_Real& theX,
93 Standard_Real& theY,
94 Standard_Real& theZ) const;
42cf5bc1 95
c357e426 96 //! Returns the theVx, theVy, theVz direction of the light source.
ee2be2a8 97 Standard_EXPORT void Direction (Standard_Real& theVx,
98 Standard_Real& theVy,
99 Standard_Real& theVz) const;
42cf5bc1 100
92efcf78 101 DEFINE_STANDARD_RTTIEXT(V3d_DirectionalLight,V3d_PositionLight)
42cf5bc1 102
42cf5bc1 103private:
104
42cf5bc1 105 //! Defines the representation of the directional light source.
c357e426 106 Standard_EXPORT void Symbol (const Handle(Graphic3d_Group)& theSymbol,
107 const Handle(V3d_View)& theView) const Standard_OVERRIDE;
42cf5bc1 108
c357e426 109private:
42cf5bc1 110
c357e426 111 Graphic3d_Vertex myDisplayPosition;
42cf5bc1 112};
113
42cf5bc1 114#endif // _V3d_DirectionalLight_HeaderFile