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 _RWObj_ObjWriterContext_HeaderFiler
0015 #define _RWObj_ObjWriterContext_HeaderFiler
0016
0017 #include <Graphic3d_Vec.hxx>
0018 #include <TCollection_AsciiString.hxx>
0019 #include <TColStd_IndexedDataMapOfStringString.hxx>
0020
0021
0022 class RWObj_ObjWriterContext
0023 {
0024 public:
0025
0026
0027 Standard_EXPORT RWObj_ObjWriterContext (const TCollection_AsciiString& theName);
0028
0029
0030 Standard_EXPORT ~RWObj_ObjWriterContext();
0031
0032
0033 bool IsOpened() const { return myFile != NULL; }
0034
0035
0036 Standard_EXPORT bool Close();
0037
0038
0039 bool HasNormals() const { return myHasNormals; }
0040
0041
0042 void SetNormals (const bool theHasNormals) { myHasNormals = theHasNormals; }
0043
0044
0045 bool HasTexCoords() const { return myHasTexCoords; }
0046
0047
0048 void SetTexCoords (const bool theHasTexCoords) { myHasTexCoords = theHasTexCoords; }
0049
0050
0051 Standard_EXPORT bool WriteHeader (const Standard_Integer theNbNodes,
0052 const Standard_Integer theNbElems,
0053 const TCollection_AsciiString& theMatLib,
0054 const TColStd_IndexedDataMapOfStringString& theFileInfo);
0055
0056
0057 const TCollection_AsciiString& ActiveMaterial() const { return myActiveMaterial; }
0058
0059
0060 Standard_EXPORT bool WriteActiveMaterial (const TCollection_AsciiString& theMaterial);
0061
0062
0063 Standard_EXPORT bool WriteTriangle (const Graphic3d_Vec3i& theTri);
0064
0065
0066 Standard_EXPORT bool WriteQuad (const Graphic3d_Vec4i& theQuad);
0067
0068
0069 Standard_EXPORT bool WriteVertex (const Graphic3d_Vec3& theValue);
0070
0071
0072 Standard_EXPORT bool WriteNormal (const Graphic3d_Vec3& theValue);
0073
0074
0075 Standard_EXPORT bool WriteTexCoord (const Graphic3d_Vec2& theValue);
0076
0077
0078 Standard_EXPORT bool WriteGroup (const TCollection_AsciiString& theValue);
0079
0080
0081 Standard_EXPORT void FlushFace (Standard_Integer theNbNodes);
0082
0083 public:
0084
0085 Standard_Integer NbFaces;
0086
0087 private:
0088
0089 FILE* myFile;
0090 TCollection_AsciiString myName;
0091 TCollection_AsciiString myActiveMaterial;
0092 Graphic3d_Vec4i myElemPosFirst;
0093 Graphic3d_Vec4i myElemNormFirst;
0094 Graphic3d_Vec4i myElemUVFirst;
0095 bool myHasNormals;
0096 bool myHasTexCoords;
0097
0098 };
0099
0100 #endif