1#include <IO/deprecated/OBJFileManager.hpp>
26bool OBJFileManager::importData(
std::istream& file, Geometry::TriangleMesh& data ) {
29 Geometry::TriangleMesh::PointAttribHandle::Container vertices;
30 Geometry::TriangleMesh::NormalAttribHandle::Container normals;
31 Geometry::TriangleMesh::IndexContainerType indices;
37 if ( token ==
"#" ) {
continue; }
40 iss >> v[0] >> v[1] >> v[2];
41 vertices.push_back( v );
43 if ( token ==
"vn" ) {
45 iss >> n[0] >> n[1] >> n[2];
46 normals.push_back( n );
48 if ( token ==
"vt" ) {
continue; }
49 if ( token ==
"vp" ) {
continue; }
63 addLogErrorEntry(
"MESH CONTAINS QUADS." );
68 indices.push_back( f );
71 if ( vertices.size() == 0 ) {
72 addLogErrorEntry(
"MESH IS EMPTY." );
82bool OBJFileManager::exportData(
std::ostream& file,
const Geometry::TriangleMesh& data ) {
84 if ( data.vertices().size() == 0 ) {
85 addLogErrorEntry(
"MESH IS EMPTY." );
89 for (
const auto& v : data.vertices() ) {
94 for (
const auto& n : data.normals() ) {
99 for (
const auto& f : data.getIndices() ) {
void setNormals(PointAttribHandle::Container &&normals)
Set normals.
void setVertices(PointAttribHandle::Container &&vertices)
Set vertices.
void setIndices(IndexContainerType &&indices)
void clear() override
Erases all data, making the AttribArrayGeometry empty.
std::string fileExtension() const override
INTERFACE.
~OBJFileManager() override
DESTRUCTOR.
OBJFileManager()
CONSTRUCTOR.
@ Geometry
"Geometry" render objects are those loaded using Radium::IO and generated by GeometrySystem
hepler function to manage enum as underlying types in VariableSet