0031618: Data Exchange, RWGltf_CafWriter - exporting some models produces glTF files...
[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
18#include <NCollection_Vector.hxx>
19#include <RWMesh_CafReader.hxx>
20#include <TopoDS_Face.hxx>
21
22class RWGltf_PrimitiveArrayReader;
23
24//! The glTF (GL Transmission Format) mesh reader into XDE document.
25class RWGltf_CafReader : public RWMesh_CafReader
26{
27 DEFINE_STANDARD_RTTIEXT(RWGltf_CafReader, RWMesh_CafReader)
28public:
29
30 //! Empty constructor.
31 Standard_EXPORT RWGltf_CafReader();
32
33 //! Return TRUE if multithreaded optimizations are allowed; FALSE by default.
34 bool ToParallel() const { return myToParallel; }
35
36 //! Setup multithreaded execution.
37 void SetParallel (bool theToParallel) { myToParallel = theToParallel; }
38
803bdcdf 39 //! Return TRUE if Nodes without Geometry should be ignored, TRUE by default.
40 bool ToSkipEmptyNodes() { return myToSkipEmptyNodes; }
41
42 //! Set flag to ignore nodes without Geometry.
43 void SetSkipEmptyNodes (bool theToSkip) { myToSkipEmptyNodes = theToSkip; }
44
45 //! Set flag to use Mesh name in case if Node name is empty, TRUE by default.
46 bool ToUseMeshNameAsFallback() { return myUseMeshNameAsFallback; }
47
48 //! Set flag to use Mesh name in case if Node name is empty.
49 void SetMeshNameAsFallback (bool theToFallback) { myUseMeshNameAsFallback = theToFallback; }
50
0a419c51 51protected:
52
53 //! Read the mesh from specified file.
54 Standard_EXPORT virtual Standard_Boolean performMesh (const TCollection_AsciiString& theFile,
55 const Handle(Message_ProgressIndicator)& theProgress,
56 const Standard_Boolean theToProbe) Standard_OVERRIDE;
57
58 //! Create primitive array reader context.
59 //! Can be overridden by sub-class to read triangulation into application-specific data structures instead of Poly_Triangulation.
60 //! Default implementation creates RWGltf_TriangulationReader.
61 Standard_EXPORT virtual Handle(RWGltf_PrimitiveArrayReader) createMeshReaderContext();
62
63 //! Read late data from RWGltf_GltfLatePrimitiveArray stored as Poly_Triangulation within faces.
64 Standard_EXPORT virtual Standard_Boolean readLateData (NCollection_Vector<TopoDS_Face>& theFaces,
65 const TCollection_AsciiString& theFile,
66 const Handle(Message_ProgressIndicator)& theProgress);
67protected:
68
69 class CafReader_GltfReaderFunctor;
70
71protected:
72
803bdcdf 73 Standard_Boolean myToParallel; //!< flag to use multithreading; FALSE by default
74 Standard_Boolean myToSkipEmptyNodes; //!< ignore nodes without Geometry; TRUE by default
75 Standard_Boolean myUseMeshNameAsFallback; //!< flag to use Mesh name in case if Node name is empty, TRUE by default
0a419c51 76
77};
78
79#endif // _RWGltf_CafReader_HeaderFile