File indexing completed on 2025-01-18 10:04:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _RWPly_PlyWriterContext_HeaderFiler
0015 #define _RWPly_PlyWriterContext_HeaderFiler
0016
0017 #include <Graphic3d_Vec.hxx>
0018 #include <gp_Pnt.hxx>
0019 #include <TCollection_AsciiString.hxx>
0020 #include <TColStd_IndexedDataMapOfStringString.hxx>
0021
0022 #include <memory>
0023
0024
0025 class RWPly_PlyWriterContext
0026 {
0027 public:
0028
0029
0030 Standard_EXPORT RWPly_PlyWriterContext();
0031
0032
0033 Standard_EXPORT ~RWPly_PlyWriterContext();
0034
0035 public:
0036
0037
0038 bool IsDoublePrecision() const { return myIsDoublePrec; }
0039
0040
0041 void SetDoublePrecision (bool theDoublePrec) { myIsDoublePrec = theDoublePrec; }
0042
0043
0044 bool HasNormals() const { return myHasNormals; }
0045
0046
0047 void SetNormals (const bool theHasNormals) { myHasNormals = theHasNormals; }
0048
0049
0050 bool HasTexCoords() const { return myHasTexCoords; }
0051
0052
0053 void SetTexCoords (const bool theHasTexCoords) { myHasTexCoords = theHasTexCoords; }
0054
0055
0056 bool HasColors() const { return myHasColors; }
0057
0058
0059 void SetColors (bool theToWrite) { myHasColors = theToWrite; }
0060
0061 public:
0062
0063
0064 bool HasSurfaceId() const { return myHasSurfId; }
0065
0066
0067 void SetSurfaceId (bool theSurfId) { myHasSurfId = theSurfId; }
0068
0069 public:
0070
0071
0072 bool IsOpened() const { return myStream.get() != nullptr; }
0073
0074
0075 Standard_EXPORT bool Open (const TCollection_AsciiString& theName,
0076 const std::shared_ptr<std::ostream>& theStream = std::shared_ptr<std::ostream>());
0077
0078
0079
0080
0081
0082 Standard_EXPORT bool WriteHeader (const Standard_Integer theNbNodes,
0083 const Standard_Integer theNbElems,
0084 const TColStd_IndexedDataMapOfStringString& theFileInfo);
0085
0086
0087
0088
0089
0090
0091 Standard_EXPORT bool WriteVertex (const gp_Pnt& thePoint,
0092 const Graphic3d_Vec3& theNorm,
0093 const Graphic3d_Vec2& theUV,
0094 const Graphic3d_Vec4ub& theColor);
0095
0096
0097 Standard_Integer NbWrittenVertices() const { return myNbVerts; }
0098
0099
0100 Standard_Integer VertexOffset() const { return myVertOffset; }
0101
0102
0103 void SetVertexOffset (Standard_Integer theOffset) { myVertOffset = theOffset; }
0104
0105
0106 Standard_Integer SurfaceId() const { return mySurfId; }
0107
0108
0109 void SetSurfaceId (Standard_Integer theSurfId) { mySurfId = theSurfId; }
0110
0111
0112 Standard_EXPORT bool WriteTriangle (const Graphic3d_Vec3i& theTri);
0113
0114
0115 Standard_EXPORT bool WriteQuad (const Graphic3d_Vec4i& theQuad);
0116
0117
0118 Standard_Integer NbWrittenElements() const { return myNbElems; }
0119
0120
0121
0122 Standard_EXPORT bool Close (bool theIsAborted = false);
0123
0124 private:
0125
0126 std::shared_ptr<std::ostream> myStream;
0127 TCollection_AsciiString myName;
0128 Standard_Integer myNbHeaderVerts;
0129 Standard_Integer myNbHeaderElems;
0130 Standard_Integer myNbVerts;
0131 Standard_Integer myNbElems;
0132 Standard_Integer mySurfId;
0133 Standard_Integer myVertOffset;
0134 bool myIsDoublePrec;
0135 bool myHasNormals;
0136 bool myHasColors;
0137 bool myHasTexCoords;
0138 bool myHasSurfId;
0139
0140 };
0141
0142 #endif