Executable block handling io of 3D surface polygonal mesh in *.obj format. More...

#include <IOWavefrontOBJ.hpp>

Inheritance diagram for mimmo::IOWavefrontOBJ:
Collaboration diagram for mimmo::IOWavefrontOBJ:

Public Types

enum  IOMode { IOMode::READ = 0, IOMode::RESTORE = 1, IOMode::WRITE = 2, IOMode::DUMP = 3 }
 Working mode for class IOWavefrontOBJ. More...
 
typedef std::map< long, std::map< long, std::vector< long > > > TreeGroups
 
- Public Types inherited from mimmo::BaseManipulation
typedef std::unordered_map< BaseManipulation *, int > bmumap
 
typedef pin::ConnectionType ConnectionType
 
typedef std::string PortID
 

Public Member Functions

 IOWavefrontOBJ (const bitpit::Config::Section &rootXML)
 
 IOWavefrontOBJ (IOMode mode=IOMode::READ)
 
virtual ~IOWavefrontOBJ ()
 
virtual void absorbSectionXML (const bitpit::Config::Section &slotXML, std::string name="")
 
void execute ()
 
virtual void flushSectionXML (bitpit::Config::Section &slotXML, std::string name="")
 
MimmoPiercedVector< std::string > * getCellGroups ()
 
WavefrontOBJDatagetData ()
 
std::string getMaterialFile ()
 
MimmoPiercedVector< std::string > * getMaterials ()
 
MimmoSharedPointer< MimmoObjectgetNormals ()
 
MimmoPiercedVector< long > * getSmoothIds ()
 
std::unordered_map< long, std::string > getSubParts ()
 
MimmoSharedPointer< MimmoObjectgetTextures ()
 
void printResumeFile (bool print)
 
void setCleanDoubleMeshVertices (bool clean)
 
void setData (WavefrontOBJData *data)
 
void setDir (const std::string &pathdir)
 
void setFilename (const std::string &name)
 
void setGeometry (MimmoSharedPointer< MimmoObject > geo)
 
void setGeometryTolerance (double tolerance)
 
void setIgnoreCellGroups (bool ignore)
 
void setTextureUVMode (bool UVmode)
 
IOMode whichMode ()
 
int whichModeInt ()
 
- Public Member Functions inherited from mimmo::BaseManipulation
 BaseManipulation ()
 
 BaseManipulation (const BaseManipulation &other)
 
virtual ~BaseManipulation ()
 
void activate ()
 
bool arePortsBuilt ()
 
void clear ()
 
void disable ()
 
void exec ()
 
BaseManipulationgetChild (int i=0)
 
ConnectionType getConnectionType ()
 
MimmoSharedPointer< MimmoObjectgetGeometry ()
 
MimmoSharedPointer< MimmoObject > & getGeometryReference ()
 
int getId ()
 
bitpit::Logger & getLog ()
 
std::string getName ()
 
int getNChild ()
 
int getNParent ()
 
int getNPortsIn ()
 
int getNPortsOut ()
 
BaseManipulationgetParent (int i=0)
 
std::unordered_map< PortID, PortIn * > getPortsIn ()
 
std::unordered_map< PortID, PortOut * > getPortsOut ()
 
uint getPriority ()
 
virtual std::vector< BaseManipulation * > getSubBlocksEmbedded ()
 
bool isActive ()
 
bool isApply ()
 
bool isChild (BaseManipulation *, int &)
 
bool isParent (BaseManipulation *, int &)
 
bool isPlotInExecution ()
 
BaseManipulationoperator= (const BaseManipulation &other)
 
void removePins ()
 
void removePinsIn ()
 
void removePinsOut ()
 
void setApply (bool flag=true)
 
void setGeometry (MimmoSharedPointer< MimmoObject > geometry)
 
void setId (int)
 
void setLog (bitpit::Logger &log)
 
void setName (std::string name)
 
void setOutputPlot (std::string path)
 
void setPlotInExecution (bool)
 
void setPriority (uint priority)
 
void unsetGeometry ()
 

Protected Member Functions

void buildPorts ()
 
