GeometryDataControlFileOBJ.hh 1.65 KB
Newer Older
Robert Menzel's avatar
Robert Menzel committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011, 2012 Computer Graphics Group RWTH Aachen University    //
// All rights reserved.                                                       //
////////////////////////////////////////////////////////////////////////////////

#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{

class GeometryDataControlFileOBJ : public ACGL::OpenGL::GeometryDataControlFile
{
    friend void initStaticFileTypes(void);
public:
    GeometryDataControlFileOBJ(const std::string& _filename) : GeometryDataControlFile(_filename) {}
    virtual ~GeometryDataControlFileOBJ(void) {}

    // the entry point that gets registered in registerType()
    static SharedGeometryDataControlFile creator(const std::string& _filename) { return SharedGeometryDataControlFile(new GeometryDataControlFileOBJ(_filename)); }
private:
    virtual bool load(SharedGeometryData& geometry) const;

private:
    // register the file extension 'obj' for this loader
    static ACGL::int_t registerType(void)
    {
        sTypeID = GeometryDataControlFileFactory::the()->registerType("obj", &GeometryDataControlFileOBJ::creator);
        return sTypeID;
    }
};


ACGL_SMARTPOINTER_TYPEDEFS(GeometryDataControlFileOBJ)

} // OpenGL
} // ACGL

#endif // ACGL_OPENGL_CONTROLLER_GEOMETRYDATACONTROLFILEOBJ_HH