Warning, file /include/opencascade/RWPly_PlyWriterContext.hxx was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 <NCollection_Vec2.hxx>
0018
0019 #include <Standard_TypeDef.hxx>
0020
0021 #include <NCollection_Vec3.hxx>
0022
0023 #include <NCollection_Vec4.hxx>
0024
0025 #include <NCollection_Mat4.hxx>
0026 #include <gp_Pnt.hxx>
0027 #include <TCollection_AsciiString.hxx>
0028 #include <NCollection_IndexedDataMap.hxx>
0029
0030 #include <memory>
0031
0032
0033 class RWPly_PlyWriterContext
0034 {
0035 public:
0036
0037 Standard_EXPORT RWPly_PlyWriterContext();
0038
0039
0040 Standard_EXPORT ~RWPly_PlyWriterContext();
0041
0042 public:
0043
0044
0045 bool IsDoublePrecision() const { return myIsDoublePrec; }
0046
0047
0048 void SetDoublePrecision(bool theDoublePrec) { myIsDoublePrec = theDoublePrec; }
0049
0050
0051 bool HasNormals() const { return myHasNormals; }
0052
0053
0054 void SetNormals(const bool theHasNormals) { myHasNormals = theHasNormals; }
0055
0056
0057
0058 bool HasTexCoords() const { return myHasTexCoords; }
0059
0060
0061 void SetTexCoords(const bool theHasTexCoords) { myHasTexCoords = theHasTexCoords; }
0062
0063
0064 bool HasColors() const { return myHasColors; }
0065
0066
0067 void SetColors(bool theToWrite) { myHasColors = theToWrite; }
0068
0069 public:
0070
0071 bool HasSurfaceId() const { return myHasSurfId; }
0072
0073
0074 void SetSurfaceId(bool theSurfId) { myHasSurfId = theSurfId; }
0075
0076 public:
0077
0078 bool IsOpened() const { return myStream.get() != nullptr; }
0079
0080
0081 Standard_EXPORT bool Open(
0082 const TCollection_AsciiString& theName,
0083 const std::shared_ptr<std::ostream>& theStream = std::shared_ptr<std::ostream>());
0084
0085
0086
0087
0088
0089 Standard_EXPORT bool WriteHeader(
0090 const int theNbNodes,
0091 const int theNbElems,
0092 const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>&
0093 theFileInfo);
0094
0095
0096
0097
0098
0099
0100 Standard_EXPORT bool WriteVertex(const gp_Pnt& thePoint,
0101 const NCollection_Vec3<float>& theNorm,
0102 const NCollection_Vec2<float>& theUV,
0103 const NCollection_Vec4<uint8_t>& theColor);
0104
0105
0106 int NbWrittenVertices() const { return myNbVerts; }
0107
0108
0109 int VertexOffset() const { return myVertOffset; }
0110
0111
0112 void SetVertexOffset(int theOffset) { myVertOffset = theOffset; }
0113
0114
0115 int SurfaceId() const { return mySurfId; }
0116
0117
0118 void SetSurfaceId(int theSurfId) { mySurfId = theSurfId; }
0119
0120
0121 Standard_EXPORT bool WriteTriangle(const NCollection_Vec3<int>& theTri);
0122
0123
0124 Standard_EXPORT bool WriteQuad(const NCollection_Vec4<int>& theQuad);
0125
0126
0127 int NbWrittenElements() const { return myNbElems; }
0128
0129
0130
0131 Standard_EXPORT bool Close(bool theIsAborted = false);
0132
0133 private:
0134 std::shared_ptr<std::ostream> myStream;
0135 TCollection_AsciiString myName;
0136 int myNbHeaderVerts;
0137 int myNbHeaderElems;
0138 int myNbVerts;
0139 int myNbElems;
0140 int mySurfId;
0141 int myVertOffset;
0142 bool myIsDoublePrec;
0143 bool myHasNormals;
0144 bool myHasColors;
0145 bool myHasTexCoords;
0146 bool myHasSurfId;
0147 };
0148
0149 #endif