void dump (std::ostream &)
 
void read (const std::string &fullpath)
 
void readObjectData (std::ifstream &in, const std::streampos &begObjectStream, const long &PID, const std::string &defaultGroup, const std::array< long, 3 > &vCounter, long &vOffset, long &vnOffset, long &vTxtOffset, long &cOffset)
 
TreeGroups regroupCells (const WavefrontOBJData *objData, const livector1D &cellList)
 
void restore (std::istream &)
 
std::string searchMaterialFile (std::ifstream &in)
 
void searchObjectPosition (std::ifstream &in, std::vector< std::streampos > &mapPos, std::vector< std::string > &mapNames, std::vector< std::array< long, 3 >> &mapVCountObject, std::array< long, 3 > &mapVCountTotal, long &nCellTot)
 
void swap (IOWavefrontOBJ &x) noexcept
 
void write (const std::string &fullpath)
 
void writeObjectData (WavefrontOBJData *objData, std::ofstream &out, const std::array< std::vector< long >, 3 > &vertexLists, const std::vector< long > &cellList, std::array< long, 3 > &vOffsets, std::array< std::unordered_map< long, long >, 3 > &vinsertion_maps, const std::string &defaultGroup, long &activeGroup, long &activeMaterial, long &activeSmoothId)
 
void writeResumeFile ()
 
- Protected Member Functions inherited from mimmo::BaseManipulation
void _apply (MimmoPiercedVector< darray3E > &displacements)
 
void addChild (BaseManipulation *child)
 
void addParent (BaseManipulation *parent)
 
void addPinIn (BaseManipulation *objIn, PortID portR)
 
void addPinOut (BaseManipulation *objOut, PortID portS, PortID portR)
 
virtual void apply ()
 
void cleanBufferIn (PortID port)
 
template<typename T , typename O >
bool createPortIn (O *obj, void(O::*setVar_)(T), PortID portR, bool mandatory=false, int family=0)
 
template<typename T , typename O >
bool createPortIn (T *var_, PortID portR, bool mandatory=false, int family=0)
 
template<typename T , typename O >
bool createPortOut (O *obj, T(O::*getVar_)(), PortID portS)
 
template<typename T , typename O >
bool createPortOut (T *var_, PortID portS)
 
void deletePorts ()
 
PortID findPinIn (PortIn &pin)
 
PortID findPinOut (PortOut &pin)
 
void initializeLogger (bool logexists)
 
virtual void plotOptionalResults ()
 
void readBufferIn (PortID port)
 
void removePinIn (BaseManipulation *objIn, PortID portR)
 
void removePinIn (PortID portR, int j)
 
void removePinOut (BaseManipulation *objOut, PortID portS)
 
void removePinOut (PortID portS, int j)
 
void setBufferIn (PortID port, mimmo::IBinaryStream &input)
 
void swap (BaseManipulation &x) noexcept
 
void unsetChild (BaseManipulation *child)
 
void unsetParent (BaseManipulation *parent)
 
void write (MimmoSharedPointer< MimmoObject > geometry)
 
template<typename mpv_t >
void write (MimmoSharedPointer< MimmoObject > geometry, MimmoPiercedVector< mpv_t > &data)
 
template<typename mpv_t , typename... Args>
void write (MimmoSharedPointer< MimmoObject > geometry, MimmoPiercedVector< mpv_t > &data, Args ... args)
 
template<typename mpv_t >
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t > * > &data)
 
template<typename mpv_t , typename... Args>
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t > * > &data, Args ... args)
 
template<typename mpv_t >
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t >> &data)
 
template<typename mpv_t , typename... Args>
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t >> &data, Args ... args)
 

Additional Inherited Members

- Protected Attributes inherited from mimmo::BaseManipulation
bool m_active
 
bool m_apply
 
bool m_arePortsBuilt
 
bmumap m_child
 
int m_counter
 
bool m_execPlot
 
MimmoSharedPointer< MimmoObjectm_geometry
 
bitpit::Logger * m_log
 
std::string m_name
 
std::string m_outputPlot
 
