0029292: Coding Rules - remove Graphic3d_Vector duplicating gp_XYZ
[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.
21b2385f 53 Standard_EXPORT void SetDirection (V3d_TypeOfOrientation theDirection);
c357e426 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.
21b2385f 57 Standard_EXPORT void SetDirection (Standard_Real theXm,
58 Standard_Real theYm,
59 Standard_Real theZm);
c357e426 60
42cf5bc1 61 //! Defines the point of light source representation.
21b2385f 62 Standard_EXPORT void SetDisplayPosition (Standard_Real theX,
63 Standard_Real theY,
64 Standard_Real theZ);
c357e426 65
42cf5bc1 66 //! Calls SetDisplayPosition method.
21b2385f 67 virtual void SetPosition (Standard_Real theXp,
68 Standard_Real theYp,
69 Standard_Real theZp) Standard_OVERRIDE { SetDisplayPosition (theXp, theYp, theZp); }
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.
21b2385f 87 virtual void Position (Standard_Real& theX,
88 Standard_Real& theY,
89 Standard_Real& theZ) const Standard_OVERRIDE { DisplayPosition (theX, theY, theZ); }
42cf5bc1 90
c357e426 91 //! Returns the chosen position to represent the light source.
21b2385f 92 void DisplayPosition (Standard_Real& theX,
93 Standard_Real& theY,
94 Standard_Real& theZ) const { myDisplayPosition.Coord (theX, theY, theZ); }
42cf5bc1 95
c357e426 96 //! Returns the theVx, theVy, theVz direction of the light source.
21b2385f 97 void Direction (Standard_Real& theVx,
98 Standard_Real& theVy,
99 Standard_Real& theVz) const
100 {
101 theVx = myLight.Direction.x();
102 theVy = myLight.Direction.y();
103 theVz = myLight.Direction.z();
104 }
42cf5bc1 105
92efcf78 106 DEFINE_STANDARD_RTTIEXT(V3d_DirectionalLight,V3d_PositionLight)
42cf5bc1 107
42cf5bc1 108private:
109
42cf5bc1 110 //! Defines the representation of the directional light source.
c357e426 111 Standard_EXPORT void Symbol (const Handle(Graphic3d_Group)& theSymbol,
112 const Handle(V3d_View)& theView) const Standard_OVERRIDE;
42cf5bc1 113
c357e426 114private:
42cf5bc1 115
21b2385f 116 gp_Pnt myDisplayPosition;
42cf5bc1 117};
118
42cf5bc1 119#endif // _V3d_DirectionalLight_HeaderFile