Commit 0467bfe9 authored by Janis Born's avatar Janis Born

add GeometryDataLoadStore with new OBJ loader

parent 99f4da2f
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifndef ACGL_OPENGL_DATA_GEOMETRYDATALOADSTORE_HH
#define ACGL_OPENGL_DATA_GEOMETRYDATALOADSTORE_HH
/**
* Helper function for writing the contents of a TextureData object into a file
* and loading them from a file.
*/
#include <ACGL/ACGL.hh>
#include <ACGL/OpenGL/Data/GeometryData.hh>
#include <string>
namespace ACGL{
namespace OpenGL{
///////////////////////////////////////////////////////////////////////////////////////////////////
// generic load/save
///////////////////////////////////////////////////////////////////////////////////////////////////
//! generic load function that will use one of the loading functions below based on the file ending
SharedGeometryData loadGeometryData(const std::string& _filename);
///////////////////////////////////////////////////////////////////////////////////////////////////
// library specific load
///////////////////////////////////////////////////////////////////////////////////////////////////
//! loads from a Wavefront OBJ file
SharedGeometryData loadGeometryDataFromOBJ(const std::string& _filename, bool _computeNormals = false);
///////////////////////////////////////////////////////////////////////////////////////////////////
// library specific save
///////////////////////////////////////////////////////////////////////////////////////////////////
} // OpenGL
} // ACGL
#endif // ACGL_OPENGL_DATA_GEOMETRYDATALOADSTORE_HH
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#include <ACGL/OpenGL/Data/GeometryDataLoadStore.hh>
//#include <ACGL/OpenGL/Tools.hh>
#include <ACGL/Base/FileHelpers.hh>
//#include <ACGL/Utils/Memory.hh>
using namespace ACGL;
using namespace ACGL::OpenGL;
using namespace ACGL::Utils;
namespace ACGL{
namespace OpenGL{
///////////////////////////////////////////////////////////////////////////////////////////////////
// generic load/save
///////////////////////////////////////////////////////////////////////////////////////////////////
SharedGeometryData loadGeometryData(const std::string& _filename)
{
// lower case file ending:
std::string fileEnding = Base::FileHelpers::getFileEnding(_filename);
if (fileEnding == "obj")
{
return loadGeometryDataFromOBJ(_filename);
}
else
{
error() << "file format of " << _filename << " not supported" << std::endl;
}
return SharedGeometryData();
}
} // OpenGL
} // ACGL
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment