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 _OSGSKYBACKGROUNDBASE_H_
00055 #define _OSGSKYBACKGROUNDBASE_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 <OSGBackground.h>
00069
00070 #include <OSGColor4fFields.h>
00071 #include <OSGReal32Fields.h>
00072 #include <OSGColor4fFields.h>
00073 #include <OSGReal32Fields.h>
00074 #include <OSGUInt32Fields.h>
00075 #include <OSGTextureChunkFields.h>
00076 #include <OSGTextureChunkFields.h>
00077 #include <OSGTextureChunkFields.h>
00078 #include <OSGTextureChunkFields.h>
00079 #include <OSGTextureChunkFields.h>
00080 #include <OSGTextureChunkFields.h>
00081 #include <OSGBoolFields.h>
00082 #include <OSGVec3fFields.h>
00083 #include <OSGVec3fFields.h>
00084 #include <OSGVec3fFields.h>
00085 #include <OSGVec3fFields.h>
00086 #include <OSGVec3fFields.h>
00087 #include <OSGVec3fFields.h>
00088 #include <OSGNodeFields.h>
00089 #include <OSGInt32Fields.h>
00090
00091 #include <OSGSkyBackgroundFields.h>
00092
00093 OSG_BEGIN_NAMESPACE
00094
00095 class SkyBackground;
00096 class BinaryDataHandler;
00097
00099
00100 class OSG_SYSTEMLIB_DLLMAPPING SkyBackgroundBase : public Background
00101 {
00102 private:
00103
00104 typedef Background Inherited;
00105
00106
00107 public:
00108
00109 typedef SkyBackgroundPtr Ptr;
00110
00111 enum
00112 {
00113 SkyColorFieldId = Inherited::NextFieldId,
00114 SkyAngleFieldId = SkyColorFieldId + 1,
00115 GroundColorFieldId = SkyAngleFieldId + 1,
00116 GroundAngleFieldId = GroundColorFieldId + 1,
00117 SphereResFieldId = GroundAngleFieldId + 1,
00118 BackTextureFieldId = SphereResFieldId + 1,
00119 BottomTextureFieldId = BackTextureFieldId + 1,
00120 FrontTextureFieldId = BottomTextureFieldId + 1,
00121 LeftTextureFieldId = FrontTextureFieldId + 1,
00122 RightTextureFieldId = LeftTextureFieldId + 1,
00123 TopTextureFieldId = RightTextureFieldId + 1,
00124 BoxInsideFieldId = TopTextureFieldId + 1,
00125 TopTexCoordFieldId = BoxInsideFieldId + 1,
00126 BottomTexCoordFieldId = TopTexCoordFieldId + 1,
00127 RightTexCoordFieldId = BottomTexCoordFieldId + 1,
00128 LeftTexCoordFieldId = RightTexCoordFieldId + 1,
00129 FrontTexCoordFieldId = LeftTexCoordFieldId + 1,
00130 BackTexCoordFieldId = FrontTexCoordFieldId + 1,
00131 BeaconFieldId = BackTexCoordFieldId + 1,
00132 ClearStencilBitFieldId = BeaconFieldId + 1,
00133 NextFieldId = ClearStencilBitFieldId + 1
00134 };
00135
00136 static const OSG::BitVector SkyColorFieldMask;
00137 static const OSG::BitVector SkyAngleFieldMask;
00138 static const OSG::BitVector GroundColorFieldMask;
00139 static const OSG::BitVector GroundAngleFieldMask;
00140 static const OSG::BitVector SphereResFieldMask;
00141 static const OSG::BitVector BackTextureFieldMask;
00142 static const OSG::BitVector BottomTextureFieldMask;
00143 static const OSG::BitVector FrontTextureFieldMask;
00144 static const OSG::BitVector LeftTextureFieldMask;
00145 static const OSG::BitVector RightTextureFieldMask;
00146 static const OSG::BitVector TopTextureFieldMask;
00147 static const OSG::BitVector BoxInsideFieldMask;
00148 static const OSG::BitVector TopTexCoordFieldMask;
00149 static const OSG::BitVector BottomTexCoordFieldMask;
00150 static const OSG::BitVector RightTexCoordFieldMask;
00151 static const OSG::BitVector LeftTexCoordFieldMask;
00152 static const OSG::BitVector FrontTexCoordFieldMask;
00153 static const OSG::BitVector BackTexCoordFieldMask;
00154 static const OSG::BitVector BeaconFieldMask;
00155 static const OSG::BitVector ClearStencilBitFieldMask;
00156
00157
00158 static const OSG::BitVector MTInfluenceMask;
00159
00160
00164 static FieldContainerType &getClassType (void);
00165 static UInt32 getClassTypeId (void);
00166
00168
00172 virtual FieldContainerType &getType (void);
00173 virtual const FieldContainerType &getType (void) const;
00174
00175 virtual UInt32 getContainerSize(void) const;
00176
00178
00182 MFColor4f *getMFSkyColor (void);
00183 MFReal32 *getMFSkyAngle (void);
00184 MFColor4f *getMFGroundColor (void);
00185 MFReal32 *getMFGroundAngle (void);
00186 SFUInt32 *getSFSphereRes (void);
00187 SFTextureChunkPtr *getSFBackTexture (void);
00188 SFTextureChunkPtr *getSFBottomTexture (void);
00189 SFTextureChunkPtr *getSFFrontTexture (void);
00190 SFTextureChunkPtr *getSFLeftTexture (void);
00191 SFTextureChunkPtr *getSFRightTexture (void);
00192 SFTextureChunkPtr *getSFTopTexture (void);
00193 SFBool *getSFBoxInside (void);
00194 MFVec3f *getMFTopTexCoord (void);
00195 MFVec3f *getMFBottomTexCoord (void);
00196 MFVec3f *getMFRightTexCoord (void);
00197 MFVec3f *getMFLeftTexCoord (void);
00198 MFVec3f *getMFFrontTexCoord (void);
00199 MFVec3f *getMFBackTexCoord (void);
00200 SFNodePtr *getSFBeacon (void);
00201 SFInt32 *getSFClearStencilBit(void);
00202
00203 UInt32 &getSphereRes (void);
00204 const UInt32 &getSphereRes (void) const;
00205 TextureChunkPtr &getBackTexture (void);
00206 const TextureChunkPtr &getBackTexture (void) const;
00207 TextureChunkPtr &getBottomTexture (void);
00208 const TextureChunkPtr &getBottomTexture (void) const;
00209 TextureChunkPtr &getFrontTexture (void);
00210 const TextureChunkPtr &getFrontTexture (void) const;
00211 TextureChunkPtr &getLeftTexture (void);
00212 const TextureChunkPtr &getLeftTexture (void) const;
00213 TextureChunkPtr &getRightTexture (void);
00214 const TextureChunkPtr &getRightTexture (void) const;
00215 TextureChunkPtr &getTopTexture (void);
00216 const TextureChunkPtr &getTopTexture (void) const;
00217 bool &getBoxInside (void);
00218 const bool &getBoxInside (void) const;
00219 NodePtr &getBeacon (void);
00220 const NodePtr &getBeacon (void) const;
00221 Int32 &getClearStencilBit(void);
00222 const Int32 &getClearStencilBit(void) const;
00223 Color4f &getSkyColor (const UInt32 index);
00224 MFColor4f &getSkyColor (void);
00225 const MFColor4f &getSkyColor (void) const;
00226 Real32 &getSkyAngle (const UInt32 index);
00227 MFReal32 &getSkyAngle (void);
00228 const MFReal32 &getSkyAngle (void) const;
00229 Color4f &getGroundColor (const UInt32 index);
00230 MFColor4f &getGroundColor (void);
00231 const MFColor4f &getGroundColor (void) const;
00232 Real32 &getGroundAngle (const UInt32 index);
00233 MFReal32 &getGroundAngle (void);
00234 const MFReal32 &getGroundAngle (void) const;
00235 Vec3f &getTopTexCoord (const UInt32 index);
00236 MFVec3f &getTopTexCoord (void);
00237 const MFVec3f &getTopTexCoord (void) const;
00238 Vec3f &getBottomTexCoord (const UInt32 index);
00239 MFVec3f &getBottomTexCoord (void);
00240 const MFVec3f &getBottomTexCoord (void) const;
00241 Vec3f &getRightTexCoord (const UInt32 index);
00242 MFVec3f &getRightTexCoord (void);
00243 const MFVec3f &getRightTexCoord (void) const;
00244 Vec3f &getLeftTexCoord (const UInt32 index);
00245 MFVec3f &getLeftTexCoord (void);
00246 const MFVec3f &getLeftTexCoord (void) const;
00247 Vec3f &getFrontTexCoord (const UInt32 index);
00248 MFVec3f &getFrontTexCoord (void);
00249 const MFVec3f &getFrontTexCoord (void) const;
00250 Vec3f &getBackTexCoord (const UInt32 index);
00251 MFVec3f &getBackTexCoord (void);
00252 const MFVec3f &getBackTexCoord (void) const;
00253
00255
00259 void setSphereRes ( const UInt32 &value );
00260 void setBackTexture ( const TextureChunkPtr &value );
00261 void setBottomTexture ( const TextureChunkPtr &value );
00262 void setFrontTexture ( const TextureChunkPtr &value );
00263 void setLeftTexture ( const TextureChunkPtr &value );
00264 void setRightTexture ( const TextureChunkPtr &value );
00265 void setTopTexture ( const TextureChunkPtr &value );
00266 void setBoxInside ( const bool &value );
00267 void setBeacon ( const NodePtr &value );
00268 void setClearStencilBit( const Int32 &value );
00269
00271
00276
00280 virtual UInt32 getBinSize (const BitVector &whichField);
00281 virtual void copyToBin ( BinaryDataHandler &pMem,
00282 const BitVector &whichField);
00283 virtual void copyFromBin( BinaryDataHandler &pMem,
00284 const BitVector &whichField);
00285
00286
00288
00292 static SkyBackgroundPtr create (void);
00293 static SkyBackgroundPtr createEmpty (void);
00294
00297
00301 virtual FieldContainerPtr shallowCopy (void) const;
00302
00304
00305 protected:
00306
00307
00311 MFColor4f _mfSkyColor;
00312 MFReal32 _mfSkyAngle;
00313 MFColor4f _mfGroundColor;
00314 MFReal32 _mfGroundAngle;
00315 SFUInt32 _sfSphereRes;
00316 SFTextureChunkPtr _sfBackTexture;
00317 SFTextureChunkPtr _sfBottomTexture;
00318 SFTextureChunkPtr _sfFrontTexture;
00319 SFTextureChunkPtr _sfLeftTexture;
00320 SFTextureChunkPtr _sfRightTexture;
00321 SFTextureChunkPtr _sfTopTexture;
00322 SFBool _sfBoxInside;
00323 MFVec3f _mfTopTexCoord;
00324 MFVec3f _mfBottomTexCoord;
00325 MFVec3f _mfRightTexCoord;
00326 MFVec3f _mfLeftTexCoord;
00327 MFVec3f _mfFrontTexCoord;
00328 MFVec3f _mfBackTexCoord;
00329 SFNodePtr _sfBeacon;
00330 SFInt32 _sfClearStencilBit;
00331
00333
00337 SkyBackgroundBase(void);
00338 SkyBackgroundBase(const SkyBackgroundBase &source);
00339
00341
00345 virtual ~SkyBackgroundBase(void);
00346
00348
00352 #if !defined(OSG_FIXED_MFIELDSYNC)
00353 void executeSyncImpl( SkyBackgroundBase *pOther,
00354 const BitVector &whichField);
00355
00356 virtual void executeSync( FieldContainer &other,
00357 const BitVector &whichField);
00358 #else
00359 void executeSyncImpl( SkyBackgroundBase *pOther,
00360 const BitVector &whichField,
00361 const SyncInfo &sInfo );
00362
00363 virtual void executeSync( FieldContainer &other,
00364 const BitVector &whichField,
00365 const SyncInfo &sInfo);
00366
00367 virtual void execBeginEdit (const BitVector &whichField,
00368 UInt32 uiAspect,
00369 UInt32 uiContainerSize);
00370
00371 void execBeginEditImpl (const BitVector &whichField,
00372 UInt32 uiAspect,
00373 UInt32 uiContainerSize);
00374
00375 virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00376 #endif
00377
00379
00380 private:
00381
00382 friend class FieldContainer;
00383
00384 static FieldDescription *_desc[];
00385 static FieldContainerType _type;
00386
00387
00388
00389 void operator =(const SkyBackgroundBase &source);
00390 };
00391
00392
00393
00394
00395
00396
00397 typedef SkyBackgroundBase *SkyBackgroundBaseP;
00398
00399 typedef osgIF<SkyBackgroundBase::isNodeCore,
00400 CoredNodePtr<SkyBackground>,
00401 FieldContainer::attempt_to_create_CoredNodePtr_on_non_NodeCore_FC
00402 >::_IRet SkyBackgroundNodePtr;
00403
00404 typedef RefPtr<SkyBackgroundPtr> SkyBackgroundRefPtr;
00405
00406 OSG_END_NAMESPACE
00407
00408 #define OSGSKYBACKGROUNDBASE_HEADER_CVSID "@(#)$Id: FCBaseTemplate_h.h,v 1.40 2005/07/20 00:10:14 vossg Exp $"
00409
00410 #endif