|
|
|||
File indexing completed on 2026-10-04 09:14:39
0001 // Author: Ilya Khramov 0002 // Copyright (c) 2019 OPEN CASCADE SAS 0003 // 0004 // This file is part of Open CASCADE Technology software library. 0005 // 0006 // This library is free software; you can redistribute it and/or modify it under 0007 // the terms of the GNU Lesser General Public License version 2.1 as published 0008 // by the Free Software Foundation, with special exception defined in the file 0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0010 // distribution for complete text of the license and disclaimer of any warranty. 0011 // 0012 // Alternatively, this file may be used under the terms of Open CASCADE 0013 // commercial license or contractual agreement. 0014 0015 #ifndef _Graphic3d_CubeMapPacked_HeaderFile 0016 #define _Graphic3d_CubeMapPacked_HeaderFile 0017 0018 #include <Graphic3d_CubeMap.hxx> 0019 #include <NCollection_Array1.hxx> 0020 #include <OSD_Path.hxx> 0021 0022 //! Class is intended to process cubemap packed into single image plane. 0023 class Graphic3d_CubeMapPacked : public Graphic3d_CubeMap 0024 { 0025 DEFINE_STANDARD_RTTIEXT(Graphic3d_CubeMapPacked, Graphic3d_CubeMap) 0026 public: 0027 //! Initialization to load cubemap from file. 0028 //! @theFileName - path to the cubemap image 0029 //! @theOrder - array containing six different indexes of cubemap sides which maps tile grid to 0030 //! cubemap sides 0031 Standard_EXPORT Graphic3d_CubeMapPacked( 0032 const TCollection_AsciiString& theFileName, 0033 const Graphic3d_ValidatedCubeMapOrder& theOrder = Graphic3d_CubeMapOrder::Default()); 0034 0035 //! Initialization to set cubemap directly by PixMap. 0036 //! @thePixMap - origin PixMap 0037 //! @theOrder - array containing six different indexes of cubemap sides which maps tile grid to 0038 //! cubemap sides 0039 Standard_EXPORT Graphic3d_CubeMapPacked( 0040 const occ::handle<Image_PixMap>& theImage, 0041 const Graphic3d_ValidatedCubeMapOrder& theOrder = Graphic3d_CubeMapOrder::Default()); 0042 0043 //! Returns current cubemap side as compressed PixMap. 0044 Standard_EXPORT occ::handle<Image_CompressedPixMap> CompressedValue( 0045 const occ::handle<Image_SupportedFormats>& theSupported) override; 0046 0047 //! Returns current cubemap side as PixMap. 0048 //! Resulting PixMap is memory wrapper over original image. 0049 //! Returns null handle if current side or whole cubemap is invalid. 0050 //! Origin image has to contain six quad tiles having one sizes without any gaps to be valid. 0051 Standard_EXPORT occ::handle<Image_PixMap> Value( 0052 const occ::handle<Image_SupportedFormats>& theSupported) override; 0053 0054 //! Empty destructor. 0055 ~Graphic3d_CubeMapPacked() override = default; 0056 0057 private: 0058 //! Checks whether given tiles order is valid. 0059 static bool checkOrder(const NCollection_Array1<unsigned int>& theOrder); 0060 0061 //! Checks whether given pixmap is valid to contain six tiles. 0062 static bool checkImage(const occ::handle<Image_PixMap>& theImage, unsigned int& theTileNumberX); 0063 0064 //! Tries to load image from file and checks it after that. 0065 //! Does nothing in case of fail. 0066 void tryLoadImage(const occ::handle<Image_SupportedFormats>& theSupported, 0067 const TCollection_AsciiString& theFilePath); 0068 0069 protected: 0070 Graphic3d_CubeMapOrder myOrder; //!< order mapping tile grit to cubemap sides 0071 unsigned int myTileNumberX; //!< width of tile grid 0072 }; 0073 0074 #endif // _Graphic3d_CubeMapPacked_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|