00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #ifndef _OSGFBOVIEWPORTBASE_H_
00055 #define _OSGFBOVIEWPORTBASE_H_
00056 #ifdef __sgi
00057 #pragma once
00058 #endif
00059
00060
00061 #include <OSGConfig.h>
00062 #include <OSGSystemDef.h>
00063
00064 #include <OSGBaseTypes.h>
00065 #include <OSGRefPtr.h>
00066 #include <OSGCoredNodePtr.h>
00067
00068 #include <OSGViewport.h>
00069
00070 #include <OSGBoolFields.h>
00071 #include <OSGNodeFields.h>
00072 #include <OSGNodeFields.h>
00073 #include <OSGTextureChunkFields.h>
00074 #include <OSGBoolFields.h>
00075 #include <OSGInt32Fields.h>
00076 #include <OSGInt32Fields.h>
00077 #include <OSGBoolFields.h>
00078 #include <OSGBoolFields.h>
00079 #include <OSGUInt32Fields.h>
00080 #include <OSGUInt32Fields.h>
00081 #include <OSGUInt32Fields.h>
00082 #include <OSGBoolFields.h>
00083 #include <OSGBoolFields.h>
00084
00085 #include <OSGFBOViewportFields.h>
00086
00087 OSG_BEGIN_NAMESPACE
00088
00089 class FBOViewport;
00090 class BinaryDataHandler;
00091
00093
00094 class OSG_SYSTEMLIB_DLLMAPPING FBOViewportBase : public Viewport
00095 {
00096 private:
00097
00098 typedef Viewport Inherited;
00099
00100
00101 public:
00102
00103 typedef FBOViewportPtr Ptr;
00104
00105 enum
00106 {
00107 EnabledFieldId = Inherited::NextFieldId,
00108 ExcludeNodesFieldId = EnabledFieldId + 1,
00109 RenderNodesFieldId = ExcludeNodesFieldId + 1,
00110 TexturesFieldId = RenderNodesFieldId + 1,
00111 FboOnFieldId = TexturesFieldId + 1,
00112 StorageWidthFieldId = FboOnFieldId + 1,
00113 StorageHeightFieldId = StorageWidthFieldId + 1,
00114 GenCubemapsFieldId = StorageHeightFieldId + 1,
00115 GenDepthmapsFieldId = GenCubemapsFieldId + 1,
00116 FrameBufferIndexFieldId = GenDepthmapsFieldId + 1,
00117 DepthBufferIndexFieldId = FrameBufferIndexFieldId + 1,
00118 StencilBufferIndexFieldId = DepthBufferIndexFieldId + 1,
00119 DirtyFieldId = StencilBufferIndexFieldId + 1,
00120 ReadBufferFieldId = DirtyFieldId + 1,
00121 NextFieldId = ReadBufferFieldId + 1
00122 };
00123
00124 static const OSG::BitVector EnabledFieldMask;
00125 static const OSG::BitVector ExcludeNodesFieldMask;
00126 static const OSG::BitVector RenderNodesFieldMask;
00127 static const OSG::BitVector TexturesFieldMask;
00128 static const OSG::BitVector FboOnFieldMask;
00129 static const OSG::BitVector StorageWidthFieldMask;
00130 static const OSG::BitVector StorageHeightFieldMask;
00131 static const OSG::BitVector GenCubemapsFieldMask;
00132 static const OSG::BitVector GenDepthmapsFieldMask;
00133 static const OSG::BitVector FrameBufferIndexFieldMask;
00134 static const OSG::BitVector DepthBufferIndexFieldMask;
00135 static const OSG::BitVector StencilBufferIndexFieldMask;
00136 static const OSG::BitVector DirtyFieldMask;
00137 static const OSG::BitVector ReadBufferFieldMask;
00138
00139
00140 static const OSG::BitVector MTInfluenceMask;
00141
00142
00146 static FieldContainerType &getClassType (void);
00147 static UInt32 getClassTypeId (void);
00148
00150
00154 virtual FieldContainerType &getType (void);
00155 virtual const FieldContainerType &getType (void) const;
00156
00157 virtual UInt32 getContainerSize(void) const;
00158
00160
00164 SFBool *getSFEnabled (void);
00165 MFNodePtr *getMFExcludeNodes (void);
00166 MFNodePtr *getMFRenderNodes (void);
00167 MFTextureChunkPtr *getMFTextures (void);
00168 SFBool *getSFFboOn (void);
00169 SFInt32 *getSFStorageWidth (void);
00170 SFInt32 *getSFStorageHeight (void);
00171 SFBool *getSFGenCubemaps (void);
00172 SFBool *getSFGenDepthmaps (void);
00173 SFBool *getSFDirty (void);
00174 SFBool *getSFReadBuffer (void);
00175
00176 bool &getEnabled (void);
00177 const bool &getEnabled (void) const;
00178 bool &getFboOn (void);
00179 const bool &getFboOn (void) const;
00180 Int32 &getStorageWidth (void);
00181 const Int32 &getStorageWidth (void) const;
00182 Int32 &getStorageHeight (void);
00183 const Int32 &getStorageHeight (void) const;
00184 bool &getGenCubemaps (void);
00185 const bool &getGenCubemaps (void) const;
00186 bool &getGenDepthmaps (void);
00187 const bool &getGenDepthmaps (void) const;
00188 bool &getDirty (void);
00189 const bool &getDirty (void) const;
00190 bool &getReadBuffer (void);
00191 const bool &getReadBuffer (void) const;
00192 NodePtr &getExcludeNodes (const UInt32 index);
00193 MFNodePtr &getExcludeNodes (void);
00194 const MFNodePtr &getExcludeNodes (void) const;
00195 NodePtr &getRenderNodes (const UInt32 index);
00196 MFNodePtr &getRenderNodes (void);
00197 const MFNodePtr &getRenderNodes (void) const;
00198 TextureChunkPtr &getTextures (const UInt32 index);
00199 MFTextureChunkPtr &getTextures (void);
00200 const MFTextureChunkPtr &getTextures (void) const;
00201
00203
00207 void setEnabled ( const bool &value );
00208 void setFboOn ( const bool &value );
00209 void setStorageWidth ( const Int32 &value );
00210 void setStorageHeight ( const Int32 &value );
00211 void setGenCubemaps ( const bool &value );
00212 void setGenDepthmaps ( const bool &value );
00213 void setDirty ( const bool &value );
00214 void setReadBuffer ( const bool &value );
00215
00217
00222
00226 virtual UInt32 getBinSize (const BitVector &whichField);
00227 virtual void copyToBin ( BinaryDataHandler &pMem,
00228 const BitVector &whichField);
00229 virtual void copyFromBin( BinaryDataHandler &pMem,
00230 const BitVector &whichField);
00231
00232
00234
00238 static FBOViewportPtr create (void);
00239 static FBOViewportPtr createEmpty (void);
00240
00243
00247 virtual FieldContainerPtr shallowCopy (void) const;
00248
00250
00251 protected:
00252
00253
00257 SFBool _sfEnabled;
00258 MFNodePtr _mfExcludeNodes;
00259 MFNodePtr _mfRenderNodes;
00260 MFTextureChunkPtr _mfTextures;
00261 SFBool _sfFboOn;
00262 SFInt32 _sfStorageWidth;
00263 SFInt32 _sfStorageHeight;
00264 SFBool _sfGenCubemaps;
00265 SFBool _sfGenDepthmaps;
00266 SFUInt32 _sfFrameBufferIndex;
00267 SFUInt32 _sfDepthBufferIndex;
00268 SFUInt32 _sfStencilBufferIndex;
00269 SFBool _sfDirty;
00270 SFBool _sfReadBuffer;
00271
00273
00277 FBOViewportBase(void);
00278 FBOViewportBase(const FBOViewportBase &source);
00279
00281
00285 virtual ~FBOViewportBase(void);
00286
00288
00292 SFUInt32 *getSFFrameBufferIndex(void);
00293 SFUInt32 *getSFDepthBufferIndex(void);
00294 SFUInt32 *getSFStencilBufferIndex(void);
00295
00296 UInt32 &getFrameBufferIndex(void);
00297 const UInt32 &getFrameBufferIndex(void) const;
00298 UInt32 &getDepthBufferIndex(void);
00299 const UInt32 &getDepthBufferIndex(void) const;
00300 UInt32 &getStencilBufferIndex(void);
00301 const UInt32 &getStencilBufferIndex(void) const;
00302
00304
00308 void setFrameBufferIndex(const UInt32 &value);
00309 void setDepthBufferIndex(const UInt32 &value);
00310 void setStencilBufferIndex(const UInt32 &value);
00311
00313
00317 #if !defined(OSG_FIXED_MFIELDSYNC)
00318 void executeSyncImpl( FBOViewportBase *pOther,
00319 const BitVector &whichField);
00320
00321 virtual void executeSync( FieldContainer &other,
00322 const BitVector &whichField);
00323 #else
00324 void executeSyncImpl( FBOViewportBase *pOther,
00325 const BitVector &whichField,
00326 const SyncInfo &sInfo );
00327
00328 virtual void executeSync( FieldContainer &other,
00329 const BitVector &whichField,
00330 const SyncInfo &sInfo);
00331
00332 virtual void execBeginEdit (const BitVector &whichField,
00333 UInt32 uiAspect,
00334 UInt32 uiContainerSize);
00335
00336 void execBeginEditImpl (const BitVector &whichField,
00337 UInt32 uiAspect,
00338 UInt32 uiContainerSize);
00339
00340 virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00341 #endif
00342
00344
00345 private:
00346
00347 friend class FieldContainer;
00348
00349 static FieldDescription *_desc[];
00350 static FieldContainerType _type;
00351
00352
00353
00354 void operator =(const FBOViewportBase &source);
00355 };
00356
00357
00358
00359
00360
00361
00362 typedef FBOViewportBase *FBOViewportBaseP;
00363
00364 typedef osgIF<FBOViewportBase::isNodeCore,
00365 CoredNodePtr<FBOViewport>,
00366 FieldContainer::attempt_to_create_CoredNodePtr_on_non_NodeCore_FC
00367 >::_IRet FBOViewportNodePtr;
00368
00369 typedef RefPtr<FBOViewportPtr> FBOViewportRefPtr;
00370
00371 OSG_END_NAMESPACE
00372
00373 #define OSGFBOVIEWPORTBASE_HEADER_CVSID "@(#)$Id: OSGFBOViewportBase.h,v 1.1 2007/03/12 15:03:02 a-m-z Exp $"
00374
00375 #endif