Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Classes | Functions
CompositeObj Namespace Reference

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)
 

Detailed Description

Commposite OBJ files loading.

Function Documentation

◆ load()

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.

Parameters
filePaththe path to the OBJ file
objectswill be filled the objects infos
materialswill be filled with the materials infos
Returns
an error code or 0

◆ parseMtlFile()

void CompositeObj::parseMtlFile ( std::istream &  inMat,
const std::string &  rootPath,
std::unordered_map< std::string, Material > &  materials 
)

Parse a MTL file to extract materials.

Parameters
inMatthe stream to parse
rootPaththe root path for all texture paths
materialscontains the materials that might be udpated by this file

◆ parseMultiObj()

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.

Parameters
objFilethe stream to parse
geometrywill contain all the geometry stored in the file
materialsFileswill contain a list of material files referenced.
objectMatUseswill contain a list of object/material associations.

◆ populateMesh()

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.

Parameters
geomthe raw geoemtry data
lowerBoundthe index of the object first face
upperBoundthe index after the object last face
meshwill be updated with geoemtry data