Back to index

supertuxkart  0.5+dfsg1
material_manager.hpp
Go to the documentation of this file.
00001 //  $Id: material_manager.hpp 2111 2008-05-31 07:04:30Z cosmosninja $
00002 //
00003 //  SuperTuxKart - a fun racing game with go-kart
00004 //  Copyright (C) 2004 Steve Baker <sjbaker1@airmail.net>
00005 //
00006 //  This program is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU General Public License
00008 //  as published by the Free Software Foundation; either version 2
00009 //  of the License, or (at your option) any later version.
00010 //
00011 //  This program 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
00014 //  GNU General Public License for more details.
00015 //
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020 #ifndef HEADER_MATERIALMANAGER_H
00021 #define HEADER_MATERIALMANAGER_H
00022 
00023 #include <plib/ssg.h>
00024 #include <string>
00025 #include <vector>
00026 
00027 class Material;
00028 
00029 class MaterialManager
00030 {
00031 private:
00032 
00033     char   *parseFileName(char **str);
00034     int     parseMaterial(FILE *fd);
00035     void    parseMaterialFile(const std::string& filename);
00036     int     m_shared_material_index;
00037 
00038     std::vector<Material*> m_materials;
00039 public:
00040     MaterialManager();
00041     void      loadMaterial     ();
00042     void      reInit           ();
00043     int       addEntity        (Material *m);
00044     Material *getMaterial      (ssgLeaf *lf);
00045     Material *getMaterial      (const std::string& t, bool is_full_path=false);
00046     void      addSharedMaterial(const std::string& filename);
00047     bool      pushTempMaterial (const std::string& filename);
00048     void      popTempMaterial  ();
00049 };
00050 
00051 extern ssgState *fuzzy_gst, *herringbones_gst;
00052 
00053 ssgState *getAppState ( char *fname ) ;
00054 extern MaterialManager *material_manager;
00055 
00056 #endif
00057 
00058 /* EOF */