Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-17 09:19:37

0001 // Created on: 2021-10-14
0002 // Created by: Artem CHESNOKOV
0003 // Copyright (c) 2021 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Aspect_SkydomeBackground_Header
0017 #define _Aspect_SkydomeBackground_Header
0018 
0019 #include <gp_Dir.hxx>
0020 #include <NCollection_Vec3.hxx>
0021 #include <Standard_TypeDef.hxx>
0022 #include <Standard.hxx>
0023 #include <Standard_DefineAlloc.hxx>
0024 #include <Standard_Handle.hxx>
0025 
0026 //! This class allows the definition of a window skydome background.
0027 class Aspect_SkydomeBackground
0028 {
0029 public:
0030   DEFINE_STANDARD_ALLOC
0031 
0032   //! Creates a window skydome background.
0033   //! By default skydome is initialized with sun at its zenith (0.0, 1.0, 0.0),
0034   //! average clody (0.2), zero time parameter, zero fogginess, 512x512 texture size.
0035   Standard_EXPORT Aspect_SkydomeBackground();
0036 
0037   //! Creates a window skydome background with given parameters.
0038   //! @param[in] theSunDirection direction to the sun (moon). Sun direction with negative Y
0039   //! component
0040   //!                            represents moon with (-X, -Y, -Z) direction.
0041   //! @param[in] theCloudiness   cloud intensity, 0.0 means no clouds at all and 1.0 - high clody.
0042   //! @param[in] theTime         time parameter of simulation. Might be tweaked to slightly change
0043   //! appearance.
0044   //! @param[in] theFogginess    fog intensity, 0.0 means no fog and 1.0 - high fogginess
0045   //! @param[in] theSize         size of cubemap side in pixels.
0046   Standard_EXPORT Aspect_SkydomeBackground(const gp_Dir& theSunDirection,
0047                                            float         theCloudiness,
0048                                            float         theTime,
0049                                            float         theFogginess,
0050                                            int           theSize);
0051 
0052   //! Destructor.
0053   Standard_EXPORT ~Aspect_SkydomeBackground();
0054 
0055   //! Get sun direction. By default this value is (0, 1, 0)
0056   //! Sun direction with negative Y component represents moon with (-X, -Y, -Z) direction.
0057   const gp_Dir& SunDirection() const { return mySunDirection; }
0058 
0059   //! Get cloud intensity. By default this value is 0.2
0060   //! 0.0 means no clouds at all and 1.0 - high clody.
0061   float Cloudiness() const { return myCloudiness; }
0062 
0063   //! Get time of cloud simulation. By default this value is 0.0
0064   //! This value might be tweaked to slightly change appearance of clouds.
0065   float TimeParameter() const { return myTime; }
0066 
0067   //! Get fog intensity. By default this value is 0.0
0068   //! 0.0 means no fog and 1.0 - high fogginess
0069   float Fogginess() const { return myFogginess; }
0070 
0071   //! Get size of cubemap. By default this value is 512
0072   int Size() const { return mySize; }
0073 
0074   //! Set sun direction. By default this value is (0, 1, 0)
0075   //! Sun direction with negative Y component represents moon with (-X, -Y, -Z) direction.
0076   void SetSunDirection(const gp_Dir& theSunDirection) { mySunDirection = theSunDirection; }
0077 
0078   //! Set cloud intensity. By default this value is 0.2
0079   //! 0.0 means no clouds at all and 1.0 - high clody.
0080   Standard_EXPORT void SetCloudiness(float theCloudiness);
0081 
0082   //! Set time of cloud simulation. By default this value is 0.0
0083   //! This value might be tweaked to slightly change appearance of clouds.
0084   void SetTimeParameter(float theTime) { myTime = theTime; }
0085 
0086   //! Set fog intensity. By default this value is 0.0
0087   //! 0.0 means no fog and 1.0 - high fogginess
0088   Standard_EXPORT void SetFogginess(float theFogginess);
0089 
0090   //! Set size of cubemap. By default this value is 512
0091   Standard_EXPORT void SetSize(int theSize);
0092 
0093   //! Dumps the content of me into the stream
0094   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const;
0095 
0096 private:
0097   gp_Dir mySunDirection; //!< Sun (moon) light direction.
0098   float  myCloudiness;   //!< Cloud intensity.
0099   float  myTime;         //!< Simulation time parameter.
0100   float  myFogginess;    //!< Fog intensity
0101   int    mySize;         //!< Size of cubemap in pixels
0102 };
0103 
0104 #endif // _Aspect_SkydomeBackground_Header