Helios++
Helios software for LiDAR simulations
WavefrontObjFileLoader.h
1 #pragma once
2 
3 #include "AbstractGeometryFilter.h"
4 #include <glm/glm.hpp>
5 #include "WavefrontObj.h"
6 
14  std::string filePathString = "";
15 
16 public:
17  // *** CONSTRUCTION *** //
18  // ********************** //
24 
25  // *** MAIN METHODS *** //
26  // ********************* //
30  ScenePart *run();
31 
37  std::vector<std::string> const &lineParts,
38  bool const yIsUp
39  );
40 
45  glm::dvec3 readNormalVector(
46  std::vector<std::string> const &lineParts,
47  bool const yIsUp
48  );
49 
60  void readPrimitive(
61  WavefrontObj *loadedObj,
62  std::vector<std::string> const &lineParts,
63  std::vector<Vertex> const &vertices,
64  std::vector<glm::dvec2> const &texcoords,
65  std::vector<glm::dvec3> const &normals,
66  std::string const &currentMat,
67  std::string const &pathString
68  );
69 
73  WavefrontObj *loadObj(std::string const &pathString, bool const yIsUp);
74 
75  // *** ASSIST METHODS *** //
76  // ************************ //
88  static void buildPrimitiveVertex(
89  Vertex &dstVert,
90  Vertex const &srcVert,
91  int const texIdx,
92  int const normalIdx,
93  std::vector<glm::dvec2> const &texcoords,
94  std::vector<glm::dvec3> const &normals
95  );
96 };
Abstract class defining asset loading filters common behavior.
Definition: AbstractGeometryFilter.h:18
Class representing a scene part.
Definition: ScenePart.h:20
Class representing a vertex.
Definition: Vertex.h:14
OBJ file loader filter.
Definition: WavefrontObjFileLoader.h:10
WavefrontObjFileLoader()
Constructor for OBJ file loader filter.
Definition: WavefrontObjFileLoader.h:23
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.
Definition: WavefrontObjFileLoader.cpp:399
WavefrontObj * loadObj(std::string const &pathString, bool const yIsUp)
Load an OBJ file.
Definition: WavefrontObjFileLoader.cpp:279
Vertex readVertex(std::vector< std::string > const &lineParts, bool const yIsUp)
Load a vertice from a given line.
Definition: WavefrontObjFileLoader.cpp:135
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.
Definition: WavefrontObjFileLoader.cpp:211
ScenePart * run()
Definition: WavefrontObjFileLoader.cpp:35
std::string filePathString
Path to the OBJ file.
Definition: WavefrontObjFileLoader.h:14
glm::dvec3 readNormalVector(std::vector< std::string > const &lineParts, bool const yIsUp)
Read a normal vector from a given line.
Definition: WavefrontObjFileLoader.cpp:185
Class representing a .obj loaded file.
Definition: WavefrontObj.h:15