00001 /*======================================================================= 00002 * Copyright 1991-1996, Silicon Graphics, Inc. 00003 * ALL RIGHTS RESERVED 00004 * 00005 * UNPUBLISHED -- Rights reserved under the copyright laws of the United 00006 * States. Use of a copyright notice is precautionary only and does not 00007 * imply publication or disclosure. 00008 * 00009 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: 00010 * Use, duplication or disclosure by the Government is subject to restrictions 00011 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights 00012 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or 00013 * in similar or successor clauses in the FAR, or the DOD or NASA FAR 00014 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., 00015 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. 00016 * 00017 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY 00018 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, 00019 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY 00020 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON 00021 * GRAPHICS, INC. 00022 **=======================================================================*/ 00023 /*======================================================================= 00024 ** Author : John Rohlf (MMM yyyy) 00025 ** Modified by : Thad Beier (MMM yyyy) 00026 ** Modified by : Gavin Bell (MMM yyyy) 00027 **=======================================================================*/ 00028 /*======================================================================= 00029 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00030 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00031 *** *** 00032 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00033 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00034 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00035 *** *** 00036 *** RESTRICTED RIGHTS LEGEND *** 00037 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00038 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00039 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00040 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00041 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00042 *** *** 00043 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, *** 00044 *** BORDEAUX, FRANCE *** 00045 *** ALL RIGHTS RESERVED *** 00046 **=======================================================================*/ 00047 /*======================================================================= 00048 ** Modified by : VSG (MMM YYYY) 00049 **=======================================================================*/ 00050 00051 00052 #ifndef _SO_TEXTURE_2_ 00053 #define _SO_TEXTURE_2_ 00054 00055 #include <Inventor/fields/SoSFColor.h> 00056 #include <Inventor/fields/SoSFEnum.h> 00057 #include <Inventor/fields/SoSFImage.h> 00058 #include <Inventor/fields/SoSFFilePathString.h> 00059 #include <Inventor/fields/SoSFNode.h> 00060 #include <Inventor/fields/SoSFBool.h> 00061 #include <Inventor/nodes/SoNode.h> 00062 #include <Inventor/nodes/SoTexture.h> 00063 #include <Inventor/image/SbRasterImage.h> 00064 00065 #include <Inventor/sys/SoGLType.h> 00066 #include <Inventor/threads/SbThreadStorage.h> 00067 #include <Inventor/threads/SbThreadMutex.h> 00068 #include <Inventor/elements/SoTextureImageElement.h> 00069 00070 class SoSensor; 00071 00072 #ifdef _MSC_VER 00073 #pragma warning( push ) 00074 #pragma warning(disable:4251) 00075 #endif 00076 00078 // 00079 // Class: SoTexture2 00080 // 00081 // Texture node. 00082 // 00084 00085 class SoTexture2; 00086 typedef SbBool PrequalifyFileCallback(const SbString &, void *, SoTexture2 *); 00087 00088 SO_PIMPL_PUBLIC_DECLARATION(SoTexture2); 00089 00261 class SoTexture2 : public SoTexture { 00262 00263 SO_NODE_HEADER(SoTexture2); 00264 00265 SO_PIMPL_PUBLIC_HEADER(SoTexture2); 00266 00267 public: 00268 00272 typedef void SoTexture2CB(void *userData, SoTexture2 *tex); 00273 00275 enum Loading { 00279 AUTO = 0, 00280 00284 MANUAL 00285 }; 00286 00299 SoSFFilePathString filename; 00300 00308 SoSFImage image; 00309 00315 SoSFEnum wrapT; 00316 00323 SoSFEnum loadingMode; 00324 00325 00337 SoSFNode renderToTextureProperty; 00338 00343 void setStartLoadingCallback(SoTexture2CB* cb, void* userData); 00344 00349 void setFinishLoadingCallback(SoTexture2CB* cb, void* userData); 00350 00351 // Manual loading 00352 00380 void loadTexture(); 00381 00385 SoTexture2(); 00386 00387 private: 00388 virtual void doAction(SoAction *action); 00389 virtual void GLRender(SoGLRenderAction *action); 00390 virtual void callback(SoCallbackAction *action); 00391 virtual void doActionOnRTT(SoAction *action); 00392 00393 static void setPrequalifyFileCallBack(PrequalifyFileCallback *p_cb, void *u_data); 00394 static PrequalifyFileCallback *getPrequalifyFileCallBack( void *&user_data ); 00395 void allowPrequalifyFile(SbBool); 00396 SbBool isAllowPrequalifyFile() const; 00397 00398 00399 private: 00400 static void initClass(); 00401 static void exitClass(); 00402 00403 // Manages field dependencies, when one of them change 00404 virtual void fieldHasChanged( SoField *field ); // override of SoFieldContainer 00405 00406 virtual void copyContents(const SoFieldContainer *fromFC, SbBool copyConnections); 00407 00408 private: 00409 // Reads stuff into instance. Returns FALSE on error. 00410 virtual SbBool readInstance(SoInput *in, unsigned short flags); 00411 00412 virtual ~SoTexture2(); 00413 00414 private: 00415 00417 void commonConstructor(); 00418 }; 00419 00420 #ifdef _MSC_VER 00421 #pragma warning( pop ) 00422 #endif 00423 00424 #endif /* _SO_TEXTURE_2_ */ 00425 00426 00427