|
||||
File indexing completed on 2025-01-18 10:03:48
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 0028 //! Initialization to load cubemap from file. 0029 //! @theFileName - path to the cubemap image 0030 //! @theOrder - array containing six different indexes of cubemap sides which maps tile grid to cubemap sides 0031 Standard_EXPORT Graphic3d_CubeMapPacked (const TCollection_AsciiString& theFileName, 0032 const Graphic3d_ValidatedCubeMapOrder& theOrder = Graphic3d_CubeMapOrder::Default()); 0033 0034 //! Initialization to set cubemap directly by PixMap. 0035 //! @thePixMap - origin PixMap 0036 //! @theOrder - array containing six different indexes of cubemap sides which maps tile grid to cubemap sides 0037 Standard_EXPORT Graphic3d_CubeMapPacked (const Handle(Image_PixMap)& theImage, 0038 const Graphic3d_ValidatedCubeMapOrder& theOrder = Graphic3d_CubeMapOrder::Default()); 0039 0040 //! Returns current cubemap side as compressed PixMap. 0041 Standard_EXPORT virtual Handle(Image_CompressedPixMap) CompressedValue (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE; 0042 0043 //! Returns current cubemap side as PixMap. 0044 //! Resulting PixMap is memory wrapper over original image. 0045 //! Returns null handle if current side or whole cubemap is invalid. 0046 //! Origin image has to contain six quad tiles having one sizes without any gaps to be valid. 0047 Standard_EXPORT virtual Handle(Image_PixMap) Value (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE; 0048 0049 //! Empty destructor. 0050 ~Graphic3d_CubeMapPacked() {} 0051 0052 private: 0053 0054 //! Checks whether given tiles order is valid. 0055 static Standard_Boolean checkOrder (const NCollection_Array1<unsigned int>& theOrder); 0056 0057 //! Checks whether given pixmap is valid to contain six tiles. 0058 static Standard_Boolean checkImage (const Handle(Image_PixMap)& theImage, 0059 unsigned int& theTileNumberX); 0060 0061 //! Tries to load image from file and checks it after that. 0062 //! Does nothing in case of fail. 0063 void tryLoadImage (const Handle(Image_SupportedFormats)& theSupported, 0064 const TCollection_AsciiString &theFilePath); 0065 0066 protected: 0067 0068 Graphic3d_CubeMapOrder myOrder; //!< order mapping tile grit to cubemap sides 0069 unsigned int myTileNumberX; //!< width of tile grid 0070 0071 }; 0072 0073 DEFINE_STANDARD_HANDLE(Graphic3d_CubeMapPacked, Graphic3d_CubeMap) 0074 0075 #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 |