include/vamos/geometry/Material.h

Go to the documentation of this file.
00001 //      Vamos Automotive Simulator
00002 //  Copyright (C) 2001--2002 Sam Varner
00003 //
00004 //  This program is free software; you can redistribute it and/or modify
00005 //  it under the terms of the GNU General Public License as published by
00006 //  the Free Software Foundation; either version 2 of the License, or
00007 //  (at your option) any later version.
00008 //
00009 //  This program is distributed in the hope that it will be useful,
00010 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //  GNU General Public License for more details.
00013 //
00014 //  You should have received a copy of the GNU General Public License
00015 //  along with this program; if not, write to the Free Software
00016 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 #ifndef _SURFACE_H_
00019 #define _SURFACE_H_
00020 
00021 #include <vamos/geometry/Gl_Texture_Image.h>
00022 #include <vamos/geometry/Handle.h>
00023 
00024 #include <string>
00025 
00026 namespace Vamos_Geometry
00027 {
00028   class Material;
00029   typedef Handle <Material> Material_Handle;
00030 
00031   class Material
00032   {
00033   public:
00034         enum Material_Type
00035           {
00036                 RUBBER,
00037                 METAL,
00038                 ASPHALT,
00039                 CONCRETE,
00040                 GRASS,
00041                 GRAVEL,
00042                 DIRT,
00043                 UNKNOWN
00044           };
00045 
00046   private:
00047         Material_Type m_type;
00048 
00049         // The frictional properties of the car are muliplied by these factors
00050         // for this particular surface.  They should all be 1.0 for pavement.
00051         double m_friction_factor;
00052         double m_restitution_factor;
00053         double m_rolling_resistance_factor;
00054         double m_drag_factor;
00055 
00056         double m_bump_amplitude;
00057         double m_bump_wavelength;
00058 
00059         // The texture that gets mapped to this surface.
00060         Gl_Texture_Image* mp_texture_image;
00061 
00062   public:
00063         Material (Material_Type type, double friction, double restitution,
00064                           double rolling = 0.0, double drag = 0.0, 
00065                           double bump_amplitude = 0.0, double bump_wavelength = 0.0,
00066                           Gl_Texture_Image* image = 0);
00067         Material ();
00068         Material (const Material& material);
00069         ~Material ();
00070 
00071         const Material& operator = (const Material& material);
00072 
00073         Gl_Texture_Image* texture_image () { return mp_texture_image; }
00074         double friction_factor () const { return m_friction_factor; }
00075         double rolling_resistance_factor () const 
00076         { return m_rolling_resistance_factor; }
00077         double drag_factor () const { return m_drag_factor; }
00078         double restitution_factor () const { return m_restitution_factor; }
00079         double bump (double distance) const;
00080         Material_Type type () const { return m_type; }
00081   };
00082 }
00083 
00084 #endif

Generated on Thu Oct 19 04:05:48 2006 by  doxygen 1.4.6