GeometryDataControlFileOBJ.hh 1.93 KB
Newer Older
1
2
3
4
5
/***********************************************************************
 * Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
 * All rights reserved.                                                *
 * Distributed under the terms of the MIT License (see LICENSE.TXT).   *
 **********************************************************************/
Robert Menzel's avatar
Robert Menzel committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

#ifndef ACGL_OPENGL_CONTROLLER_GEOMETRYDATACONTROLFILEOBJ_HH
#define ACGL_OPENGL_CONTROLLER_GEOMETRYDATACONTROLFILEOBJ_HH

/**
 * A minimal obj loader.
 */

#include <ACGL/ACGL.hh>

#include <ACGL/OpenGL/Controller/DataControlFile.hh>
#include <ACGL/OpenGL/InitStaticFileTypes.hh>
#include <ACGL/OpenGL/Controller/DataControlFileFactory.hh>

namespace ACGL{
namespace OpenGL{

Robert Menzel's avatar
Robert Menzel committed
23
24
class GeometryDataControlFileATB;

25
class GeometryDataControlFileMesh : public ACGL::OpenGL::GeometryDataControlFile
Robert Menzel's avatar
Robert Menzel committed
26
27
{
    friend void initStaticFileTypes(void);
Robert Menzel's avatar
Robert Menzel committed
28
    friend class GeometryDataControlFileATB;
Robert Menzel's avatar
Robert Menzel committed
29
public:
30
31
    GeometryDataControlFileMesh(const std::string& _filename) : GeometryDataControlFile(_filename,Base::Settings::the()->getFullGeometryPath()) {}
    virtual ~GeometryDataControlFileMesh(void) {}
Robert Menzel's avatar
Robert Menzel committed
32
33

    // the entry point that gets registered in registerType()
34
    static SharedGeometryDataControlFile creator(const std::string& _filename) { return SharedGeometryDataControlFile(new GeometryDataControlFileMesh(_filename)); }
Robert Menzel's avatar
Robert Menzel committed
35
36
37
38
39
40
41
private:
    virtual bool load(SharedGeometryData& geometry) const;

private:
    // register the file extension 'obj' for this loader
    static ACGL::int_t registerType(void)
    {
42
43
        sTypeID = GeometryDataControlFileFactory::the()->registerType("obj", &GeometryDataControlFileMesh::creator);
        sTypeID = GeometryDataControlFileFactory::the()->registerType("vap", &GeometryDataControlFileMesh::creator);
Robert Menzel's avatar
Robert Menzel committed
44
45
46
47
48
        return sTypeID;
    }
};


49
ACGL_SMARTPOINTER_TYPEDEFS(GeometryDataControlFileMesh)
Robert Menzel's avatar
Robert Menzel committed
50
51
52
53
54

} // OpenGL
} // ACGL

#endif // ACGL_OPENGL_CONTROLLER_GEOMETRYDATACONTROLFILEOBJ_HH