36 bool LoadObj(Mesh& mesh,
const char* filename);
90 std::vector<tinyobj_shape<T>>
shapes;
105 for (
const auto & shape : geom.
shapes)
106 index_count +=shape.indices.size();
111 std::vector<int> complete_indices(index_count);
112 for (
const auto& shape : geom.
shapes) {
113 std::copy(shape.indices.begin(), shape.indices.end(), complete_indices.begin() + last_index);
114 last_index += shape.indices.size();
120 std::vector<T> out_vertices(geom.
attributes.vertices.size());
121 for (
int i = 0; i < geom.
attributes.vertices.size(); i++)
122 out_vertices[i] =
static_cast<T
>(geom.
attributes.vertices[i]);
166 bool change_coords =
false,
209 std::vector<std::string>& path,
211 bool change_coords =
false,
Contains definitions for the MeshInfo class.
Manipulate and load geometry from disk.
vector< MeshInfo< float > > LoadMeshObjects(std::string path, GROUP_METHOD gm, bool change_coords, int scale)
Create MeshInfo instances from the OBJ at path.
std::vector< int > mat_ids
std::vector< tinyobj_material > materials
tinyobj_attr< T > attributes
std::vector< tinyobj_shape< T > > shapes
HF::Geometry::MeshInfo< T > LoadTMPMeshObjects(const std::string &path)
tinyobj_geometry< double > LoadMeshesFromTinyOBJ(std::string path)
std::vector< T > vertices
GROUP_METHOD
Method of grouping submeshes in OBJ files.
@ ONLY_FILE
Treat all the geometry in the file as a single mesh.
@ MATERIAL_AND_FILE
UNIMPLEMENTED.
@ BY_MATERIAL
Create a new MeshInfo instance for every different material in the file.
@ BY_GROUP
Create a new MeshInfo instance for every OBJ group in the file.
std::vector< int > indices
std::string GetTestOBJPath(std::string key)
Get the path to the OBJ with the given key.
vector< array< float, 3 > > LoadRawVertices(std::string path)
Load a list of vertices directly from an OBJ file.
bool LoadObj(Mesh &mesh, const char *filename)
Eigen a C++ template library for linear algebra: matrices, vectors, numerical solvers,...
A collection of vertices and indices representing geometry.