Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoExtTexture2.h
Go to the documentation of this file.
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-2014 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
32
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;
57
59
179class SoExtTexture2 : public SoTexture {
180
182
183 SO_PIMPL_PUBLIC_HEADER(SoExtTexture2);
184
185 public:
189 typedef void SoExtTexture2CB(void *userData, SoExtTexture2 *tex);
190
192 enum Sync
193 {
198
203 };
204
206 enum Loading {
210 AUTO = 0,
211
215 MANUAL
216 };
217
231
238
244
250
256
262
267
281 static void setPrequalifyFileCallBack(ExtPrequalifyFileCallback *p_cb, void *u_data);
282
287
292 void getImageSize(SbVec2s &size, int &nc);
293
298 static void setMemorySpace(double megaBytes);
299
304 static double getMemorySpace();
305
309 static double getGlobalMemoryUsed();
310
319 static void useTexturePalette(SbBool value);
320
321 // Load callbacks
322
327 void addOnLoadStartCB(SoExtTexture2CB* cb, void* userData);
328
333 void addOnLoadFinishCB(SoExtTexture2CB* cb, void* userData);
334
340 void addOnUnloadCB(SoExtTexture2CB* cb, void* userData);
341
342 // Manual loading
343
348
349 private:
350 virtual void doAction(SoAction *action);
351 virtual void GLRender(SoGLRenderAction *action);
352 virtual void write(SoWriteAction* action);
353
354 private:
355
356 static void initClass();
357 static void exitClass();
358
359 // Get system time at last traversal
360 SoSFTime sysTime;
361
362 // Manages field dependencies, when one of them change
363 virtual void fieldHasChanged( SoField *field ); // override of SoFieldContainer
364
365 virtual void copyContents(const SoFieldContainer *fromFC,
366 SbBool copyConnections);
367
368 private:
369
370 // Reads stuff into instance. Returns FALSE on error.
371 virtual SbBool readInstance(SoInput *in, unsigned short flags);
372
373 virtual ~SoExtTexture2();
374
375
376};
377
378#ifdef _MSC_VER
379#pragma warning( pop )
380#endif
381
382#endif /* _SO_EXTTEXTURE_2_ */
383
SO_PIMPL_PUBLIC_DECLARATION(SoExtTexture2)
SbBool ExtPrequalifyFileCallback(const SbString &, void *, SoExtTexture2 *)
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
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.
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:97
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
size_t size() const