00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef SBTVIZTEXTURE_H
00025 #define SBTVIZTEXTURE_H
00026
00027 #include <Inventor/SbLinear.h>
00028 #include <Inventor/SbString.h>
00029 #include <Inventor/sys/SoGLType.h>
00030
00031 class Array2D;
00032 class Array2Duchar;
00033 class SoDEPRECATED SbTVizTexture {
00083
00084 public :
00088 SbTVizTexture();
00092 virtual ~SbTVizTexture();
00096 SbBool loadTextureFile(const char* fileName, int level, const SbVec2s& position, const SbVec2s& borders = SbVec2s(0, 0));
00097
00102 inline const SbString& getFileName() const {return (m_fileName);};
00106 inline int getLevel() const {return (m_level);};
00110 inline const SbVec2s& getPosition() const {return (m_position);};
00114 inline const SbVec2s& getSize() const {return (m_size);};
00118 inline int getNumComponents() const {return (m_nc);};
00119
00125 inline const SbVec2s& getBorders() const {return (m_borders);};
00126
00127
00136 void setValues(const SbVec2s& size, int nc, int level, const SbVec2s& position, const SbVec2s& borders, const unsigned char *bytes);
00144 const unsigned char* getValues(SbVec2s& size, int& nc) const;
00145
00146
00151 SbBool writeTextureFile(const SbString& filename);
00152
00156 enum FileType { UNKNOWN, RGB,
00157 SGI, TIFF,
00158 GIF, JPEG,
00159 BMP, PNG,
00160 NUM_FILETYPES };
00161
00165 inline void setBitmapFileType(FileType in_type);
00166
00170 inline FileType getBitmapFileType(void) { return UNKNOWN; };
00171
00172 private:
00173
00174 enum Orientation {
00175 NW = 0,
00176 NE,
00177 SW,
00178 SE
00179 };
00180
00181 Orientation orientation;
00182 GLuint texName;
00183 SbBool isAvailable;
00184
00185 inline const GLfloat* getParamS(){return (m_paramS);};
00186 inline const GLfloat* getParamT(){return (m_paramT);};
00187 void setParamS(SbVec4f& s);
00188 void setParamT(SbVec4f& t);
00189
00190 void freeBufferValues();
00191 const unsigned char* getBufferValues(int nc);
00192 Array2Duchar* getBuffer(int& nc);
00193 inline void setIndex(int index) {m_index = index;};
00194 inline int getIndex() {return m_index;};
00195 inline void setLevelIndex(int index) {m_levelIdx = index;};
00196 inline int getLevelIndex() {return m_levelIdx;};
00197 void setPosition(SbVec2s pos);
00198 SbVec3s getNeighbours(Orientation ori);
00199
00200
00201 void rotate(double angle);
00202
00203
00204
00205 private :
00206
00207 SbVec2s m_position;
00208 SbVec2s m_size;
00209 SbVec2s m_borders;
00210 int m_nc;
00211 int m_index;
00212 int m_levelIdx;
00213 int m_level;
00214
00215 SbString m_fileName;
00216
00217 Array2Duchar* m_texData;
00218
00219 GLfloat m_paramS[4];
00220 GLfloat m_paramT[4];
00221 };
00222
00223
00224 inline void
00225 SbTVizTexture::setBitmapFileType(FileType)
00226 {}
00227
00228
00229 #endif
00230
00231