Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoTexture2.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : John Rohlf (MMM yyyy)
25** Modified by : Thad Beier (MMM yyyy)
26** Modified by : Gavin Bell (MMM yyyy)
27**=======================================================================*/
28/*=======================================================================
29 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
30 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
31 *** ***
32 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
33 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
34 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
35 *** ***
36 *** RESTRICTED RIGHTS LEGEND ***
37 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
38 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
39 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
40 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
41 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
42 *** ***
43 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
44 *** BORDEAUX, FRANCE ***
45 *** ALL RIGHTS RESERVED ***
46**=======================================================================*/
47/*=======================================================================
48** Modified by : VSG (MMM YYYY)
49**=======================================================================*/
50
51
52#ifndef _SO_TEXTURE_2_
53#define _SO_TEXTURE_2_
54
55#include <Inventor/fields/SoSFColor.h>
56#include <Inventor/fields/SoSFEnum.h>
57#include <Inventor/fields/SoSFImage.h>
58#include <Inventor/fields/SoSFFilePathString.h>
59#include <Inventor/fields/SoSFNode.h>
60#include <Inventor/fields/SoSFBool.h>
61#include <Inventor/nodes/SoNode.h>
62#include <Inventor/nodes/SoTexture.h>
63#include <Inventor/image/SbRasterImage.h>
64
65#include <Inventor/sys/SoGLType.h>
66#include <Inventor/threads/SbThreadStorage.h>
67#include <Inventor/threads/SbThreadMutex.h>
68#include <Inventor/elements/SoTextureImageElement.h>
69
70class SoSensor;
71
72#ifdef _MSC_VER
73#pragma warning( push )
74#pragma warning(disable:4251)
75#endif
76
78//
79// Class: SoTexture2
80//
81// Texture node.
82//
84
85class SoTexture2;
86typedef SbBool PrequalifyFileCallback(const SbString &, void *, SoTexture2 *);
87
88SO_PIMPL_PUBLIC_DECLARATION(SoTexture2);
89
261class SoTexture2 : public SoTexture {
262
263 SO_NODE_HEADER(SoTexture2);
264
265 SO_PIMPL_PUBLIC_HEADER(SoTexture2);
266
267 public:
268
272 typedef void SoTexture2CB(void *userData, SoTexture2 *tex);
273
275 enum Loading {
279 AUTO = 0,
280
284 MANUAL
285 };
286
300
309
316
324
325
338
343 void setStartLoadingCallback(SoTexture2CB* cb, void* userData);
344
349 void setFinishLoadingCallback(SoTexture2CB* cb, void* userData);
350
351 // Manual loading
352
381
386
387 private:
388 virtual void doAction(SoAction *action);
389 virtual void GLRender(SoGLRenderAction *action);
390 virtual void callback(SoCallbackAction *action);
391 virtual void doActionOnRTT(SoAction *action);
392
393 static void setPrequalifyFileCallBack(PrequalifyFileCallback *p_cb, void *u_data);
394 static PrequalifyFileCallback *getPrequalifyFileCallBack( void *&user_data );
395 void allowPrequalifyFile(SbBool);
396 SbBool isAllowPrequalifyFile() const;
397
398
399 private:
400 static void initClass();
401 static void exitClass();
402
403 // Manages field dependencies, when one of them change
404 virtual void fieldHasChanged( SoField *field ); // override of SoFieldContainer
405
406 virtual void copyContents(const SoFieldContainer *fromFC, SbBool copyConnections);
407
408 private:
409 // Reads stuff into instance. Returns FALSE on error.
410 virtual SbBool readInstance(SoInput *in, unsigned short flags);
411
412 virtual ~SoTexture2();
413
414 private:
415
417 void commonConstructor();
418};
419
420#ifdef _MSC_VER
421#pragma warning( pop )
422#endif
423
424#endif /* _SO_TEXTURE_2_ */
425
426
Class for smart character strings.
Definition SbString.h:202
Abstract base class for all actions.
Definition SoAction.h:132
Performs a generic traversal of a scene graph or path.
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 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 2D image.
Definition SoSFImage.h:126
Field containing a a node.
Definition SoSFNode.h:97
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
2D texture mapping node.
Definition SoTexture2.h:261
void setFinishLoadingCallback(SoTexture2CB *cb, void *userData)
Callback invoked when the texture is loaded and ready to use.
void SoTexture2CB(void *userData, SoTexture2 *tex)
Definition SoTexture2.h:272
SoSFEnum wrapT
Indicates what to do when texture coordinates in the T (vertical) direction lie outside the range 0-1...
Definition SoTexture2.h:315
void setStartLoadingCallback(SoTexture2CB *cb, void *userData)
Callback invoked when starting to load the texture.
void loadTexture()
Loads the texture if the loadingMode field is set to MANUAL.
SoSFNode renderToTextureProperty
Specifies an SoRenderToTextureProperty node containing a scene graph that will be rendered to create ...
Definition SoTexture2.h:337
SoSFImage image
Contains an in-memory representation of the texture map.
Definition SoTexture2.h:308
Loading
Loading mode.
Definition SoTexture2.h:275
@ MANUAL
The texture is loaded when the loadTexture method is called.
Definition SoTexture2.h:284
@ AUTO
The texture is loaded when filename field is set.
Definition SoTexture2.h:279
SoSFFilePathString filename
Name of the file from which to read texture image.
Definition SoTexture2.h:299
SoTexture2()
Creates a texture node with default settings.
SoSFEnum loadingMode
Specifies the loading mode.
Definition SoTexture2.h:323
Abstract base class for texture mapping nodes.
Definition SoTexture.h:156
int SbBool
Boolean type.
Definition SbBase.h:87