Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoExtTexture2.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : C. OGNIER (Oct 2000)
22**=======================================================================*/
23
24#ifndef _SO_EXTTEXTURE_2_
25#define _SO_EXTTEXTURE_2_
26
27#include <Inventor/nodes/SoTexture.h>
28#include <Inventor/fields/SoSFInt32.h>
29#include <Inventor/fields/SoSFFilePathString.h>
30#include <Inventor/fields/SoSFTime.h>
31#include <Inventor/threads/SbThreadStorage.h>
32
33#include <Inventor/image/SbRasterImage.h>
34#include <Inventor/sys/SoGLType.h>
35
36class SoSensor;
37class SoDither;
38
39#ifdef _MSC_VER
40#pragma warning( push )
41#pragma warning(disable:4251)
42#endif
43
45//
46// Class: SoExtTexture2
47//
48// Extented 2D Texture node.
49//
51
52class SoExtTexture2;
59
60SO_PIMPL_PUBLIC_DECLARATION(SoExtTexture2);
61
181class SoExtTexture2 : public SoTexture {
182
183 SO_NODE_HEADER(SoExtTexture2);
184
185 SO_PIMPL_PUBLIC_HEADER(SoExtTexture2);
186
187 public:
191 typedef void SoExtTexture2CB(void *userData, SoExtTexture2 *tex);
192
194 enum Sync
195 {
200
205 };
206
208 enum Loading {
212 AUTO = 0,
213
217 MANUAL
218 };
219
233
240
246
252
258
264
269
283 static void setPrequalifyFileCallBack(ExtPrequalifyFileCallback *p_cb, void *u_data);
284
289
294 void getImageSize(SbVec2s &size, int &nc);
295
300 static void setMemorySpace(double megaBytes);
301
306 static double getMemorySpace();
307
311 static double getGlobalMemoryUsed();
312
321 static void useTexturePalette(SbBool value);
322
323 // Load callbacks
324
329 void addOnLoadStartCB(SoExtTexture2CB* cb, void* userData);
330
335 void addOnLoadFinishCB(SoExtTexture2CB* cb, void* userData);
336
342 void addOnUnloadCB(SoExtTexture2CB* cb, void* userData);
343
344 // Manual loading
345
350
351 private:
352 virtual void doAction(SoAction *action);
353 virtual void GLRender(SoGLRenderAction *action);
354 virtual void write(SoWriteAction* action);
355
356 private:
357
358 static void initClass();
359 static void exitClass();
360
361 // Get system time at last traversal
362 SoSFTime sysTime;
363
364 // Manages field dependencies, when one of them change
365 virtual void fieldHasChanged( SoField *field ); // override of SoFieldContainer
366
367 virtual void copyContents(const SoFieldContainer *fromFC,
368 SbBool copyConnections);
369
370 private:
371
372 // Reads stuff into instance. Returns FALSE on error.
373 virtual SbBool readInstance(SoInput *in, unsigned short flags);
374
375 virtual ~SoExtTexture2();
376
377
378};
379
380#ifdef _MSC_VER
381#pragma warning( pop )
382#endif
383
384#endif /* _SO_EXTTEXTURE_2_ */
385
Class for smart character strings.
Definition SbString.h:202
2D vector class.
Definition SbVec.h:700
Abstract base class for all actions.
Definition SoAction.h:132
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Extended texture...
SoSFBool loadingStatus
Tells if the texture is loaded or not (not necessarily displayed)
SoSFEnum loadingMode
Specifies the loading mode.
static void useTexturePalette(SbBool value)
If TRUE, uses a 256-color-indexed palette.
static void setPrequalifyFileCallBack(ExtPrequalifyFileCallback *p_cb, void *u_data)
This callback is called by SoExtTexture2 nodes just before opening a file with the proposed path.
Loading
Loading mode.
@ AUTO
The texture is loaded at the node's traversal.
@ MANUAL
The texture is loaded by the user using the loadTexture method.
static double getGlobalMemoryUsed()
Return the current system memory used by all texture images.
Sync
Synchrone/asynchrone loading mode.
@ SYNCHRONOUS
The loading is blocking (no thread launched).
@ ASYNCHRONOUS
The loading is non blocking (the loading is done within a thread).
void addOnUnloadCB(SoExtTexture2CB *cb, void *userData)
Callback invoked when the texture is unloaded.
void allowPrequalifyFile(SbBool)
If TRUE, allows the PrequalifyFile callback to be called.
SoSFInt32 loadingThreadPriority
Specifies the priority of the texture loading thread when activated (syncMode = ASYNCHRONOUS).
SoSFEnum wrapT
Indicates what to do when texture coordinates in the T (vertical) direction lie outside the range 0-1...
SoSFEnum syncMode
Specifies the synchronous/asynchronous mode.
SoExtTexture2()
Creates a texture node with default settings.
void getImageSize(SbVec2s &size, int &nc)
Returns the size and the number of components in the image.
void loadTexture()
Loads the texture if the loading mode is set to MANUAL.
static double getMemorySpace()
Gets the system memory space allowed for the texture images.
static void setMemorySpace(double megaBytes)
Sets the system memory space allowed for the texture images.
void addOnLoadStartCB(SoExtTexture2CB *cb, void *userData)
Callback invoked when starting loading the texture.
SoSFFilePathString filename
Names file from which to read texture image.
SbBool ExtPrequalifyFileCallback(const SbString &, void *, SoExtTexture2 *)
void addOnLoadFinishCB(SoExtTexture2CB *cb, void *userData)
Callback invoked when the texture is loaded and ready to use.
void SoExtTexture2CB(void *userData, SoExtTexture2 *tex)
Abstract base class for objects that contain fields.
Base class for all fields.
Definition SoField.h:234
Renders a scene graph using Open Inventor's Render Engine.
Used to read Open Inventor data files.
Definition SoInput.h:363
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an enumerated value.
Definition SoSFEnum.h:89
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Field containing...
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Field containing an SbTime.
Definition SoSFTime.h:82
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
Abstract base class for texture mapping nodes.
Definition SoTexture.h:155
Writes a scene graph to a file.
int SbBool
Boolean type.
Definition SbBase.h:87