0025748: Parallel version of progress indicator
[occt.git] / src / RWGltf / RWGltf_CafReader.hxx
CommitLineData
0a419c51 1// Author: Kirill Gavrilov
2// Copyright (c) 2016-2019 OPEN CASCADE SAS
3//
4// This file is part of Open CASCADE Technology software library.
5//
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.
11//
12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
14
15#ifndef _RWGltf_CafReader_HeaderFile
16#define _RWGltf_CafReader_HeaderFile
17
7e785937 18#include <Message_ProgressRange.hxx>
0a419c51 19#include <NCollection_Vector.hxx>
20#include <RWMesh_CafReader.hxx>
21#include <TopoDS_Face.hxx>
22
23class RWGltf_PrimitiveArrayReader;
24
25//! The glTF (GL Transmission Format) mesh reader into XDE document.
26class RWGltf_CafReader : public RWMesh_CafReader
27{
28 DEFINE_STANDARD_RTTIEXT(RWGltf_CafReader, RWMesh_CafReader)
29public:
30
31 //! Empty constructor.
32 Standard_EXPORT RWGltf_CafReader();
33
34 //! Return TRUE if multithreaded optimizations are allowed; FALSE by default.
35 bool ToParallel() const { return myToParallel; }
36
37 //! Setup multithreaded execution.
38 void SetParallel (bool theToParallel) { myToParallel = theToParallel; }
39
803bdcdf 40 //! Return TRUE if Nodes without Geometry should be ignored, TRUE by default.
41 bool ToSkipEmptyNodes() { return myToSkipEmptyNodes; }
42
43 //! Set flag to ignore nodes without Geometry.
44 void SetSkipEmptyNodes (bool theToSkip) { myToSkipEmptyNodes = theToSkip; }
45
46 //! Set flag to use Mesh name in case if Node name is empty, TRUE by default.
47 bool ToUseMeshNameAsFallback() { return myUseMeshNameAsFallback; }
48
49 //! Set flag to use Mesh name in case if Node name is empty.
50 void SetMeshNameAsFallback (bool theToFallback) { myUseMeshNameAsFallback = theToFallback; }
51
0a419c51 52protected:
53
54 //! Read the mesh from specified file.
55 Standard_EXPORT virtual Standard_Boolean performMesh (const TCollection_AsciiString& theFile,
7e785937 56 const Message_ProgressRange& theProgress,
0a419c51 57 const Standard_Boolean theToProbe) Standard_OVERRIDE;
58
59 //! Create primitive array reader context.
60 //! Can be overridden by sub-class to read triangulation into application-specific data structures instead of Poly_Triangulation.
61 //! Default implementation creates RWGltf_TriangulationReader.
62 Standard_EXPORT virtual Handle(RWGltf_PrimitiveArrayReader) createMeshReaderContext();
63
64 //! Read late data from RWGltf_GltfLatePrimitiveArray stored as Poly_Triangulation within faces.
65 Standard_EXPORT virtual Standard_Boolean readLateData (NCollection_Vector<TopoDS_Face>& theFaces,
66 const TCollection_AsciiString& theFile,
7e785937 67 const Message_ProgressRange& theProgress);
0a419c51 68protected:
69
70 class CafReader_GltfReaderFunctor;
71
72protected:
73
803bdcdf 74 Standard_Boolean myToParallel; //!< flag to use multithreading; FALSE by default
75 Standard_Boolean myToSkipEmptyNodes; //!< ignore nodes without Geometry; TRUE by default
76 Standard_Boolean myUseMeshNameAsFallback; //!< flag to use Mesh name in case if Node name is empty, TRUE by default
0a419c51 77
78};
79
80#endif // _RWGltf_CafReader_HeaderFile