bmumap m_parent
 
std::unordered_map< PortID, PortIn * > m_portIn
 
std::unordered_map< PortID, PortOut * > m_portOut
 
ConnectionType m_portsType
 
uint m_priority
 
- Static Protected Attributes inherited from mimmo::BaseManipulation
static int sm_baseManipulationCounter
 

Detailed Description

Executable block handling io of 3D surface polygonal mesh in *.obj format.

IOWavefrontOBJ manages reading/writing of surface mesh from/to WaveFront ASCII obj format to/from a MimmoObject surface mesh container (type=1). More information at https://en.wikipedia.org/wiki/Wavefront_.obj_file The class does not cover all the features supported by the format, but is restricted to description of 3D surface tessellated meshes. Points and Lines cell elements are not supported in the current class.

Materials file *.mtl attached to the inner *.obj file is not needed by the current class.

Thus, the obj file must have:

  • Polygonal geometry statement only, No free form statement features (NURBS-CAD) are supported.
  • Polygonal cells (only facets, no lines or vertex cells)

Mesh Object sub-parts are absorbed/flushed through PID/PIDNames mechanism of MimmoObject surface mesh cells. The class identifies as parts only sub-objects defined with o key entry (grouping with g key entry is ignored.)

Mesh accessory data are stored in a WaveFrontObjData class, containing:

  • Textures and Normals properties (if any) are managed in independent MimmoObjects (their node coordinates list and their own connectivities).The link is that cell-ids are the same in all 3 objects (reference mesh, textures and normals).
    • Materials assigned on cells, smoothing group ids and cellgroups id are managed as special fields attached to the MimmoObject mesh cells-ids.

WARNING 1: for reading/writing of v,vt,vn data chunks, the class supposes that the three of them are organized in the file in blocks of consecutive entries, i.e. after 'o' sub-object declaration all the v's of the object are written, then the vt's if any, and finally the vn's if any. This may be not true for the general Wavefront format(in which declarations can be random and not organized at all), but meet quite well with the practice of well known OBJ file exporter like the Blender's one.

WARNING 2: During OBJ writing if empty cellgroup entry is encountered, it will be assigned the object name (o) by default.


Ports available in IOWaveFrontOBJ Class :


Port Input
PortType variable/function DataType
M_GEOM setGeometry (MC_SCALAR, MD_MIMMO_)
M_WAVEFRONTDATA setData (MC_SCALAR, MD_WOBJDATA_)
Port Output
PortType variable/function DataType
M_GEOM getGeometry (MC_SCALAR,MD_MIMMO_)
M_WAVEFRONTDATA getData (MC_SCALAR, MD_WOBJDATA_)
M_STRINGFIELD getMaterials (MC_SCALAR, MD_MPVECSTRING_)
M_STRINGFIELD2 getCellGroups (MC_SCALAR, MD_MPVECSTRING_)
M_LONGFIELD getSmoothIds (MC_SCALAR, MD_MPVECLONG_)
M_GEOM2 getTextures (MC_SCALAR,MD_MIMMO_)
M_GEOM3 getNormals (MC_SCALAR,MD_MIMMO_)
M_NAME getMaterialFile (MC_SCALAR, MD_STRING)


The xml available parameters, sections and subsections are the following :

Inherited from BaseManipulation:

  • ClassName: name of the class as mimmo.IOWavefrontOBJ;
  • Priority: uint marking priority in multi-chain execution;

Proper of the class:

  • IOMode: 0-read from obj file, 1-restore from class dump file, 2- write to obj file, 3-write class dump file.
  • Dir directory path to read from/write to
  • Filename name of the file to be read/written (without tag .obj)
  • GeomTolerance (float) geometric tolerance for repeated mesh vertices.
  • CleanDoubleMeshVertices: for READ Mode only, boolean 0/1 if 1, force mesh vertices collapsing after reading with GeomTolerance.
  • IgnoreCellGroups: for READ Mode only, boolean 0/1 if 1, ignore cellgroups labeling of the OBJ mesh.
  • TextureUVMode: for WRITE Mode only, boolean 0/1 if 1, force writing textures with first 2 components only.
  • PrintResumeFile: 0/1 print a resume file of the mesh contents after execution.

