Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

MeshLoader.cpp

00001 /*************************************************************************** 00002 * This file is part of OpenCAL: Open Computer Animation Library * 00003 * I created OpenCAL as my master's thesis Computer Science (multimedia) * 00004 * at the tUL university in Diepenbeek, Belgium * 00005 * * 00006 * Copyright (C) 2003-2004 by Jeroen Dierckx * 00007 * jeroen.dierckx@student.luc.ac.be * 00008 * * 00009 ***************************************************************************/ 00010 00011 // Includes 00012 #include "MeshLoader.h" 00013 #include <OpenCAL/ASELoader.h> 00014 #include <OpenCAL/MLoader.h> 00015 #include <OpenCAL/ASCLoader.h> 00016 #include <OpenCAL/PLYLoader.h> 00017 using namespace OpenCAL; 00018 00019 using namespace std; 00020 00021 00022 /****************************** 00023 * Constructors and destructor * 00024 ******************************/ 00025 00026 MeshLoader::MeshLoader() 00027 { 00028 } 00029 00030 MeshLoader::~MeshLoader() 00031 { 00032 } 00033 00034 00035 /************************ 00036 * Get and set functions * 00037 ************************/ 00038 00039 00040 /****************** 00041 * Other functions * 00042 ******************/ 00043 00044 void MeshLoader::loadMesh(TriangleMesh *mesh, const string &filename) 00045 { 00046 int dotpos = filename.rfind("."); 00047 string ext = filename.substr(dotpos + 1); 00048 for(string::iterator it = ext.begin(); it != ext.end(); ++it) 00049 *it = tolower(*it); 00050 cout << "Filename extension: " << ext << endl; 00051 00052 if(ext == "ase") 00053 ASELoader::loadMesh(mesh, filename); 00054 else if(ext == "m") 00055 MLoader::loadMesh(mesh, filename); 00056 else if(ext == "asc") 00057 ASCLoader::loadMesh(mesh, filename); 00058 else if(ext == "ply") 00059 PLYLoader::loadMesh(mesh, filename); 00060 else 00061 cerr << "I don't recognise the type of your filename. I'm sorry..." << endl; 00062 } 00063 00064 00065 /********************** 00066 * Protected functions * 00067 **********************/ 00068 00069 bool MeshLoader::startsWith(const string &line, const string &start) 00070 { 00071 if(line.length() == 0 || start.length() == 0) return false; 00072 00073 unsigned int length = start.length(); 00074 00075 return (line.compare(0, length, start) == 0); 00076 }

Generated on Sun Aug 15 19:19:22 2004 for OpenCAL: Open Computer Animation Library by doxygen 1.3.8