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 _SO_IMAGE_BACKGROUND_H_
00025 #define _SO_IMAGE_BACKGROUND_H_
00026
00027 #include <Inventor/fields/SoSFFilePathString.h>
00028 #include <Inventor/fields/SoSFEnum.h>
00029 #include <Inventor/fields/SoSFImage.h>
00030 #include <Inventor/SbString.h>
00031
00032 #include <Inventor/nodes/SoBackground.h>
00033 #include <Inventor/caches/SoGLTexCacheList.h>
00034 #include <Inventor/threads/SbThreadStorage.h>
00035
00036 class SoFieldSensor;
00037 class SbThreadRWMutex;
00038 class SbRasterImage;
00039
00040 #ifdef _MSC_VER
00041 #pragma warning( push )
00042 #pragma warning(disable:4251)
00043 #endif
00044
00096 class SoImageBackground : public SoBackground {
00097
00098 SO_NODE_HEADER(SoImageBackground);
00099
00100 public:
00101
00103 enum Style {
00107 NONE ,
00112 CENTER ,
00117 LOWER_LEFT ,
00122 UPPER_LEFT ,
00127 UPPER_RIGHT,
00132 LOWER_RIGHT,
00137 STRETCH ,
00142 TILE ,
00148 CROP ,
00154 FIT
00155 };
00156
00157
00158
00170 SoSFFilePathString filename;
00171
00178 SoSFImage image;
00179
00184 SoSFEnum style;
00185
00189 SoImageBackground();
00190
00191 private:
00192
00193
00194
00195 static void initClass();
00196 static void exitClass();
00197
00198 private:
00199
00200
00201
00202
00203 virtual void GLRender(SoGLRenderAction *action);
00204
00205 private:
00206
00207
00208 virtual ~SoImageBackground();
00209
00210
00211 virtual SbBool readInstance(SoInput *in, unsigned short flags);
00212
00213 int getReadStatus() const { return readStatus; }
00214 void setReadStatus(int s) { readStatus = s; }
00215
00216 private:
00217
00218 SoFieldSensor *imageSensor;
00219 static void imageChangedCB(void *, SoSensor *);
00220 SoFieldSensor *filenameSensor;
00221 static void filenameChangedCB(void *, SoSensor *);
00222
00223
00224 SbThreadStorage< SoGLTexCacheList* > m_texList;
00225 SbThreadRWMutex* m_mutex;
00226
00227 int readStatus;
00228
00229 SbRasterImage* m_rasterImage;
00230
00231 int m_numRenderCaches;
00232 };
00233
00234 #ifdef _MSC_VER
00235 #pragma warning( pop )
00236 #endif
00237
00238 #endif //SoImageBackground
00239
00240