Helios++
Helios software for LiDAR simulations
WavefrontObjFileLoader Class Reference

OBJ file loader filter. More...

#include <WavefrontObjFileLoader.h>

Inheritance diagram for WavefrontObjFileLoader:
Collaboration diagram for WavefrontObjFileLoader:

Public Member Functions

 WavefrontObjFileLoader ()
 Constructor for OBJ file loader filter. More...
 
ScenePartrun ()
 
Vertex readVertex (std::vector< std::string > const &lineParts, bool const yIsUp)
 Load a vertice from a given line. More...
 
glm::dvec3 readNormalVector (std::vector< std::string > const &lineParts, bool const yIsUp)
 Read a normal vector from a given line. More...
 
void readPrimitive (WavefrontObj *loadedObj, std::vector< std::string > const &lineParts, std::vector< Vertex > const &vertices, std::vector< glm::dvec2 > const &texcoords, std::vector< glm::dvec3 > const &normals, std::string const &currentMat, std::string const &pathString)
 Reads a face from a given line. More...
 
WavefrontObjloadObj (std::string const &pathString, bool const yIsUp)
 Load an OBJ file.
 
- Public Member Functions inherited from AbstractGeometryFilter
 AbstractGeometryFilter (ScenePart *parts_)
 Base constructor for asset loading filters. More...
 
std::shared_ptr< MaterialgetMaterial (std::string materialName)
 Retrieve requested material by name. More...
 
std::vector< std::shared_ptr< Material > > parseMaterials ()
 Parse materials specified through "matfile", which can be concreted through "matname" parameter. It can also handle random materials when parameter "randomMaterials" is set. More...
 

Static Public Member Functions

static void buildPrimitiveVertex (Vertex &dstVert, Vertex const &srcVert, int const texIdx, int const normalIdx, std::vector< glm::dvec2 > const &texcoords, std::vector< glm::dvec3 > const &normals)
 Build dstVertex considering data of srcVert. More...
 

Private Attributes

std::string filePathString = ""
 Path to the OBJ file.
 

Additional Inherited Members

- Public Attributes inherited from AbstractGeometryFilter
OGRSpatialReference * sourceCRS
 
std::map< std::string, ObjectT > params
 Available parameters.
 
std::map< std::string, Materialmaterials
 Available materials.
 
ScenePartprimsOut = nullptr
 ScenePart used to build the output. Not strictly necessary for any filter.
 

Detailed Description

OBJ file loader filter.

Constructor & Destructor Documentation

◆ WavefrontObjFileLoader()

WavefrontObjFileLoader::WavefrontObjFileLoader ( )
inline

Constructor for OBJ file loader filter.

See also
AbstractGeometryFilter::AbstractGeometryFilter(ScenePart*)

Member Function Documentation

◆ buildPrimitiveVertex()

void WavefrontObjFileLoader::buildPrimitiveVertex ( Vertex dstVert,
Vertex const &  srcVert,
int const  texIdx,
int const  normalIdx,
std::vector< glm::dvec2 > const &  texcoords,
std::vector< glm::dvec3 > const &  normals 
)
static

Build dstVertex considering data of srcVert.

Parameters
dstVertVertex to be built. It belongs to a primitive.
[in]srcVertVertex used to built. It comes from the set of vertices in obj file.
texIdxIndex of texture to be used
normalIdxIndex of normal to be used.
texcoordsVector of texture coordinates.
normalsVector of normals. It contains the normal for each vertex.

◆ readNormalVector()

glm::dvec3 WavefrontObjFileLoader::readNormalVector ( std::vector< std::string > const &  lineParts,
bool const  yIsUp 
)

Read a normal vector from a given line.

Parameters
linePartsVector containing each normal coordinate in string format

◆ readPrimitive()

void WavefrontObjFileLoader::readPrimitive ( WavefrontObj loadedObj,
std::vector< std::string > const &  lineParts,
std::vector< Vertex > const &  vertices,
std::vector< glm::dvec2 > const &  texcoords,
std::vector< glm::dvec3 > const &  normals,
std::string const &  currentMat,
std::string const &  pathString 
)

Reads a face from a given line.

Parameters
linePartsVector of strings containing the primitive indices
verticesVertices used to build. They come from the set of vertices in the obj file
texcoordsCoordinates of the texture to be loaded in the face
normalsVector of normales of every face in the .obj file
currentMatCurrent material to be used in the primitive
pathStringPath to the primitive

◆ readVertex()

Vertex WavefrontObjFileLoader::readVertex ( std::vector< std::string > const &  lineParts,
bool const  yIsUp 
)

Load a vertice from a given line.

Parameters
linePartsVector containing each vertex coordinate in string format

◆ run()

ScenePart * WavefrontObjFileLoader::run ( )
virtual

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