Geometry and additional fields have to be mandatorily passed through ports.

Examples
genericinput_example_00005.cpp.

Definition at line 336 of file IOWavefrontOBJ.hpp.

Member Typedef Documentation

◆ TreeGroups

typedef std::map<long,std::map<long, std::vector<long> > > mimmo::IOWavefrontOBJ::TreeGroups

custom typedef for IOWavefrontOBJ class

Definition at line 339 of file IOWavefrontOBJ.hpp.

Constructor & Destructor Documentation

◆ IOWavefrontOBJ() [1/2]

mimmo::IOWavefrontOBJ::IOWavefrontOBJ ( IOWavefrontOBJ::IOMode  mode = IOMode::READ)

Constructor

Parameters
[in]modeworking mode of the class - see IOWavefrontOBJ::IOMode enum

Definition at line 1138 of file IOWavefrontOBJ.cpp.

◆ ~IOWavefrontOBJ()

mimmo::IOWavefrontOBJ::~IOWavefrontOBJ ( )
virtual

Destructor

Definition at line 1190 of file IOWavefrontOBJ.cpp.

◆ IOWavefrontOBJ() [2/2]

mimmo::IOWavefrontOBJ::IOWavefrontOBJ ( const bitpit::Config::Section &  rootXML)

Custom constructor reading xml data

Parameters
[in]rootXMLreference to your xml tree section

Definition at line 1155 of file IOWavefrontOBJ.cpp.

Member Function Documentation

◆ absorbSectionXML()

void mimmo::IOWavefrontOBJ::absorbSectionXML ( const bitpit::Config::Section &  slotXML,
std::string  name = "" 
)
virtual

Absorb class parameters from a section xml

Parameters
[in]slotXMLxml section
[in]nameunused string

Reimplemented from mimmo::BaseManipulation.

Definition at line 1445 of file IOWavefrontOBJ.cpp.

◆ buildPorts()

void mimmo::IOWavefrontOBJ::buildPorts ( )
protectedvirtual

Building class ports

Implements mimmo::BaseManipulation.

Definition at line 1215 of file IOWavefrontOBJ.cpp.

◆ dump()

void mimmo::IOWavefrontOBJ::dump ( std::ostream &  out)
protected

write mesh and data attached to class own dump file

Definition at line 1999 of file IOWavefrontOBJ.cpp.

◆ execute()

void mimmo::IOWavefrontOBJ::execute ( )
virtual

Class workflow execution

Implements mimmo::BaseManipulation.

Definition at line 1547 of file IOWavefrontOBJ.cpp.

◆ flushSectionXML()

void mimmo::IOWavefrontOBJ::flushSectionXML ( bitpit::Config::Section &  slotXML,
std::string  name = "" 
)
virtual

Flush class parameters to a section xml

Parameters
[in]slotXMLxml section to be filled
[in]nameunused string

Reimplemented from mimmo::BaseManipulation.

Definition at line 1528 of file IOWavefrontOBJ.cpp.

◆ getCellGroups()

MimmoPiercedVector< std::string > * mimmo::IOWavefrontOBJ::getCellGroups ( )

Return pointer to WavefrontOBJData cellgroups attached to polygonal mesh. Data are referred always to cell.

Returns
cellgroups data attached to the mesh

Definition at line 1307 of file IOWavefrontOBJ.cpp.

◆ getData()

WavefrontOBJData * mimmo::IOWavefrontOBJ::getData ( )

Return pointer to WavefrontOBJData (materials, smoothids, textures and normals, etc...) attached to polygonal mesh. Data are referred to cell (materials, smoothids ...) or points(texture, normals, ...).

Returns
data attached to the mesh

Definition at line 1262 of file IOWavefrontOBJ.cpp.

◆ getMaterialFile()

std::string mimmo::IOWavefrontOBJ::getMaterialFile ( )

Return string with filename with materials lib.

Returns
texture data

Definition at line 1285 of file IOWavefrontOBJ.cpp.

