0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / RWObj / RWObj_CafReader.hxx
1 // Copyright (c) 2019 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #ifndef _RWObj_CafReader_HeaderFile
15 #define _RWObj_CafReader_HeaderFile
16
17 #include <RWMesh_CafReader.hxx>
18 #include <RWObj_TriangulationReader.hxx>
19
20 //! The OBJ mesh reader into XDE document.
21 class RWObj_CafReader : public RWMesh_CafReader, protected RWObj_IShapeReceiver
22 {
23   DEFINE_STANDARD_RTTIEXT(RWObj_CafReader, RWMesh_CafReader)
24 public:
25
26   //! Empty constructor.
27   Standard_EXPORT RWObj_CafReader();
28
29   //! Return single precision flag for reading vertex data (coordinates); FALSE by default.
30   Standard_Boolean IsSinglePrecision() const { return myIsSinglePrecision; }
31
32   //! Setup single/double precision flag for reading vertex data (coordinates).
33   void SetSinglePrecision (Standard_Boolean theIsSinglePrecision) { myIsSinglePrecision = theIsSinglePrecision; }
34
35 protected:
36
37   //! Read the mesh from specified file.
38   Standard_EXPORT virtual Standard_Boolean performMesh (const TCollection_AsciiString& theFile,
39                                                         const Handle(Message_ProgressIndicator)& theProgress,
40                                                         const Standard_Boolean theToProbe) Standard_OVERRIDE;
41
42 protected:
43
44   //! Create reader context.
45   //! Can be overridden by sub-class to read triangulation into application-specific data structures instead of Poly_Triangulation.
46   Standard_EXPORT virtual Handle(RWObj_TriangulationReader) createReaderContext();
47
48   //! @param theShape       shape to register
49   //! @param theName        shape name
50   //! @param theMaterial    shape material
51   //! @param theIsRootShape indicates that this is a root object (free shape)
52   Standard_EXPORT virtual void BindNamedShape (const TopoDS_Shape& theShape,
53                                                const TCollection_AsciiString& theName,
54                                                const RWObj_Material* theMaterial,
55                                                const Standard_Boolean theIsRootShape) Standard_OVERRIDE;
56
57 protected:
58
59   NCollection_DataMap<TCollection_AsciiString, Handle(XCAFDoc_VisMaterial)> myObjMaterialMap;
60   Standard_Boolean myIsSinglePrecision; //!< flag for reading vertex data with single or double floating point precision
61 };
62
63 #endif // _RWObj_CafReader_HeaderFile