H3D API  2.4.1
Image3DTexture.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __IMAGE3DTEXTURE_H__
30 #define __IMAGE3DTEXTURE_H__
31 
32 #include <H3D/X3DTexture3DNode.h>
33 #include <H3D/H3DImageLoaderNode.h>
34 #include <H3D/X3DUrlObject.h>
35 #include <H3D/MFNode.h>
36 #include <H3D/Scene.h>
37 
38 namespace H3D {
57  class H3DAPI_API Image3DTexture :
58  public X3DTexture3DNode,
59  public X3DUrlObject {
60  public:
61 
65 
68 
86  //
90  class H3DAPI_API SFImage:
91  public TypedField< X3DTexture3DNode::SFImage,
92  Types< MFString, MFImageLoader > > {
93  protected:
96  virtual void update();
97 
101  Image * loadImage( Image3DTexture *texture,
102  const vector< string > &urls,
103  const NodeVector &image_loader );
104 
106  struct ThreadFuncData {
107  Image3DTexture *texture;
108  vector< string > urls;
109  NodeVector image_loaders;
110  MutexLock load_thread_mutex;
111  };
112 
114  struct CBData {
115  CBData():texture(NULL), image(NULL){}
116  Image3DTexture *texture;
117  Image *image;
118  };
119 
122 
125 
128  static Scene::CallbackCode loadImageCB( void *data );
129 
132  static void *loadImageThreadFunc( void * );
133  public:
134  virtual ~SFImage();
135  };
136 
138  Image3DTexture( Inst< DisplayList > _displayList = 0,
139  Inst< SFNode > _metadata = 0,
140  Inst< MFString > _url = 0,
141  Inst< SFBool > _repeatS = 0,
142  Inst< SFBool > _repeatT = 0,
143  Inst< SFBool > _repeatR = 0,
144  Inst< SFBool > _scaleToP2 = 0,
145  Inst< SFImage > _image = 0,
146  Inst< MFImageLoader > _imageLoader = 0,
147  Inst< SFTextureProperties > _textureProperties = 0,
148  Inst< SFString > _loadInThread= 0 );
149 
151  virtual void render();
152 
159  H3DUniquePtr< MFImageLoader > imageLoader;
160 
172  H3DUniquePtr< SFString > loadInThread;
173 
176 
177  protected:
180  H3DUniquePtr< H3DUtil::SimpleThread > load_thread;
181  };
182 }
183 
184 #endif
Header file for H3DImageLoaderNode, the abstract base class for all image loaders nodes for different...
Contains the MFNode class.
Header file for Scene.
Header file for X3DTexture3DNode, X3D scene-graph node.
Header file for X3DUrlObject, X3D scene-graph node.
CouldNotLoadImage is thrown when not any of the urls could be read with any of the image loaders in a...
Definition: Image3DTexture.h:64
SFImage is overridden to update the value from the url and imageLoader fields of the Image3DTexture.
Definition: Image3DTexture.h:92
CBData cb_data
data used for the callback function.
Definition: Image3DTexture.h:124
ThreadFuncData thread_data
data used for the thread function
Definition: Image3DTexture.h:121
The Image3DTexture node defines a texture map by specifying a single file that contains complete 3D d...
Definition: Image3DTexture.h:59
H3DUniquePtr< MFImageLoader > imageLoader
The ImageLoader nodes to use to read the image files.
Definition: Image3DTexture.h:159
H3DUniquePtr< SFString > loadInThread
Specifies the thread to use to load the image texture.
Definition: Image3DTexture.h:172
H3DUniquePtr< H3DUtil::SimpleThread > load_thread
The thread used for downloading images when load_images_in_separate_thread is true.
Definition: Image3DTexture.h:180
TypedMFNode< H3DImageLoaderNode > MFImageLoader
A MFNode containing ImageLoader.
Definition: Image3DTexture.h:67
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: Image3DTexture.h:175
CallbackCode
Return code for callback functions.
Definition: Scene.h:228
A template modifier class for adding type checking on the routes to any Field class.
Definition: TypedField.h:84
Template to make sure that the Nodes that are added to a MFNode are of a specified Node type.
Definition: MFNode.h:221
This abstract node type is the base type for all node types which specify 3D sources for texture imag...
Definition: X3DTexture3DNode.h:46
This abstract interface is inherited by all nodes that contain data located on the World Wide Web,...
Definition: X3DUrlObject.h:51
H3D_API_EXCEPTION(Vec2dNormalizeError)
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194
struct for storing input needed for the callback function.
Definition: Image3DTexture.h:114
struct for storing input needed to the thread function
Definition: Image3DTexture.h:106