mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-08 08:11:14 +00:00
* Remove the OBJ Color Dialog That Texture Import Replaced * Remove references to ObjColorDialog
52 lines
1.8 KiB
C++
52 lines
1.8 KiB
C++
#ifndef slic3r_Format_OBJ_hpp_
|
|
#define slic3r_Format_OBJ_hpp_
|
|
#include "libslic3r/Color.hpp"
|
|
#include "objparser.hpp"
|
|
#include "libslic3r/Point.hpp"
|
|
#include <admesh/stl.h>
|
|
#include <array>
|
|
#include <functional>
|
|
#include <map>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
namespace Slic3r {
|
|
|
|
class TriangleMesh;
|
|
class Model;
|
|
class ModelObject;
|
|
// Load an OBJ file into a provided model.
|
|
struct ObjInfo {
|
|
std::vector<RGBA> vertex_colors;
|
|
std::vector<RGBA> face_colors;
|
|
bool is_single_mtl{false};
|
|
std::string lost_material_name{""};
|
|
std::vector<std::array<Vec2f,3>> uvs;
|
|
std::string obj_dircetory;
|
|
std::map<std::string,bool> pngs;
|
|
std::unordered_map<int, std::string> uv_map_pngs;
|
|
bool has_uv_png{false};
|
|
std::vector<ObjParser::ObjUseMtl> usemtls; // material spans, for texture import
|
|
|
|
};
|
|
extern bool load_obj(const char *path, TriangleMesh *mesh, ObjInfo &vertex_colors, std::string &message, ObjParser::MtlData *out_mtl = nullptr);
|
|
extern bool load_obj(const char *path, Model *model, ObjInfo &vertex_colors, std::string &message, const char *object_name = nullptr, ObjParser::MtlData *out_mtl = nullptr);
|
|
|
|
struct TexturedMesh;
|
|
// Build a TexturedMesh (vertices + per-face UVs + the texture files named by map_Kd) from a
|
|
// parsed OBJ plus its material table, so the texture-to-color importer can sample face colours.
|
|
extern bool obj_to_textured_mesh(
|
|
const ObjInfo& obj_info,
|
|
const indexed_triangle_set& its,
|
|
const ObjParser::MtlData& mtl_data,
|
|
const std::string& obj_directory,
|
|
TexturedMesh& out);
|
|
|
|
extern bool store_obj(const char *path, TriangleMesh *mesh);
|
|
extern bool store_obj(const char *path, ModelObject *model);
|
|
extern bool store_obj(const char *path, Model *model);
|
|
|
|
}; // namespace Slic3r
|
|
|
|
#endif /* slic3r_Format_OBJ_hpp_ */
|