1 // Author: Kirill Gavrilov
2 // Copyright (c) 2016-2019 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _RWGltf_CafReader_HeaderFile
16 #define _RWGltf_CafReader_HeaderFile
18 #include <NCollection_Vector.hxx>
19 #include <RWMesh_CafReader.hxx>
20 #include <TopoDS_Face.hxx>
22 class RWGltf_PrimitiveArrayReader;
24 //! The glTF (GL Transmission Format) mesh reader into XDE document.
25 class RWGltf_CafReader : public RWMesh_CafReader
27 DEFINE_STANDARD_RTTIEXT(RWGltf_CafReader, RWMesh_CafReader)
30 //! Empty constructor.
31 Standard_EXPORT RWGltf_CafReader();
33 //! Return TRUE if multithreaded optimizations are allowed; FALSE by default.
34 bool ToParallel() const { return myToParallel; }
36 //! Setup multithreaded execution.
37 void SetParallel (bool theToParallel) { myToParallel = theToParallel; }
41 //! Read the mesh from specified file.
42 Standard_EXPORT virtual Standard_Boolean performMesh (const TCollection_AsciiString& theFile,
43 const Handle(Message_ProgressIndicator)& theProgress,
44 const Standard_Boolean theToProbe) Standard_OVERRIDE;
46 //! Create primitive array reader context.
47 //! Can be overridden by sub-class to read triangulation into application-specific data structures instead of Poly_Triangulation.
48 //! Default implementation creates RWGltf_TriangulationReader.
49 Standard_EXPORT virtual Handle(RWGltf_PrimitiveArrayReader) createMeshReaderContext();
51 //! Read late data from RWGltf_GltfLatePrimitiveArray stored as Poly_Triangulation within faces.
52 Standard_EXPORT virtual Standard_Boolean readLateData (NCollection_Vector<TopoDS_Face>& theFaces,
53 const TCollection_AsciiString& theFile,
54 const Handle(Message_ProgressIndicator)& theProgress);
57 class CafReader_GltfReaderFunctor;
61 Standard_Boolean myToParallel; //!< flag to use multithreading; FALSE by default
65 #endif // _RWGltf_CafReader_HeaderFile