◆ getMaterials()

MimmoPiercedVector< std::string > * mimmo::IOWavefrontOBJ::getMaterials ( )

Return pointer to WavefrontOBJData materials attached to polygonal mesh. Data are referred always to cell.

Returns
materials data attached to the mesh

Definition at line 1296 of file IOWavefrontOBJ.cpp.

◆ getNormals()

MimmoSharedPointer< MimmoObject > mimmo::IOWavefrontOBJ::getNormals ( )

Return normals object

Returns
normals data

Definition at line 1342 of file IOWavefrontOBJ.cpp.

◆ getSmoothIds()

MimmoPiercedVector< long > * mimmo::IOWavefrontOBJ::getSmoothIds ( )

Return pointer to WavefrontOBJData smoothids attached to polygonal mesh. Data are referred always to cell.

Returns
materials data attached to the mesh

Definition at line 1318 of file IOWavefrontOBJ.cpp.

◆ getSubParts()

std::unordered_map< long, std::string > mimmo::IOWavefrontOBJ::getSubParts ( )

Return the map with PID and name of the object which the mesh is subdivided in. In read/restore mode, this subdivision is extrapolated from file obj, in write/dump mode this refers to subdivision hold by the geometry set with setGeometry method.

Returns
pid/name mesh internal subdivision.

Definition at line 1275 of file IOWavefrontOBJ.cpp.

◆ getTextures()

MimmoSharedPointer< MimmoObject > mimmo::IOWavefrontOBJ::getTextures ( )

Return texture object

Returns
texture data

Definition at line 1329 of file IOWavefrontOBJ.cpp.

◆ printResumeFile()

void mimmo::IOWavefrontOBJ::printResumeFile ( bool  print)

If set to true print a resume file of the data referenced by the mesh.

Parameters
[in]printtrue/false
Examples
genericinput_example_00005.cpp.

Definition at line 1436 of file IOWavefrontOBJ.cpp.

◆ read()

void mimmo::IOWavefrontOBJ::read ( const std::string &  filename)
protected

Read mesh and data attached from file obj.

Definition at line 1601 of file IOWavefrontOBJ.cpp.

◆ readObjectData()

void mimmo::IOWavefrontOBJ::readObjectData ( std::ifstream &  in,
const std::streampos &  begObjectStream,
const long &  PID,
const std::string &  defaultGroup,
const std::array< long, 3 > &  vCounter,
long &  vOffset,
long &  vnOffset,
long &  vTxtOffset,
long &  cOffset 
)
protected

Get the stream to the begin of a Object section and start absorb its data, i.e.

  • v: vertices coordinates
  • vt: texture coordinates (if any)
  • vn: normals referred to vertices (if any)
  • f : facet connectivity
  • usemtl : all the cells after the keyword will be assigned to the material specified by mtllib file (if any)
  • g: all the cells after the keyword will be assigned to cell group specified by g (if any)
  • s: all the cells after the keyword will be assigned to smooth group specified by s (if any)
  • vp, vertex in free form statement, is ignored. A warning will be raised on logger.
  • l, line connectivity, is ignored. A warning will be raised on logger.
  • p, point connectivity, is ignored. A warning will be raised on logger.

all other keywords are ignored.

Data are directly stored in m_intPatch (for main mesh), m_intTexture(for texture) and m_intData(for attached WavefrontOBJData datatypes)

Parameters
[in]inreading stream
[in]begObjectStreamposition of the stream to start absorbing data
[in]PIDpart identifier assigned to the current object.
[in]defaultGrouptrack the name of the current object.
[in]vCounter3 element array carrying the number of v, vt and vn currently present in this sub-part.
[in,out]vOffseti/o current id of the next-to-be inserted mesh vertex.
[in,out]vnOffseti/o current id of the next-to-be inserted mesh vertex normal.
[in,out]vTxtOffseti/o current id of the next-to-be inserted texture vertex.
[in,out]cOffseti/o current id of the next-to-be inserted mesh cell (same for mesh and texture)

Definition at line 2223 of file IOWavefrontOBJ.cpp.

