00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2021 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : C. OGNIER (Dec 2004) 00022 **=======================================================================*/ 00023 00024 00025 #ifndef _SO_RENDER_TO_TEXTURE_PROPERTY_ 00026 #define _SO_RENDER_TO_TEXTURE_PROPERTY_ 00027 00028 #include <Inventor/nodes/SoNode.h> 00029 #include <Inventor/fields/SoMFNode.h> 00030 #include <Inventor/fields/SoSFEnum.h> 00031 #include <Inventor/fields/SoSFColor.h> 00032 #include <Inventor/fields/SoMFPath.h> 00033 #include <Inventor/fields/SoSFVec2s.h> 00034 #include <Inventor/fields/SoSFTrigger.h> 00035 #include <Inventor/actions/SoGLRenderAction.h> 00036 #include <Inventor/sensors/SoFieldSensor.h> 00037 #include <Inventor/components/SoGLGraphicConfigTemplate.h> 00038 #include <Inventor/sys/SoGLType.h> 00039 #include <Inventor/helpers/SbGlContextHelper.h> 00040 00041 #include <SoDeprecationRules.h> 00042 00043 #ifndef HIDDEN_FROM_DOC 00044 00045 namespace inventor 00046 { 00047 namespace impl 00048 { 00049 class SoTextureCubeMapImpl; 00050 class SoTextureImpl; 00051 class SoTexture2Impl; 00052 class SoViewingCubeImpl; 00053 } 00054 } 00056 #endif 00057 00058 class SoTexture; 00059 00060 SO_PIMPL_PUBLIC_DECLARATION(SoRenderToTextureProperty) 00061 00062 00063 00104 class SoRenderToTextureProperty : public SoNode 00105 { 00106 SO_NODE_HEADER(SoRenderToTextureProperty); 00107 SO_PIMPL_FINAL_PUBLIC_HEADER(SoRenderToTextureProperty) 00108 00109 public: 00110 00111 SoRenderToTextureProperty(); 00112 00114 enum UpdatePolicy { 00118 EACH_FRAME, 00123 WHEN_NEEDED, 00127 ON_TRIGGER 00128 }; 00129 00131 enum Component { 00136 RGB, 00140 RGB_TRANSPARENCY, 00141 RGB_ALPHA = RGB_TRANSPARENCY, 00145 DEPTH 00146 }; 00147 00148 00149 // Fields 00165 SoMFNode node; 00166 00182 SoMFPath path; 00183 00188 SoSFEnum updatePolicy; 00189 00193 SoSFColor backgroundColor; 00194 00199 SoSFVec2s size; 00200 00205 SoSFEnum component; 00206 00211 SoSFTrigger trigger; 00212 00216 void setGLRenderAction(SoGLRenderAction* ra); 00217 00221 SoGLRenderAction* getGLRenderAction() const; 00222 00223 #if 1 SoDEPRECATED 00226 void setGraphicConfigTemplate(SoGLGraphicConfigTemplate*) {} 00227 SoDEPRECATED 00229 SoGLGraphicConfigTemplate* getGraphicConfigTemplate() { return NULL; } 00230 SoDEPRECATED 00232 void setContextForSharing(SoGLContext*) {} 00233 00234 #endif 00238 private: 00239 virtual void GLRender(SoGLRenderAction *action); 00240 00241 private: 00242 static void initClass(); 00243 static void exitClass(); 00244 00246 virtual void fieldHasChanged( SoField* field ); 00247 virtual void notify( SoNotList *list ); 00248 00255 void setTexture(SoTexture* texture); 00256 00257 private: 00258 ~SoRenderToTextureProperty(); 00259 00260 #ifndef HIDDEN_FROM_DOC 00261 // friendship to access SoRenderToTextureProperty::getImpl<> 00262 friend class SoTextureCubeMap; 00263 friend class inventor::impl::SoTextureCubeMapImpl; 00264 friend class SoTexture2; 00265 friend class inventor::impl::SoTextureImpl; 00266 friend class inventor::impl::SoTexture2Impl; 00267 friend class inventor::impl::SoViewingCubeImpl; 00268 #endif // HIDDEN_FROM_DOC 00269 00270 }; 00271 00272 #endif /* _SO_RENDER_TO_TEXTURE_PROPERTY_ */ 00273