MeshLib
 
Loading...
Searching...
No Matches
Mesh Load Obj

Classes

struct  MR::MeshLoad::ObjLoadSettings
 
struct  MR::MeshLoad::NamedMesh
 

Functions

MRMESH_API Expected< std::vector< NamedMesh > > MR::MeshLoad::fromSceneObjFile (const std::filesystem::path &file, bool combineAllObjects, const ObjLoadSettings &settings={})
 loads meshes from .obj file
 
MRMESH_API Expected< std::vector< NamedMesh > > MR::MeshLoad::fromSceneObjFile (std::istream &in, bool combineAllObjects, const std::filesystem::path &dir, const ObjLoadSettings &settings={})
 
MRMESH_API Expected< std::vector< NamedMesh > > MR::MeshLoad::fromSceneObjFile (const char *data, size_t size, bool combineAllObjects, const std::filesystem::path &dir, const ObjLoadSettings &settings={})
 

Variables

bool MR::MeshLoad::ObjLoadSettings::customXf = false
 if true then vertices will be returned relative to some transformation to avoid precision loss
 
bool MR::MeshLoad::ObjLoadSettings::countSkippedFaces = false
 if true, the number of skipped faces (faces than can't be created) will be counted
 
ProgressCallback MR::MeshLoad::ObjLoadSettings::callback
 callback for set progress and stop process
 
std::string MR::MeshLoad::NamedMesh::name
 
Mesh MR::MeshLoad::NamedMesh::mesh
 
VertUVCoords MR::MeshLoad::NamedMesh::uvCoords
 
VertColors MR::MeshLoad::NamedMesh::colors
 
Vector< std::filesystem::path, TextureId > MR::MeshLoad::NamedMesh::textureFiles
 
Vector< TextureId, FaceIdMR::MeshLoad::NamedMesh::texturePerFace
 
std::optional< ColorMR::MeshLoad::NamedMesh::diffuseColor
 
AffineXf3f MR::MeshLoad::NamedMesh::xf
 transform of the loaded mesh, not identity only if ObjLoadSettings.customXf
 
int MR::MeshLoad::NamedMesh::skippedFaceCount = 0
 counter of skipped faces (faces than can't be created), not zero only if ObjLoadSettings.countSkippedFaces
 
int MR::MeshLoad::NamedMesh::duplicatedVertexCount = 0
 counter of duplicated vertices (that created for resolve non-manifold geometry)
 

Detailed Description

Function Documentation

◆ fromSceneObjFile() [1/3]

MRMESH_API Expected< std::vector< NamedMesh > > MR::MeshLoad::fromSceneObjFile ( const char * data,
size_t size,
bool combineAllObjects,
const std::filesystem::path & dir,
const ObjLoadSettings & settings = {} )

loads meshes from memory array with .obj file contents

Parameters
dirworking directory where materials and textures are located

◆ fromSceneObjFile() [2/3]

MRMESH_API Expected< std::vector< NamedMesh > > MR::MeshLoad::fromSceneObjFile ( const std::filesystem::path & file,
bool combineAllObjects,
const ObjLoadSettings & settings = {} )

loads meshes from .obj file

◆ fromSceneObjFile() [3/3]

MRMESH_API Expected< std::vector< NamedMesh > > MR::MeshLoad::fromSceneObjFile ( std::istream & in,
bool combineAllObjects,
const std::filesystem::path & dir,
const ObjLoadSettings & settings = {} )

loads meshes from a stream with .obj file contents important on Windows: in stream must be open in binary mode

Parameters
dirworking directory where materials and textures are located

Variable Documentation

◆ callback

ProgressCallback MR::MeshLoad::ObjLoadSettings::callback

callback for set progress and stop process

◆ colors

VertColors MR::MeshLoad::NamedMesh::colors

◆ countSkippedFaces

bool MR::MeshLoad::ObjLoadSettings::countSkippedFaces = false

if true, the number of skipped faces (faces than can't be created) will be counted

◆ customXf

bool MR::MeshLoad::ObjLoadSettings::customXf = false

if true then vertices will be returned relative to some transformation to avoid precision loss

◆ diffuseColor

std::optional<Color> MR::MeshLoad::NamedMesh::diffuseColor

◆ duplicatedVertexCount

int MR::MeshLoad::NamedMesh::duplicatedVertexCount = 0

counter of duplicated vertices (that created for resolve non-manifold geometry)

◆ mesh

Mesh MR::MeshLoad::NamedMesh::mesh

◆ name

std::string MR::MeshLoad::NamedMesh::name

◆ skippedFaceCount

int MR::MeshLoad::NamedMesh::skippedFaceCount = 0

counter of skipped faces (faces than can't be created), not zero only if ObjLoadSettings.countSkippedFaces

◆ textureFiles

Vector<std::filesystem::path, TextureId> MR::MeshLoad::NamedMesh::textureFiles

◆ texturePerFace

Vector<TextureId, FaceId> MR::MeshLoad::NamedMesh::texturePerFace

◆ uvCoords

VertUVCoords MR::MeshLoad::NamedMesh::uvCoords

◆ xf

AffineXf3f MR::MeshLoad::NamedMesh::xf

transform of the loaded mesh, not identity only if ObjLoadSettings.customXf