◆ regroupCells()

IOWavefrontOBJ::TreeGroups mimmo::IOWavefrontOBJ::regroupCells ( const WavefrontOBJData objData,
const livector1D cellList 
)
protected

Regroup a list of mesh cells by cellgroups-materials

Parameters
[in]objDatasource object data structure
[in]cellListlist of cell ids of the polygonal mesh
Returns
tree containing cell sublists reordered as [CellGroup][Material] -> sublist.

Definition at line 2606 of file IOWavefrontOBJ.cpp.

◆ restore()

void mimmo::IOWavefrontOBJ::restore ( std::istream &  in)
protected

Read mesh and data attached from class own dump file

Definition at line 1966 of file IOWavefrontOBJ.cpp.

◆ searchMaterialFile()

std::string mimmo::IOWavefrontOBJ::searchMaterialFile ( std::ifstream &  in)
protected

Search for material file name marked with entry key "mtllib". If none, return an empty string

Returns
materials file name

Definition at line 2097 of file IOWavefrontOBJ.cpp.

◆ searchObjectPosition()

void mimmo::IOWavefrontOBJ::searchObjectPosition ( std::ifstream &  in,
std::vector< std::streampos > &  mapPos,
std::vector< std::string > &  mapNames,
std::vector< std::array< long, 3 >> &  mapVCountObject,
std::array< long, 3 > &  mapVCountTotal,
long &  nCellTot 
)
protected

While reading, scan the obj file to get the number of subparts, their stream positions and names eventually. Restore the stream to file begin after searching.

Parameters
[in]inreading obj file stream
[in,out]mapPosmap pid/streampos to be filled
[in,out]mapNamesmap pid/names to be filled
[in,out]mapVCountObjectlist of 3elements array containing number of v, vt,and vn for each sub-part.
[out]mapVCountTotal3elements array containing total number of v, vt,and vn in the obj file
[out]nCellTottotal cells in the obj file

Definition at line 2131 of file IOWavefrontOBJ.cpp.

◆ setCleanDoubleMeshVertices()

void mimmo::IOWavefrontOBJ::setCleanDoubleMeshVertices ( bool  clean)

For READ mode only, if true force double mesh vertices collapsing inside geometric tolerance m_tol (setGeometryTolerance method). This collapsing will not affect wavefront obj data attached to the mesh. Do nothing if false.

Parameters
[in]cleantrue/false

Definition at line 1412 of file IOWavefrontOBJ.cpp.

◆ setData()

void mimmo::IOWavefrontOBJ::setData ( WavefrontOBJData data)

Set data attached to surface polygonal mesh, i.e:

  • materials associated to cells
  • cell group labels associated to cells
  • smoothing group ids associated to cells
  • texture and vnormals list if any
  • material file path. Meaningful only in write mode. Does nothing in read mode. Beware any other data are erased.
    Parameters
    [in]datapointer to a WavefrontObjData container.

Definition at line 1372 of file IOWavefrontOBJ.cpp.

◆ setDir()

void mimmo::IOWavefrontOBJ::setDir ( const std::string &  pathdir)

Set the directory where the read file is searched or the written file has to be placed.

Parameters
[in]pathdirpath to reference directory for I/O purposes
Examples
genericinput_example_00005.cpp.

Definition at line 1384 of file IOWavefrontOBJ.cpp.

◆ setFilename()

void mimmo::IOWavefrontOBJ::setFilename ( const std::string &  name)

Set the name of the file to be read or written. No format tag .obj has to be specified.

Parameters
[in]nameof the file
Examples
genericinput_example_00005.cpp.

Definition at line 1393 of file IOWavefrontOBJ.cpp.

◆ setGeometry()

void mimmo::IOWavefrontOBJ::setGeometry ( MimmoSharedPointer< MimmoObject geo)

Set the geometry meant to be written. Does nothing in read/restore mode.

Parameters
[in]geoMimmoObject surface mesh of type 1

Definition at line 1353 of file IOWavefrontOBJ.cpp.

◆ setGeometryTolerance()

