H3D API
2.4.1
|
SFImage is overridden to update the value from the url and imageLoader fields of the Image3DTexture. More...
#include <H3D/Image3DTexture.h>
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. | |
Image * | loadImage (Image3DTexture *texture, const vector< string > &urls, const NodeVector &image_loader) |
Tries to create an image. More... | |
![]() | |
void | checkFieldType (Field *f, int index) |
Function for checking that a field is of a correct type given type specification according to the TypedField template arguments. More... | |
void | checkTemplateArguments () |
Function for checking that a field given TypedField type specification is valid. More... | |
![]() | |
virtual void | onAdd (Image *n) |
This function will be called when the value of RefCountSField changes. More... | |
virtual void | onRemove (Image *n) |
This function will be called when the value of RefCountSField changes. More... | |
![]() | |
virtual void | startEvent () |
Start a new event from this field. More... | |
virtual void | propagateEvent (Event e) |
Propagates an event to all Fields we are routed to. More... | |
virtual void | routeFrom (Field *, int id) |
Set up a route to this field from the field given as argument. | |
virtual void | unrouteFrom (Field *) |
Remove the route to this field from the field given as argument. | |
virtual Field * | replaceRouteFrom (Field *f, unsigned int i, int id) |
Replace the i:th route to this field with the field given as argument. | |
void | checkAccessTypeRoute (Field *f, int id) |
Check the access type is correct for performing a route from this field to f. More... | |
void | checkAccessTypeRouteFrom (Field *f, int id) |
Check the access type is correct for performing a route from f to this field. More... | |
void | checkAccessTypeGet (int id) |
Check the access type is valid for getting the value of a field. More... | |
void | checkAccessTypeSet (int id) |
Check the access type is valid for changing the value of a field. More... | |
int | ownerId () |
Gets the id of the owner node, -1 if no owner. | |
bool | isProgramSetting () |
Returns true if this field is part of program settings fields. More... | |
void | markProgramSetting (bool used_as_setting) |
Set it this field is used by program settings fields in scene or not. | |
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. | |
![]() | |
RefCountSFieldAutoRef | value |
The encapsulated value. | |
![]() | |
string | name |
The name of the field. | |
bool | event_lock |
If true, stops events from being propagated. More... | |
bool | update_lock |
If true, stops the update() function from being called in the upToDate() function. | |
FieldSet | routes_out |
The Fields that this field is routed to. | |
FieldVector | routes_in |
The Field that are routed to this field. | |
Event | event |
The last event that happened. | |
Node * | owner |
The node that contain this field. More... | |
AccessType | access_type |
The type of access to the field. | |
bool | access_check_on |
If true, access type checks will be done when getting/setting values and setting up routes. More... | |
Additional Inherited Members | |
![]() | |
typedef Image | typed_class_type |
The same as class_type, but if e.g. More... | |
typedef Image * | typed_value_type |
The same as value_type, but if e.g. More... | |
typedef Image | class_type |
The type of which this field contains a pointer to. | |
typedef Image * | value_type |
The type of the value in this field. | |
![]() | |
enum | AccessType { INITIALIZE_ONLY , OUTPUT_ONLY , INPUT_ONLY , INPUT_OUTPUT } |
The different access types that a field can have. More... | |
![]() | |
virtual void | setValueFromString (const string &s) |
Set the value of the field given a string. More... | |
virtual string | getValueAsString (const string &separator=" ") |
Get the value of the field as a string. More... | |
virtual X3DTypes::X3DType | getX3DType () |
Returns the X3DType of the field. | |
![]() | |
SFImage () | |
Constructor. | |
virtual void | beginEditing () |
Call this function before doing any calls to any setPixel functions in order to record all the changes to the image. | |
virtual void | endEditing () |
Call this function after doing editing to the image in order to send an event that editing has been done. More... | |
void | setEditedArea (int _min_x, int _min_y, int _min_z, int _max_x, int _max_y, int _max_z) |
Set the volume that has been edited manually. | |
virtual void | setPixel (unsigned int x, unsigned int y, const RGBA &color) |
Set a pixel in the image. More... | |
virtual void | setPixel (const Vec2f &tex_coord, const RGBA &color) |
Set a pixel in the image specified by a texture coordinate. More... | |
virtual void | setPixel (unsigned int x, unsigned int y, unsigned int z, const RGBA &color) |
Set a pixel in the image. More... | |
virtual void | setPixel (const Vec3f &tex_coord, const RGBA &color) |
Set a pixel in the image specified by a texture coordinate. More... | |
int | xMin () |
Returns the minimum value in x that has been changed by the setPixel functions. More... | |
int | yMin () |
Returns the minimum value in y that has been changed by the setPixel functions. More... | |
int | zMin () |
Returns the minimum value in z that has been changed by the setPixel functions. More... | |
int | xMax () |
Returns the maximum value in x that has been changed by the setPixel functions. More... | |
int | yMax () |
Returns the maximum value in y that has been changed by the setPixel functions. More... | |
int | zMax () |
Returns the maximum value in z that has been changed by the setPixel functions. More... | |
int | xOffset () |
Returns the offset in x of the changed part of the image. More... | |
int | yOffset () |
Returns the offset in y of the changed part of the image. More... | |
int | zOffset () |
Returns the offset in z of the changed part of the image. More... | |
int | changedWidth () |
Returns the width of the changed part of the image. More... | |
int | changedHeight () |
Returns the height of the changed part of the image. More... | |
int | changedDepth () |
Returns the depth of the changed part of the image. More... | |
bool | imageChanged () |
Returns true if the image has been updated with the setPixel functions. | |
void | resetChanges () |
Resets all variables that keep track of what part of the image has been updated. | |
![]() | |
RefCountSField () | |
Constructor. Default value of value is NULL. | |
RefCountSField (Image *_value) | |
Constructor. | |
virtual void | setValue (const AutoRef< Image > &n, int id=0) |
Set the value of the field. | |
virtual void | setValue (Image *n, int id=0) |
Set the value of the field. | |
virtual Image * | getValue (int id=0) |
Get the value of the field. | |
![]() | |
Field () | |
Constructor. | |
virtual | ~Field () |
Destructor. | |
void | setName (string _name) |
Sets local the name of the field. Will be used in error reporting. | |
string | getName () |
Gets the name of the field. | |
string | getFullName () |
Get the full name of the field including the name of the owner node if it exists (ownername.fieldname). More... | |
virtual string | getTypeName () |
Returns a string name for this field type. | |
virtual void | route (Field *, int id=0) |
Set up a route from this field to the field given as argument. More... | |
virtual void | routeNoEvent (Field *, int id=0) |
Set up a route from this field to the field given as argument. More... | |
virtual void | unroute (Field *) |
Remove the route from this field to the field given as argument. | |
virtual Field * | replaceRoute (Field *f, unsigned int i, int id=0) |
Replace the i:th route to f with a route from this field. More... | |
virtual Field * | replaceRouteNoEvent (Field *f, unsigned int i, int id=0) |
Replace the i:th route to f with a route from this field. More... | |
template<class F > | |
void | route (H3DUniquePtr< F > &f, int id=0) |
Set up a route from this field to the field residing in the H3DUniquePtr given as argument. More... | |
template<class F > | |
void | routeNoEvent (H3DUniquePtr< F > &f, int id=0) |
Set up a route from this field to the field residing in the H3DUniquePtr given as argument. More... | |
template<class F > | |
void | unroute (H3DUniquePtr< F > &f) |
Remove the route from this field to the field residing in the H3DUniquePtr given as argument. | |
void | unrouteAll () |
Remove all the routes from this field. | |
virtual void | upToDate () |
Check that the field is up-to-date, if not update() is called to make it up-to-date. | |
bool | isUpToDate () |
Returns true if the field is up to date, i.e. More... | |
virtual void | touch () |
Generates an event from this field. | |
Node * | getOwner () |
Get the Node that contains this field. | |
void | setOwner (Node *n) |
Set the Node that contains this field. | |
void | setAccessType (AccessType _access_type) |
Set the access type of the field. | |
AccessType | getAccessType () |
Get the access type of the field. | |
bool | routesTo (Field *f) |
Returns true if this field is routed to the field given as argument. | |
bool | hasRouteFrom (Field *f) |
Returns true if the field given as argument is routed to this field. | |
const FieldVector & | getRoutesIn () |
Get the Fields that are routed to this Field. | |
const FieldSet & | getRoutesOut () |
Get the Fields this Field is routed to. | |
const Event & | getLatestEvent () |
Get the latest event. | |
void | setAccessCheck (bool on) |
Set access type checking on or off. More... | |
bool | isAccessCheckOn () |
Returns true if checking of access types is on. | |
![]() | |
static string | classTypeName () |
Returns a string name for this field type. More... | |
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.
|
protected |
Tries to create an image.
All urls are tested against 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(), H3DUtil::RefCountedClass::getName(), H3D::Field::getOwner(), H3D::H3DImageLoaderNode::getSupportedFileReader(), H3D::H3DImageLoaderNode::loadImage(), H3DUtil::ResourceResolver::releaseTmpFileName(), H3D::X3DUrlObject::resolveURLAsFile(), H3DUtil::ResourceResolver::resolveURLAsString(), H3D::X3DUrlObject::setURLUsed(), and H3DUtil::AutoRefVector< class >::size().
Referenced by loadImageThreadFunc().