MeshLib C++ Docs
Loading...
Searching...
No Matches
MRMeshLoadObj.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMesh.h"
4#include "MRMeshTexture.h"
6#include "MRExpected.h"
8#include "MRAffineXf3.h"
9#include "MRLoadedObjects.h"
10#include <filesystem>
11#include <istream>
12#include <string>
13
14namespace MR
15{
16
17namespace MeshLoad
18{
19
23
24struct ObjLoadSettings
25{
27 bool customXf = false;
28
30 bool countSkippedFaces = false;
31
33 ProgressCallback callback;
34
36 bool telemetrySignal = true;
37};
38
39struct NamedMesh
40{
41 std::string name;
43 VertUVCoords uvCoords;
47 std::optional<Color> diffuseColor;
48
51
54
57};
58
60MRMESH_API Expected<std::vector<NamedMesh>> fromSceneObjFile( const std::filesystem::path& file, bool combineAllObjects,
61 const ObjLoadSettings& settings = {} );
62
66MRMESH_API Expected<std::vector<NamedMesh>> fromSceneObjFile( std::istream& in, bool combineAllObjects, const std::filesystem::path& dir,
67 const ObjLoadSettings& settings = {} );
68
71MRMESH_API Expected<std::vector<NamedMesh>> fromSceneObjFile( const char* data, size_t size, bool combineAllObjects, const std::filesystem::path& dir,
72 const ObjLoadSettings& settings = {} );
73
75MRMESH_API Expected<LoadedObjects> loadObjectFromObj( const std::filesystem::path& file, const ProgressCallback& cb = {} );
76
77} // namespace MeshLoad
78
79} // namespace MR
#define MRMESH_API
Definition MRMeshFwd.h:80
Definition MRMeshLoadObj.h:40
new unsafe ref int duplicatedVertexCount
new unsafe ref int skippedFaceCount
Definition MRMeshLoadObj.h:25
new unsafe ref bool countSkippedFaces
new unsafe ref bool telemetrySignal
new unsafe ref bool customXf
Definition MRMesh/MRMesh.h:23
std::vector<T>-like container that requires specific indexing type,
Definition MRVector.h:19
std::string name
Definition MRMeshLoadObj.h:41
VertUVCoords uvCoords
Definition MRMeshLoadObj.h:43
std::optional< Color > diffuseColor
Definition MRMeshLoadObj.h:47
Vector< TextureId, FaceId > texturePerFace
Definition MRMeshLoadObj.h:46
AffineXf3f xf
transform of the loaded mesh, not identity only if ObjLoadSettings.customXf
Definition MRMeshLoadObj.h:50
Mesh mesh
Definition MRMeshLoadObj.h:42
MRMESH_API Expected< std::vector< NamedMesh > > fromSceneObjFile(const std::filesystem::path &file, bool combineAllObjects, const ObjLoadSettings &settings={})
loads meshes from .obj file
VertColors colors
Definition MRMeshLoadObj.h:44
Vector< std::filesystem::path, TextureId > textureFiles
Definition MRMeshLoadObj.h:45
MRMESH_API Expected< LoadedObjects > loadObjectFromObj(const std::filesystem::path &file, const ProgressCallback &cb={})
reads all objects from .OBJ file
ProgressCallback callback
callback for set progress and stop process
Definition MRMeshLoadObj.h:33
Definition MRCameraOrientationPlugin.h:8
ImVec2 size(const ViewportRectangle &rect)
Definition MRViewport.h:29