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 _OSGVIEWPORTBASE_H_
00055 #define _OSGVIEWPORTBASE_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 <OSGAttachmentContainer.h>
00069
00070 #include <OSGReal32Fields.h>
00071 #include <OSGReal32Fields.h>
00072 #include <OSGReal32Fields.h>
00073 #include <OSGReal32Fields.h>
00074 #include <OSGWindowFields.h>
00075 #include <OSGCameraFields.h>
00076 #include <OSGNodeFields.h>
00077 #include <OSGBackgroundFields.h>
00078 #include <OSGForegroundFields.h>
00079 #include <OSGUInt32Fields.h>
00080 #include <OSGReal32Fields.h>
00081
00082 #include <OSGViewportFields.h>
00083
00084 OSG_BEGIN_NAMESPACE
00085
00086 class Viewport;
00087 class BinaryDataHandler;
00088
00090
00091 class OSG_SYSTEMLIB_DLLMAPPING ViewportBase : public AttachmentContainer
00092 {
00093 private:
00094
00095 typedef AttachmentContainer Inherited;
00096
00097
00098 public:
00099
00100 typedef ViewportPtr Ptr;
00101
00102 enum
00103 {
00104 LeftFieldId = Inherited::NextFieldId,
00105 RightFieldId = LeftFieldId + 1,
00106 BottomFieldId = RightFieldId + 1,
00107 TopFieldId = BottomFieldId + 1,
00108 ParentFieldId = TopFieldId + 1,
00109 CameraFieldId = ParentFieldId + 1,
00110 RootFieldId = CameraFieldId + 1,
00111 BackgroundFieldId = RootFieldId + 1,
00112 ForegroundsFieldId = BackgroundFieldId + 1,
00113 TravMaskFieldId = ForegroundsFieldId + 1,
00114 DrawTimeFieldId = TravMaskFieldId + 1,
00115 NextFieldId = DrawTimeFieldId + 1
00116 };
00117
00118 static const OSG::BitVector LeftFieldMask;
00119 static const OSG::BitVector RightFieldMask;
00120 static const OSG::BitVector BottomFieldMask;
00121 static const OSG::BitVector TopFieldMask;
00122 static const OSG::BitVector ParentFieldMask;
00123 static const OSG::BitVector CameraFieldMask;
00124 static const OSG::BitVector RootFieldMask;
00125 static const OSG::BitVector BackgroundFieldMask;
00126 static const OSG::BitVector ForegroundsFieldMask;
00127 static const OSG::BitVector TravMaskFieldMask;
00128 static const OSG::BitVector DrawTimeFieldMask;
00129
00130
00131 static const OSG::BitVector MTInfluenceMask;
00132
00133
00137 static FieldContainerType &getClassType (void);
00138 static UInt32 getClassTypeId (void);
00139
00141
00145 virtual FieldContainerType &getType (void);
00146 virtual const FieldContainerType &getType (void) const;
00147
00148 virtual UInt32 getContainerSize(void) const;
00149
00151
00155 SFReal32 *getSFLeft (void);
00156 SFReal32 *getSFRight (void);
00157 SFReal32 *getSFBottom (void);
00158 SFReal32 *getSFTop (void);
00159 SFWindowPtr *getSFParent (void);
00160 SFCameraPtr *getSFCamera (void);
00161 SFNodePtr *getSFRoot (void);
00162 SFBackgroundPtr *getSFBackground (void);
00163 MFForegroundPtr *getMFForegrounds (void);
00164 SFUInt32 *getSFTravMask (void);
00165 SFReal32 *getSFDrawTime (void);
00166
00167 Real32 &getLeft (void);
00168 const Real32 &getLeft (void) const;
00169 Real32 &getRight (void);
00170 const Real32 &getRight (void) const;
00171 Real32 &getBottom (void);
00172 const Real32 &getBottom (void) const;
00173 Real32 &getTop (void);
00174 const Real32 &getTop (void) const;
00175 WindowPtr &getParent (void);
00176 const WindowPtr &getParent (void) const;
00177 CameraPtr &getCamera (void);
00178 const CameraPtr &getCamera (void) const;
00179 NodePtr &getRoot (void);
00180 const NodePtr &getRoot (void) const;
00181 BackgroundPtr &getBackground (void);
00182 const BackgroundPtr &getBackground (void) const;
00183 UInt32 &getTravMask (void);
00184 const UInt32 &getTravMask (void) const;
00185 Real32 &getDrawTime (void);
00186 const Real32 &getDrawTime (void) const;
00187 ForegroundPtr &getForegrounds (const UInt32 index);
00188 MFForegroundPtr &getForegrounds (void);
00189 const MFForegroundPtr &getForegrounds (void) const;
00190
00192
00196 void setLeft ( const Real32 &value );
00197 void setRight ( const Real32 &value );
00198 void setBottom ( const Real32 &value );
00199 void setTop ( const Real32 &value );
00200 void setParent ( const WindowPtr &value );
00201 void setCamera ( const CameraPtr &value );
00202 void setRoot ( const NodePtr &value );
00203 void setBackground ( const BackgroundPtr &value );
00204 void setTravMask ( const UInt32 &value );
00205 void setDrawTime ( const Real32 &value );
00206
00208
00213
00217 virtual UInt32 getBinSize (const BitVector &whichField);
00218 virtual void copyToBin ( BinaryDataHandler &pMem,
00219 const BitVector &whichField);
00220 virtual void copyFromBin( BinaryDataHandler &pMem,
00221 const BitVector &whichField);
00222
00223
00225
00229 static ViewportPtr create (void);
00230 static ViewportPtr createEmpty (void);
00231
00234
00238 virtual FieldContainerPtr shallowCopy (void) const;
00239
00241
00242 protected:
00243
00244
00248 SFReal32 _sfLeft;
00249 SFReal32 _sfRight;
00250 SFReal32 _sfBottom;
00251 SFReal32 _sfTop;
00252 SFWindowPtr _sfParent;
00253 SFCameraPtr _sfCamera;
00254 SFNodePtr _sfRoot;
00255 SFBackgroundPtr _sfBackground;
00256 MFForegroundPtr _mfForegrounds;
00257 SFUInt32 _sfTravMask;
00258 SFReal32 _sfDrawTime;
00259
00261
00265 ViewportBase(void);
00266 ViewportBase(const ViewportBase &source);
00267
00269
00273 virtual ~ViewportBase(void);
00274
00276
00280 #if !defined(OSG_FIXED_MFIELDSYNC)
00281 void executeSyncImpl( ViewportBase *pOther,
00282 const BitVector &whichField);
00283
00284 virtual void executeSync( FieldContainer &other,
00285 const BitVector &whichField);
00286 #else
00287 void executeSyncImpl( ViewportBase *pOther,
00288 const BitVector &whichField,
00289 const SyncInfo &sInfo );
00290
00291 virtual void executeSync( FieldContainer &other,
00292 const BitVector &whichField,
00293 const SyncInfo &sInfo);
00294
00295 virtual void execBeginEdit (const BitVector &whichField,
00296 UInt32 uiAspect,
00297 UInt32 uiContainerSize);
00298
00299 void execBeginEditImpl (const BitVector &whichField,
00300 UInt32 uiAspect,
00301 UInt32 uiContainerSize);
00302
00303 virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00304 #endif
00305
00307
00308 private:
00309
00310 friend class FieldContainer;
00311
00312 static FieldDescription *_desc[];
00313 static FieldContainerType _type;
00314
00315
00316
00317 void operator =(const ViewportBase &source);
00318 };
00319
00320
00321
00322
00323
00324
00325 typedef ViewportBase *ViewportBaseP;
00326
00327 typedef osgIF<ViewportBase::isNodeCore,
00328 CoredNodePtr<Viewport>,
00329 FieldContainer::attempt_to_create_CoredNodePtr_on_non_NodeCore_FC
00330 >::_IRet ViewportNodePtr;
00331
00332 typedef RefPtr<ViewportPtr> ViewportRefPtr;
00333
00334 OSG_END_NAMESPACE
00335
00336 #define OSGVIEWPORTBASE_HEADER_CVSID "@(#)$Id: FCBaseTemplate_h.h,v 1.38 2005/07/08 06:37:35 vossg Exp $"
00337
00338 #endif