Rendu
A lightweight rendering engine for experimentations
|
Commposite OBJ files loading. More...
Classes | |
struct | Material |
OBJ material descriptor. More... | |
struct | Object |
Associate a mesh and a material. More... | |
class | ObjectMaterialUse |
Associate an object and a material with geometry in an OBJ. More... | |
class | RawGeometry |
Contains all the geometry information from an OBJ file. More... | |
Functions | |
void | parseMultiObj (std::istream &objFile, RawGeometry &geometry, std::vector< std::string > &materialsFiles, std::vector< ObjectMaterialUse > &objectMatUses) |
void | populateMesh (const RawGeometry &geom, size_t lowerBound, size_t upperBound, Mesh &mesh) |
void | parseMtlFile (std::istream &inMat, const std::string &rootPath, std::unordered_map< std::string, Material > &materials) |
int | load (const std::string &filePath, std::vector< Object > &objects, std::unordered_map< std::string, Material > &materials) |
Commposite OBJ files loading.
int CompositeObj::load | ( | const std::string & | filePath, |
std::vector< Object > & | objects, | ||
std::unordered_map< std::string, Material > & | materials | ||
) |
Load a multi-objects, multi-materials OBJ file.
filePath | the path to the OBJ file |
objects | will be filled the objects infos |
materials | will be filled with the materials infos |
void CompositeObj::parseMtlFile | ( | std::istream & | inMat, |
const std::string & | rootPath, | ||
std::unordered_map< std::string, Material > & | materials | ||
) |
Parse a MTL file to extract materials.
inMat | the stream to parse |
rootPath | the root path for all texture paths |
materials | contains the materials that might be udpated by this file |
void CompositeObj::parseMultiObj | ( | std::istream & | objFile, |
RawGeometry & | geometry, | ||
std::vector< std::string > & | materialsFiles, | ||
std::vector< ObjectMaterialUse > & | objectMatUses | ||
) |
Parse an OBJ file to extract objects geometry, material library files and object-material associations.
objFile | the stream to parse |
geometry | will contain all the geometry stored in the file |
materialsFiles | will contain a list of material files referenced. |
objectMatUses | will contain a list of object/material associations. |
void CompositeObj::populateMesh | ( | const RawGeometry & | geom, |
size_t | lowerBound, | ||
size_t | upperBound, | ||
Mesh & | mesh | ||
) |
Build a mesh from a subset of the raw geometry data.
geom | the raw geoemtry data |
lowerBound | the index of the object first face |
upperBound | the index after the object last face |
mesh | will be updated with geoemtry data |