H3D::Image3DTexture::SFImage Class Reference

SFImage is overridden to update the value from the url and imageLoader fields of the Image3DTexture. More...

#include <H3D/Image3DTexture.h>

Inheritance diagram for H3D::Image3DTexture::SFImage:

Inheritance graph

List of all members.

Classes

struct  CBData
 struct for storing input needed for the callback function. More...
struct  ThreadFuncData
 struct for storing input needed to the thread function More...

Protected Member Functions

virtual void update ()
 Updates the value from the url and imageLoader fields of the Image3DTexture.
ImageloadImage (Image3DTexture *texture, const vector< string > &urls, const NodeVector &image_loader)
 Tries to create an image.

Static Protected Member Functions

static Scene::CallbackCode loadImageCB (void *data)
 Callback function for setting the image field when thread has finished downloading.
static void * loadImageThreadFunc (void *)
 Function to use in the thread for downloading and creating an Image object.

Protected Attributes

ThreadFuncData thread_data
 data used for the thread function
CBData cb_data
 data used for the callback function.


Detailed Description

SFImage is overridden to update the value from the url and imageLoader fields of the Image3DTexture.

Each url is tried with all ImageLoader and the first one that is successful is the one that is used.

If X3DTextureNode::load_images_in_separate_thread is true, the image field will not be set directly. Instead it will be set to NULL, and the image downloaded and created in a separate thread. When it has been created a callback function is set to execute with Scene::setCallback that sets the image field to the new image. This allows the program to continue to execute and run without textures while the textures are loaded and the textures will then be applied as they are available.

If X3DTextureNode::load_images_in_separate_thread is false the image will be updated directly and the program has to wait for it to download if it is not available. routes_in[0] is the url field. routes_in[1] is the imageLoader field.


Member Function Documentation

Image * Image3DTexture::SFImage::loadImage ( Image3DTexture texture,
const vector< string > &  urls,
const NodeVector image_loader 
) [protected]

Tries to create an image.

All urls are tested agains all image loaders until one that works is found. Returns NULL if it could not load the image, and the new image on success.

References H3DUtil::AutoRefVector< class >::begin(), H3DUtil::AutoRefVector< class >::end(), H3D::H3DImageLoaderNode::getSupportedFileReader(), H3D::H3DImageObject::image, H3D::ResourceResolver::releaseTmpFileName(), H3D::X3DUrlObject::resolveURLAsFile(), H3D::X3DUrlObject::setURLUsed(), H3DUtil::AutoRefVector< class >::size(), and H3D::X3DUrlObject::url.

Referenced by update().

void * Image3DTexture::SFImage::loadImageThreadFunc ( void *  data  )  [static, protected]


The documentation for this class was generated from the following files:

Generated on Fri Nov 7 10:30:20 2008 for H3D API by  doxygen 1.5.7