1#include <Core/Containers/AlignedStdVector.hpp>
2#include <Core/Containers/VectorArray.hpp>
3#include <Core/Geometry/IndexedGeometry.hpp>
5#include <Core/Utils/Attribs.hpp>
7#include <IO/deprecated/OBJFileManager.hpp>
35bool OBJFileManager::importData(
std::istream& file, Geometry::TriangleMesh& data ) {
38 Geometry::TriangleMesh::PointAttribHandle::Container vertices;
39 Geometry::TriangleMesh::NormalAttribHandle::Container normals;
40 Geometry::TriangleMesh::IndexContainerType indices;
46 if ( token ==
"#" ) {
continue; }
49 iss >> v[0] >> v[1] >> v[2];
50 vertices.push_back( v );
52 if ( token ==
"vn" ) {
54 iss >> n[0] >> n[1] >> n[2];
55 normals.push_back( n );
57 if ( token ==
"vt" ) {
continue; }
58 if ( token ==
"vp" ) {
continue; }
72 addLogErrorEntry(
"MESH CONTAINS QUADS." );
77 indices.push_back( f );
80 if ( vertices.size() == 0 ) {
81 addLogErrorEntry(
"MESH IS EMPTY." );
91bool OBJFileManager::exportData(
std::ostream& file,
const Geometry::TriangleMesh& data ) {
93 if ( data.vertices().size() == 0 ) {
94 addLogErrorEntry(
"MESH IS EMPTY." );
98 for (
const auto& v : data.vertices() ) {
103 for (
const auto& n : data.normals() ) {
108 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