00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef CAL_COREMATERIAL_H
00012 #define CAL_COREMATERIAL_H
00013
00014
00015 #include "cal3d/global.h"
00016 #include "cal3d/refcounted.h"
00017 #include "cal3d/refptr.h"
00018
00019
00020
00021 #define CalCoreMaterialMapTypeLengthMax ( 128 )
00022 class CAL3D_API CalCoreMaterial : public cal3d::RefCounted
00023 {
00024 public:
00025 struct Color
00026 {
00027 unsigned char red;
00028 unsigned char green;
00029 unsigned char blue;
00030 unsigned char alpha;
00031 };
00032
00033 struct Map
00034 {
00035 std::string strFilename;
00036 std::string mapType;
00037 Cal::UserData userData;
00038 };
00039
00040 CalCoreMaterial();
00041 CalCoreMaterial( const CalCoreMaterial& inOther );
00042
00043 protected:
00044 ~CalCoreMaterial() { }
00045
00046 public:
00047 const Color& getAmbientColor() const;
00048 const Color& getDiffuseColor() const;
00049 int getMapCount() const;
00050 const std::string& getMapFilename(int mapId) const;
00051 const std::string& getMapType(int mapId);
00052 Cal::UserData getMapUserData(int mapId);
00053 const Cal::UserData getMapUserData(int mapId) const;
00054 float getShininess() const;
00055 const Color& getSpecularColor() const;
00056 Cal::UserData getUserData();
00057 const Cal::UserData getUserData() const;
00058 std::vector<Map>& getVectorMap();
00059 const std::vector<Map>& getVectorMap() const;
00060 bool reserve(int mapCount);
00061 void setAmbientColor(const Color& ambientColor);
00062 void setDiffuseColor(const Color& diffuseColor);
00063 bool setMap(int mapId, const Map& map);
00064 bool setMapUserData(int mapId, Cal::UserData userData);
00065 void setShininess(float shininess);
00066 void setSpecularColor(const Color& specularColor);
00067 void setFilename(const std::string& filename);
00068 const std::string& getFilename(void) const;
00069 void setName(const std::string& name);
00070 const std::string& getName(void) const;
00071 void setUserData(Cal::UserData userData);
00072 bool getAlphaBlending() { return false; }
00073 bool getTwoSided() { return getMapCount() > 1; }
00074 bool getSelfIllumination() { return false; }
00075
00076 private:
00077 Color m_ambientColor;
00078 Color m_diffuseColor;
00079 Color m_specularColor;
00080 float m_shininess;
00081 std::vector<Map> m_vectorMap;
00082 Cal::UserData m_userData;
00083 std::string m_name;
00084 std::string m_filename;
00085 };
00086 typedef cal3d::RefPtr<CalCoreMaterial> CalCoreMaterialPtr;
00087
00088 #endif
00089
00090