Subversion Repositories gelsvn

Rev

Rev 433 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 433 Rev 595
Line 1... Line -...
1
/*
-
 
-
 
1
/* ----------------------------------------------------------------------- *
2
 *  load.cpp
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
3
 *  GEL
-
 
4
 *
-
 
5
 *  Created by J. Andreas Bærentzen on 17/08/08.
3
 * Copyright (C) the authors and DTU Informatics
6
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
4
 * For license and list of authors, see ../../doc/intro.pdf
-
 
5
 * ----------------------------------------------------------------------- */
7
 *
6
 
8
 */
7
 
9
 
8
 
10
#include <string>
9
#include "load.h"
-
 
10
 
11
#include "load.h"
11
#include "Manifold.h"
12
 
12
 
13
#include "ply_load.h"
13
#include "ply_load.h"
14
#include "x3d_load.h"
14
#include "x3d_load.h"
15
#include "obj_load.h"
15
#include "obj_load.h"
16
#include "off_load.h"
16
#include "off_load.h"
17
 
17
 
18
using namespace std;
18
using namespace std;
19
 
-
 
20
namespace HMesh
19
namespace HMesh
21
{
20
{
-
 
21
    using std::string;
22
	bool load(const std::string& file_name, HMesh::Manifold& mani)
22
    bool load(const string& file_name, Manifold& mani)
23
	{
23
    {
24
		if(file_name == "") 
24
        if(file_name.length()<5){
25
			return false;
25
            return false;
-
 
26
        }
26
		if(file_name.substr(file_name.length()-4,file_name.length())==".obj")
27
        if(file_name.substr(file_name.length()-4,file_name.length())==".obj"){
27
			return obj_load(file_name, mani);
28
            return obj_load(file_name, mani);
-
 
29
        }
28
		else if(file_name.substr(file_name.length()-4,file_name.length())==".x3d")
30
        else if(file_name.substr(file_name.length()-4,file_name.length())==".x3d"){
29
			return x3d_load(file_name, mani);
31
            return x3d_load(file_name, mani);
-
 
32
        }
30
		else if(file_name.substr(file_name.length()-4,file_name.length())==".ply")
33
        else if(file_name.substr(file_name.length()-4,file_name.length())==".ply"){
31
			return ply_load(file_name, mani);
34
            return ply_load(file_name, mani);
-
 
35
        }
32
		else if(file_name.substr(file_name.length()-4,file_name.length())==".off")
36
        else if(file_name.substr(file_name.length()-4,file_name.length())==".off"){
33
			return off_load(file_name, mani);
37
            return off_load(file_name, mani);
-
 
38
        }
34
		return false;
39
        return false;
35
	}
40
    }
36
}
41
}
37
 
42