KeosMaterial.h

Go to the documentation of this file.
00001 /*
00002  * This source file is part of KEOS (Free 3D Engine)
00003  * For the latest info, see http://www.keosengine.org/
00004  * E-mails : thierry.vouriot@keosengine.org, yeri@keosengine.org
00005  *
00006  * This program is free software; you can redistribute it and/or modify it under
00007  * the terms of the GNU Lesser General Public License as published by the Free Software
00008  * Foundation; either version 2 of the License, or (at your option) any later
00009  * version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00018  * http://www.gnu.org/copyleft/lesser.txt.
00019  *
00020  */
00021 #ifndef KEOS_MATERIAL_H
00022 #define KEOS_MATERIAL_H
00023 
00024 #include "KeosPrerequisites.h"
00025 #include "KeosTexture.h"
00026 #include "KeosColor.h"
00027 
00028 namespace Keos
00029 {
00030   //-----------------------------------------------------------------------
00033   class KEOS_EXPORT CMaterial
00034   {
00035   public :
00036 
00039     CMaterial();
00040 
00044     CMaterial(const String& strTexture);
00045 
00048     ~CMaterial();
00049 
00054     CTexture* GetTexture(ushort nLayer = 0)
00055     {
00056       Assert (nLayer < m_Textures.size());
00057       return m_Textures[nLayer];
00058     }
00059 
00066     bool CreateTexture(const String& strTexture, ushort nLayer = 0);
00067 
00074     bool CreateTexture(const CImage& Image, ushort nLayer = 0);
00075 
00078     void SetDiffuseColor(const CColor& Color)
00079     {
00080       m_DiffuseColor = Color;
00081     }
00082 
00085     CColor GetDiffuseColor()
00086     {
00087       return m_DiffuseColor;
00088     }
00089 
00092     bool HasTexture(ushort nLayer = 0)
00093     {
00094       return (m_Textures.size() > nLayer);
00095     }
00096 
00099     String GetName(void)
00100     {
00101       return m_strName;
00102     }
00103 
00106     void SetName(const String& strName)
00107     {
00108       m_strName = strName;
00109     }
00110 
00111   protected :
00112 
00114     String m_strName;
00115 
00117     typedef std::vector<CTexture*> TTextureList;
00118     TTextureList m_Textures;
00119 
00121     CColor m_DiffuseColor;
00122   };
00123 
00125   typedef CSmartPtr<CMaterial, CRefCount> TMaterialPtr;
00126 
00127 } // namespace Keos
00128 
00129 #endif // KEOS_MATERIAL_H

Generated on Fri Mar 9 14:29:02 2007 for Keos by  doxygen 1.5.1-p1