Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-10 09:17:56

0001 // Author: Kirill Gavrilov
0002 // Copyright (c) 2015-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 _RWObj_MtlReader_HeaderFile
0016 #define _RWObj_MtlReader_HeaderFile
0017 
0018 #include <Graphic3d_Vec3.hxx>
0019 #include <RWObj_Material.hxx>
0020 #include <NCollection_DataMap.hxx>
0021 
0022 //! Reader of mtl files.
0023 class RWObj_MtlReader
0024 {
0025 public:
0026   //! Main constructor.
0027   RWObj_MtlReader(NCollection_DataMap<TCollection_AsciiString, RWObj_Material>& theMaterials);
0028 
0029   //! Destructor.
0030   ~RWObj_MtlReader();
0031 
0032   //! Read the file.
0033   bool Read(const TCollection_AsciiString& theFolder, const TCollection_AsciiString& theFile);
0034 
0035 private:
0036   //! Validate scalar value
0037   bool validateScalar(const Standard_Real theValue);
0038 
0039   //! Validate RGB color
0040   bool validateColor(const Graphic3d_Vec3& theVec);
0041 
0042   //! Process texture path.
0043   void processTexturePath(TCollection_AsciiString&       theTexturePath,
0044                           const TCollection_AsciiString& theFolder);
0045 
0046 private:
0047   FILE*                                                         myFile;
0048   TCollection_AsciiString                                       myPath;
0049   NCollection_DataMap<TCollection_AsciiString, RWObj_Material>* myMaterials;
0050   int                                                           myNbLines;
0051 };
0052 
0053 #endif // _RWObj_MtlReader_HeaderFile