00001 #ifndef __RAS_IPOLYGONMATERIAL
00002 #define __RAS_IPOLYGONMATERIAL
00003
00004 #include "StdString.h"
00005 #include "KX_HashedString.h"
00006
00007
00012
00013 class RAS_IPolyMaterial
00014 {
00015
00016 protected:
00017
00018 int m_tile;
00019 int m_drawingmode;
00020 int m_transparant;
00021 KX_HashedString m_texturename;
00022 CCString m_materialname;
00023 int m_lightlayer;
00024 bool m_bIsTriangle;
00025 void* m_clientobject;
00026 static void* m_sCachingInfo;
00027
00028 public:
00029
00030 enum MaterialFlags
00031 {
00032 BILLBOARD_SCREENALIGNED = 256,
00033 BILLBOARD_AXISALIGNED = 4096
00034 };
00035
00036 RAS_IPolyMaterial(const CCString& texname, bool ba,const CCString& matname,int tile,int mode,int transparant,int lightlayer
00037 ,bool bIsTriangle,void* clientobject=NULL) :
00038 m_texturename(texname),
00039 m_materialname(matname),
00040 m_tile(tile),
00041 m_drawingmode (mode),
00042 m_transparant(transparant),
00043 m_lightlayer(lightlayer),
00044 m_bIsTriangle(bIsTriangle)
00045 {
00046 }
00047 inline bool Equals(const RAS_IPolyMaterial& lhs) const {
00048 return (
00049 this->m_texturename == lhs.m_texturename &&
00050 this->m_tile == lhs.m_tile &&
00051 this->m_transparant == lhs.m_transparant &&
00052 this->m_drawingmode == lhs.m_drawingmode &&
00053 this->m_bIsTriangle == lhs.m_bIsTriangle &&
00054 this->m_lightlayer == lhs.m_lightlayer
00055 );
00056 }
00057
00058 int GetLightLayer() { return m_lightlayer;};
00059 static void ClearCachingInfo()
00060 {
00061 m_sCachingInfo = NULL;
00062 }
00063 inline bool IsTransparant() { return m_transparant!=0;};
00064 inline bool UsesTriangles() { return m_bIsTriangle;};
00065 unsigned int hash() const { return m_texturename.hash();};
00066 int GetDrawingMode() {return m_drawingmode;};
00067 virtual void ActivateMaterial(class RAS_IRasterizer* rasty) const{};
00068 const CCString& GetMaterialName() const { return m_materialname;}
00069
00070 };
00071
00072 inline bool operator ==( const RAS_IPolyMaterial & rhs,const RAS_IPolyMaterial & lhs)
00073 {
00074 return ( rhs.Equals(lhs));
00075 }
00076
00077
00078 #endif //__RAS_IPOLYGONMATERIAL