Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglModelLoader.hpp

00001 /*****************************************************************************
00002  * SGL: A Scene Graph Library
00003  *
00004  * Copyright (C) 1997-2001  Scott McMillan   All Rights Reserved.
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free
00018  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  *****************************************************************************
00020  *     File: sglModelLoader.hpp
00021  *   Author: Scott McMillan
00022  *  Created: 15 February 2001
00023  *  Summary: Abstract base class for all 3D model loaders.
00024  *****************************************************************************/
00025 
00026 #ifndef SGL_MODEL_LOADER
00027 #define SGL_MODEL_LOADER
00028 
00029 #include <sgldb.h>
00030 #include <sglDataLoader.hpp>
00031 #include <map>
00032 
00033 class sglNode;
00034 
00035 
00036 
00040 class SGLDB_DLL_API sglModelLoader : public sglDataLoader
00041 {
00042 public:
00044    enum ModeEnum
00045    {
00046       eNONE                    = 0x00,  // default
00047       eSTRIPIFY                = 0x01,
00048       eCOMPUTE_FACETED_NORMALS = 0x02,
00049       eCOMPUTE_SMOOTH_NORMALS  = 0x04
00050    };
00051 
00053    typedef sglNode *(*loaderFunc)(const string &, unsigned int);
00054 
00056    typedef bool (*callbackFunction)( sglNode * node, void * loaderNode, 
00057                                      string &function, void * userData );
00058 
00059 public:
00061    virtual ~sglModelLoader() = 0;
00062 
00070    static sglNode* loadModel(const string &filepath, unsigned int mode);
00071 
00078    static void registerModelLoader(const string &extension,
00079                                    loaderFunc model_loader_func);
00080 
00085    static loaderFunc getModelLoader(const string &extension);
00086 
00095    static void registerCallback(const string &extension,
00096                                    callbackFunction callback_func,
00097                                                                                                                                          void *userData );
00098 
00106    static callbackFunction getCallback(const string &extension, void **ud );
00107 
00115    static void registerOptionString(const string &extension,
00116                                     const string &options );
00117 
00125    static string getOptionString(const string &extension);
00126 
00127 protected:
00128    sglModelLoader();
00129    sglModelLoader(const sglModelLoader &);
00130    sglModelLoader &operator=(const sglModelLoader &);
00131 
00132 private:  // Variables
00133    static map<string, loaderFunc> s_extension_func_map;
00134    static map<string, callbackFunction> s_callback_func_map;
00135    static map<string, void *> s_callback_userdata_map;
00136    static map<string, string> s_option_map;
00137    static sglLock s_lock;
00138 };
00139 
00140 #endif

Generated at Mon Jul 1 18:00:05 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001