Back to index

supertuxkart  0.5+dfsg1
material.hpp
Go to the documentation of this file.
00001 //  $Id: material.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_MATERIAL_H
00021 #define HEADER_MATERIAL_H
00022 
00023 #include <string>
00024 #include <plib/ssg.h>
00025 
00026 class Material
00027 {
00028 private:
00029     ssgSimpleState *m_state;
00030     ssgCallback     m_predraw;
00031     ssgCallback     m_postdraw;
00032     int             m_index;
00033     std::string     m_texname;
00034     bool            m_collideable;
00035     bool            m_zipper;
00036     bool            m_resetter;
00037     bool            m_ignore;
00038     int             m_clamp_tex;
00039     bool            m_lighting;
00040     bool            m_sphere_map;
00041     bool            m_transparency;
00042     float           m_alpha_ref;
00043     float           m_friction;
00044 
00045     bool  parseBool  ( char **p );
00046     int   parseInt   ( char **p );
00047     float parseFloat ( char **p );
00048 
00049     void init    (int index);
00050     void install (bool is_full_path=false);
00051 
00052 public:
00053 
00054     Material(int index);
00055     Material(const std::string& fname, char *description, int index,
00056              bool is_full_path=false);
00057 
00058     ~Material ();
00059 
00060     int matches ( char *tx ) ;
00061 
00062     ssgSimpleState 
00063          *getState    () const { return m_state ;      }
00064     bool  isIgnore    () const { return m_ignore;      }
00065     bool  isZipper    () const { return m_zipper;      }
00066     bool  isSphereMap () const { return m_sphere_map;  }
00067     bool  isCrashable () const { return m_collideable; }
00068     bool  isReset     () const { return m_resetter;    }
00069     float getFriction () const { return m_friction;    }
00070     const std::string& 
00071           getTexFname () const { return m_texname;     }
00072     int   getIndex    () const { return m_index;       }
00073     void  apply       ()       { m_state ->apply();    }
00074     void  force       ()       { m_state ->force();    }
00075 
00076     void applyToLeaf ( ssgLeaf *l ) ;
00077 
00078 } ;
00079 
00080 
00081 #endif
00082 
00083 /* EOF */