Open CASCADE Technology 7.9.0
|
RWObj_Reader implementation dumping OBJ file into Poly_Triangulation. More...
#include <RWObj_TriangulationReader.hxx>
Public Member Functions | |
RWObj_TriangulationReader () | |
Constructor. | |
void | SetCreateShapes (Standard_Boolean theToCreateShapes) |
Set flag to create shapes. | |
void | SetShapeReceiver (RWObj_IShapeReceiver *theReceiver) |
Set shape receiver callback. | |
virtual Handle< Poly_Triangulation > | GetTriangulation () |
Create Poly_Triangulation from collected data. | |
TopoDS_Shape | ResultShape () |
Return result shape. | |
![]() | |
RWObj_Reader () | |
Empty constructor. | |
Standard_Boolean | Read (const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress) |
Open stream and pass it to Read method Returns true if success, false on error. | |
Standard_Boolean | Read (std::istream &theStream, const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress) |
Reads data from OBJ file. Unicode paths can be given in UTF-8 encoding. Returns true if success, false on error or user break. | |
Standard_Boolean | Probe (const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress) |
Open stream and pass it to Probe method. | |
Standard_Boolean | Probe (std::istream &theStream, const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress) |
Probe data from OBJ file (comments, external references) without actually reading mesh data. Although mesh data will not be collected, the full file content will be parsed, due to OBJ format limitations. | |
const TCollection_AsciiString & | FileComments () const |
Returns file comments (lines starting with # at the beginning of file). | |
const NCollection_IndexedMap< TCollection_AsciiString > & | ExternalFiles () const |
Return the list of external file references. | |
Standard_Integer | NbProbeNodes () const |
Number of probed nodes. | |
Standard_Integer | NbProbeElems () const |
Standard_Size | MemoryLimit () const |
Returns memory limit in bytes; -1 (no limit) by default. | |
void | SetMemoryLimit (Standard_Size theMemLimit) |
Specify memory limit in bytes, so that import will be aborted by specified limit before memory allocation error occurs. | |
const RWMesh_CoordinateSystemConverter & | Transformation () const |
Return transformation from one coordinate system to another; no transformation by default. | |
void | SetTransformation (const RWMesh_CoordinateSystemConverter &theCSConverter) |
Setup transformation from one coordinate system to another. OBJ file might be exported following various coordinate system conventions, so that it might be useful automatically transform data during file reading. | |
Standard_Boolean | IsSinglePrecision () const |
Return single precision flag for reading vertex data (coordinates); FALSE by default. | |
void | SetSinglePrecision (Standard_Boolean theIsSinglePrecision) |
Setup single/double precision flag for reading vertex data (coordinates). | |
![]() | |
Standard_Transient () | |
Empty constructor. | |
Standard_Transient (const Standard_Transient &) | |
Copy constructor – does nothing. | |
Standard_Transient & | operator= (const Standard_Transient &) |
Assignment operator, needed to avoid copying reference counter. | |
virtual | ~Standard_Transient () |
Destructor must be virtual. | |
virtual const opencascade::handle< Standard_Type > & | DynamicType () const |
Returns a type descriptor about this object. | |
Standard_Boolean | IsInstance (const opencascade::handle< Standard_Type > &theType) const |
Returns a true value if this is an instance of Type. | |
Standard_Boolean | IsInstance (const Standard_CString theTypeName) const |
Returns a true value if this is an instance of TypeName. | |
Standard_Boolean | IsKind (const opencascade::handle< Standard_Type > &theType) const |
Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. | |
Standard_Boolean | IsKind (const Standard_CString theTypeName) const |
Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. | |
Standard_Transient * | This () const |
Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. | |
Standard_Integer | GetRefCount () const noexcept |
Get the reference counter of this object. | |
void | IncrementRefCounter () noexcept |
Increments the reference counter of this object. | |
Standard_Integer | DecrementRefCounter () noexcept |
Decrements the reference counter of this object; returns the decremented value. | |
virtual void | Delete () const |
Memory deallocator for transient classes. | |
Protected Member Functions | |
virtual Standard_Boolean | addMesh (const RWObj_SubMesh &theMesh, const RWObj_SubMeshReason theReason) override |
Flush active sub-mesh. | |
virtual gp_Pnt | getNode (Standard_Integer theIndex) const override |
Retrieve sub-mesh node position. | |
virtual Standard_Integer | addNode (const gp_Pnt &thePnt) override |
Add new node. | |
virtual void | setNodeNormal (const Standard_Integer theIndex, const Graphic3d_Vec3 &theNormal) override |
Ignore normal. | |
virtual void | setNodeUV (const Standard_Integer theIndex, const Graphic3d_Vec2 &theUV) override |
Ignore texture coordinates. | |
virtual void | addElement (Standard_Integer theN1, Standard_Integer theN2, Standard_Integer theN3, Standard_Integer theN4) override |
Add element. | |
Standard_Boolean | addSubShape (TopoDS_Shape &theParent, const TopoDS_Shape &theSubShape, const Standard_Boolean theToExpandCompound) |
Add sub-shape into specified shape. | |
![]() | |
Standard_Boolean | read (std::istream &theStream, const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress, const Standard_Boolean theToProbe) |
Reads data from OBJ file. Unicode paths can be given in UTF-8 encoding. Returns true if success, false on error or user break. | |
Protected Attributes | |
NCollection_Vector< gp_Pnt > | myNodes |
nodes of currently filled triangulation | |
NCollection_Vector< Graphic3d_Vec3 > | myNormals |
normals of currently filled triangulation | |
NCollection_Vector< Graphic3d_Vec2 > | myNodesUV |
UVs of currently filled triangulation. | |
NCollection_Vector< Poly_Triangle > | myTriangles |
indexes of currently filled triangulation | |
RWObj_IShapeReceiver * | myShapeReceiver |
optional shape receiver | |
TopoDS_Compound | myResultShape |
result shape as Compound of objects | |
TopoDS_Compound | myLastObjectShape |
Compound containing current object groups. | |
TopoDS_Shape | myLastGroupShape |
current group shape - either a single Face or Compound of Faces | |
TCollection_AsciiString | myLastGroupName |
current group name | |
TCollection_AsciiString | myLastFaceMaterial |
last face material name | |
Standard_Boolean | myToCreateShapes |
create a single triangulation | |
NCollection_IndexedMap< TCollection_AsciiString > | myExternalFiles |
list of external file references | |
TCollection_AsciiString | myFileComments |
file header comments | |
TCollection_AsciiString | myFolder |
folder containing the OBJ file | |
RWMesh_CoordinateSystemConverter | myCSTrsf |
coordinate system flipper | |
Standard_Size | myMemLimitBytes |
memory limit in bytes | |
Standard_Size | myMemEstim |
estimated memory occupation in bytes | |
Standard_Integer | myNbLines |
number of parsed lines (e.g. current line) | |
Standard_Integer | myNbProbeNodes |
number of probed nodes | |
Standard_Integer | myNbProbeElems |
number of probed elements | |
Standard_Integer | myNbElemsBig |
number of big elements (polygons with 5+ nodes) | |
Standard_Boolean | myToAbort |
flag indicating abort state (e.g. syntax error) | |
VectorOfVertices | myObjVerts |
temporary vector of vertices | |
NCollection_Vector< Graphic3d_Vec2 > | myObjVertsUV |
temporary vector of UV parameters | |
NCollection_Vector< Graphic3d_Vec3 > | myObjNorms |
temporary vector of normals | |
NCollection_DataMap< Graphic3d_Vec3i, Standard_Integer, ObjVec3iHasher > | myPackedIndices |
list of external file references | |
NCollection_DataMap< TCollection_AsciiString, RWObj_Material > | myMaterials |
map of known materials | |
RWObj_SubMesh | myActiveSubMesh |
active sub-mesh definition | |
std::vector< Standard_Integer > | myCurrElem |
indices for the current element | |
Additional Inherited Members | |
typedef void | base_type |
Returns a type descriptor about this object. | |
static constexpr const char * | get_type_name () |
Returns a type descriptor about this object. | |
static const opencascade::handle< Standard_Type > & | get_type_descriptor () |
Returns type descriptor of Standard_Transient class. | |
RWObj_Reader implementation dumping OBJ file into Poly_Triangulation.
|
inline |
Constructor.
|
inlineoverrideprotectedvirtual |
Add element.
Implements RWObj_Reader.
|
overrideprotectedvirtual |
Flush active sub-mesh.
Implements RWObj_Reader.
|
inlineoverrideprotectedvirtual |
Add new node.
Implements RWObj_Reader.
|
protected |
Add sub-shape into specified shape.
|
inlineoverrideprotectedvirtual |
Retrieve sub-mesh node position.
Implements RWObj_Reader.
|
virtual |
Create Poly_Triangulation from collected data.
TopoDS_Shape RWObj_TriangulationReader::ResultShape | ( | ) |
Return result shape.
|
inline |
Set flag to create shapes.
|
inlineoverrideprotectedvirtual |
Ignore normal.
Implements RWObj_Reader.
|
inlineoverrideprotectedvirtual |
Ignore texture coordinates.
Implements RWObj_Reader.
|
inline |
Set shape receiver callback.
|
protected |
last face material name
|
protected |
current group name
|
protected |
current group shape - either a single Face or Compound of Faces
|
protected |
Compound containing current object groups.
|
protected |
nodes of currently filled triangulation
|
protected |
UVs of currently filled triangulation.
|
protected |
normals of currently filled triangulation
|
protected |
result shape as Compound of objects
|
protected |
optional shape receiver
|
protected |
create a single triangulation
|
protected |
indexes of currently filled triangulation