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 COIN_SOVRMLIMAGETEXTURE_H
00025 #define COIN_SOVRMLIMAGETEXTURE_H
00026
00027 #include <Inventor/nodes/SoSubNode.h>
00028 #include <Inventor/VRMLnodes/SoVRMLTexture.h>
00029 #include <Inventor/fields/SoMFString.h>
00030 #include <Inventor/SbImage.h>
00031
00032 class SoVRMLImageTexture;
00033 class SoSensor;
00034 class SbImage;
00035
00036 typedef SbBool VRMLPrequalifyFileCallback(const SbString &, void *,
00037 SoVRMLImageTexture *);
00038
00039 class COIN_DLL_API SoVRMLImageTexture : public SoVRMLTexture
00040 {
00041 typedef SoVRMLTexture inherited;
00042 SO_NODE_HEADER(SoVRMLImageTexture);
00043
00044 public:
00045 static void initClass(void);
00046 SoVRMLImageTexture(void);
00047
00048 SoMFString url;
00049
00050 static void setDelayFetchURL(const SbBool onoff);
00051 static void setPrequalifyFileCallBack(VRMLPrequalifyFileCallback * cb,
00052 void * closure);
00053 void allowPrequalifyFile(SbBool enable);
00054
00055 virtual void doAction(SoAction * action);
00056 virtual void GLRender(SoGLRenderAction * action);
00057 virtual void callback(SoCallbackAction * action);
00058 virtual void rayPick(SoRayPickAction * action);
00059
00060 void setImage(const SbImage & image);
00061 const SbImage * getImage(void) const;
00062
00063 static void setImageDataMaxAge(const uint32_t maxage);
00064
00065 protected:
00066 virtual ~SoVRMLImageTexture();
00067
00068 virtual SbBool readInstance(SoInput * in, unsigned short flags);
00069 int getReadStatus(void) const;
00070 void setReadStatus(int status);
00071
00072 private:
00073
00074 SbBool readImage(const SbString & filename);
00075 SbBool loadUrl(void);
00076 class SoVRMLImageTextureP * pimpl;
00077 static void urlSensorCB(void *, SoSensor *);
00078 static void glimage_callback(void * closure);
00079 static SbBool image_read_cb(const SbString &, SbImage *, void *);
00080 static void read_thread(void * closure);
00081 static SbBool default_prequalify_cb(const SbString & url, void * closure,
00082 SoVRMLImageTexture * node);
00083 static void oneshot_readimage_cb(void *, SoSensor *);
00084
00085 };
00086
00087 #endif // ! COIN_SOVRMLIMAGETEXTURE_H