void mimmo::IOWavefrontOBJ::setGeometryTolerance ( double  tolerance)

Set the geometric tolerance for duplicated vertices/vertex normals collapsing

Parameters
[in]tolerance

Definition at line 1401 of file IOWavefrontOBJ.cpp.

◆ setIgnoreCellGroups()

void mimmo::IOWavefrontOBJ::setIgnoreCellGroups ( bool  ignore)

For READ mode only, if true skip absorbing cellgroup g infromation of the OBJ mesh.

Parameters
[in]ignoretrue/false

Definition at line 1420 of file IOWavefrontOBJ.cpp.

◆ setTextureUVMode()

void mimmo::IOWavefrontOBJ::setTextureUVMode ( bool  UVmode)

For WRITE mode only, if any textures is available in wavefront optional data force writing textures with only the first two components U and V (ignoring optional W components.).

Parameters
[in]UVmodetrue/false to activate/deactivate texture UV mode.
Examples
genericinput_example_00005.cpp.

Definition at line 1428 of file IOWavefrontOBJ.cpp.

◆ swap()

void mimmo::IOWavefrontOBJ::swap ( IOWavefrontOBJ x)
protectednoexcept

Swap utility

Parameters
[in]xother object to swap from

Definition at line 1196 of file IOWavefrontOBJ.cpp.

◆ whichMode()

IOWavefrontOBJ::IOMode mimmo::IOWavefrontOBJ::whichMode ( )
Returns
working mode of the class, see IOWavefrontOBJ::IOMode enum.

Definition at line 1245 of file IOWavefrontOBJ.cpp.

◆ whichModeInt()

int mimmo::IOWavefrontOBJ::whichModeInt ( )
Returns
working mode of the class as integer, see IOWavefrontOBJ::IOMode enum.

Definition at line 1252 of file IOWavefrontOBJ.cpp.

◆ write()

void mimmo::IOWavefrontOBJ::write ( const std::string &  filename)
protected

Write mesh and data attached to file obj

Definition at line 1864 of file IOWavefrontOBJ.cpp.

◆ writeObjectData()

void mimmo::IOWavefrontOBJ::writeObjectData ( WavefrontOBJData objData,
std::ofstream &  out,
const std::array< std::vector< long >, 3 > &  vertexLists,
const std::vector< long > &  cellList,
std::array< long, 3 > &  vOffsets,
std::array< std::unordered_map< long, long >, 3 > &  vinsertion_maps,
const std::string &  defaultGroup,
long &  activeGroup,
long &  activeMaterial,
long &  activeSmoothId 
)
protected

Write data of an object to OBJ output stream. Write, only:

  • v: vertices coordinates
  • vt: texture coordinates (if any)
  • vn: normals referred to vertices
  • f : facet connectivity
  • usemtl : all the cells after the keyword will be assigned to the material specified by mtllib file (if any)
  • g: all the cells after the keyword will be assigned to cell group specified by g (if any)
  • s: all the cells after the keyword will be assigned to smooth group specified by s (if any)

Data are taken from m_geometry (for main mesh), m_extTexture(for texture) and m_extData(for attached WavefrontOBJData datatypes)

Parameters
[in]objDatasource object data structure
[in]outwriting stream
[in]vertexListslist of points involved for the object for all 3 type v, vt, vn
[in]cellListlist of cells involved for the object
[in,out]vOffsetsoffset for local v,vt,vn counting
[in,out]vinsertion_mapslocal map id-written insertion index for v,vt,vn (to avoid rewrite vertices)
[in]defaultGroupname of the current object part (save all empty cellgroups entry in defaultGroup).
[in,out]activeGroupcurrently active cellgroup for the mesh
[in,out]activeMaterialcurrently active material for the mesh
[in,out]activeSmoothIdcurrently active smoothids for the mesh

Definition at line 2467 of file IOWavefrontOBJ.cpp.

◆ writeResumeFile()

void mimmo::IOWavefrontOBJ::writeResumeFile ( )
protected

Print the resume file

Definition at line 2023 of file IOWavefrontOBJ.cpp.


The documentation for this class was generated from the following files: