00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef MAYA_TEXTURE_H_
00026 #define MAYA_TEXTURE_H_
00027
00028 namespace LampForMaya{
00029
00030
00031
00032
00033
00034 class MayaTexture{
00035 friend class MayaTextureManager;
00036 public:
00037
00038
00039
00040
00041 virtual bool load();
00042
00043
00044
00045
00046
00047 virtual bool bind();
00048
00049
00050
00051
00052
00053 virtual const String& getName() const{ return name_; }
00054
00055
00056
00057
00058
00059
00060 virtual u_int getWidth(int level = 0) const{
00061 u_int width = width_ >> level;
00062 if(width > 0){ return width; }
00063 return 1;
00064 }
00065
00066
00067
00068
00069
00070
00071 virtual u_int getHeight(int level = 0) const{
00072 u_int height = height_ >> level;
00073 if(height > 0){ return height; }
00074 return 1;
00075 }
00076
00077 protected:
00078
00079
00080
00081
00082
00083 MayaTexture(const MObject& node, const String& name);
00084
00085
00086
00087
00088 virtual ~MayaTexture();
00089
00090
00091
00092
00093 virtual void clear();
00094
00095
00096
00097
00098
00099
00100 u_int highestPowerOf2(u_int number) const{
00101 int power = 0;
00102 while(number > 1){
00103 power++;
00104 number >>= 1;
00105 }
00106 return power;
00107 }
00108
00109 private:
00110
00111 MayaTexture(const MayaTexture& copy);
00112
00113
00114 void operator =(const MayaTexture& copy);
00115
00116
00117 MObject node_;
00118
00119 String name_;
00120
00121 u_int textureID_;
00122
00123 u_char** images_;
00124
00125 int mipmapLevel_;
00126
00127 u_int width_;
00128
00129 u_int height_;
00130
00131 MCallbackId renameCallbackID_;
00132
00133 MCallbackId dirtyCallbackID_;
00134
00135 bool loaded_;
00136
00137
00138 static const int bytesPerPixel_ = 4;
00139 };
00140
00141
00142 }
00143 #endif // End of MAYA_TEXTURE_H_
00144
00145