1 // Author: Ilya Khramov
2 // Copyright (c) 2019 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _Graphic3d_CubeMapSeparate_HeaderFile
16 #define _Graphic3d_CubeMapSeparate_HeaderFile
18 #include <Graphic3d_CubeMap.hxx>
19 #include <NCollection_Array1.hxx>
20 #include <OSD_Path.hxx>
22 //! Class to manage cubemap located in six different images.
23 class Graphic3d_CubeMapSeparate : public Graphic3d_CubeMap
25 DEFINE_STANDARD_RTTIEXT(Graphic3d_CubeMapSeparate, Graphic3d_CubeMap)
28 //! Initializes cubemap to be loaded from file.
29 //! @thePaths - array of paths to separate image files (has to have size equal 6).
30 Standard_EXPORT Graphic3d_CubeMapSeparate (const NCollection_Array1<TCollection_AsciiString>& thePaths);
32 //! Initializes cubemap to be setted directly from PixMaps.
33 //! @theImages - array if PixMaps (has to have size equal 6).
34 Standard_EXPORT Graphic3d_CubeMapSeparate(const NCollection_Array1<Handle(Image_PixMap)>& theImages);
36 //! Returns current cubemap side as compressed PixMap.
37 Standard_EXPORT virtual Handle(Image_CompressedPixMap) CompressedValue (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE;
39 //! Returns current side of cubemap as PixMap.
40 //! Returns null handle if current side or whole cubemap is invalid.
41 //! All origin images have to have the same sizes, format and quad shapes to form valid cubemap.
42 Standard_EXPORT virtual Handle(Image_PixMap) Value (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE;
45 virtual Handle(Image_PixMap) GetImage (const Handle(Image_SupportedFormats)& ) Standard_OVERRIDE
47 return Handle(Image_PixMap)();
50 //! Checks if a texture class is valid or not.
51 //! Returns true if the construction of the class is correct.
52 Standard_EXPORT Standard_Boolean IsDone() const Standard_OVERRIDE;
55 ~Graphic3d_CubeMapSeparate() {}
59 OSD_Path myPaths[6]; //!< array of paths to cubemap images
60 Handle(Image_PixMap) myImages[6]; //!< array of cubemap images
62 Standard_Size mySize; //!< size of each side of cubemap
63 Image_Format myFormat; //!< format each side of cubemap
67 //! Nulifies whole images array.
72 DEFINE_STANDARD_HANDLE(Graphic3d_CubeMapSeparate, Graphic3d_CubeMap)
74 #endif // _Graphic3d_CubeMapSeparate_HeaderFile