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 _OSGTEXTUREBACKGROUNDBASE_H_
00055 #define _OSGTEXTUREBACKGROUNDBASE_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 <OSGTextureChunkFields.h>
00072 #include <OSGPnt2fFields.h>
00073 #include <OSGReal32Fields.h>
00074 #include <OSGVec2fFields.h>
00075 #include <OSGUInt16Fields.h>
00076 #include <OSGUInt16Fields.h>
00077 #include <OSGInt32Fields.h>
00078
00079 #include <OSGTextureBackgroundFields.h>
00080
00081 OSG_BEGIN_NAMESPACE
00082
00083 class TextureBackground;
00084 class BinaryDataHandler;
00085
00087
00088 class OSG_SYSTEMLIB_DLLMAPPING TextureBackgroundBase : public Background
00089 {
00090 private:
00091
00092 typedef Background Inherited;
00093
00094
00095 public:
00096
00097 typedef TextureBackgroundPtr Ptr;
00098
00099 enum
00100 {
00101 ColorFieldId = Inherited::NextFieldId,
00102 TextureFieldId = ColorFieldId + 1,
00103 TexCoordsFieldId = TextureFieldId + 1,
00104 RadialDistortionFieldId = TexCoordsFieldId + 1,
00105 CenterOfDistortionFieldId = RadialDistortionFieldId + 1,
00106 HorFieldId = CenterOfDistortionFieldId + 1,
00107 VertFieldId = HorFieldId + 1,
00108 ClearStencilBitFieldId = VertFieldId + 1,
00109 NextFieldId = ClearStencilBitFieldId + 1
00110 };
00111
00112 static const OSG::BitVector ColorFieldMask;
00113 static const OSG::BitVector TextureFieldMask;
00114 static const OSG::BitVector TexCoordsFieldMask;
00115 static const OSG::BitVector RadialDistortionFieldMask;
00116 static const OSG::BitVector CenterOfDistortionFieldMask;
00117 static const OSG::BitVector HorFieldMask;
00118 static const OSG::BitVector VertFieldMask;
00119 static const OSG::BitVector ClearStencilBitFieldMask;
00120
00121
00122 static const OSG::BitVector MTInfluenceMask;
00123
00124
00128 static FieldContainerType &getClassType (void);
00129 static UInt32 getClassTypeId (void);
00130
00132
00136 virtual FieldContainerType &getType (void);
00137 virtual const FieldContainerType &getType (void) const;
00138
00139 virtual UInt32 getContainerSize(void) const;
00140
00142
00146 SFColor4f *getSFColor (void);
00147 SFTextureChunkPtr *getSFTexture (void);
00148 MFPnt2f *getMFTexCoords (void);
00149 SFReal32 *getSFRadialDistortion(void);
00150 SFVec2f *getSFCenterOfDistortion(void);
00151 SFUInt16 *getSFHor (void);
00152 SFUInt16 *getSFVert (void);
00153 SFInt32 *getSFClearStencilBit(void);
00154
00155 Color4f &getColor (void);
00156 const Color4f &getColor (void) const;
00157 TextureChunkPtr &getTexture (void);
00158 const TextureChunkPtr &getTexture (void) const;
00159 Real32 &getRadialDistortion(void);
00160 const Real32 &getRadialDistortion(void) const;
00161 Vec2f &getCenterOfDistortion(void);
00162 const Vec2f &getCenterOfDistortion(void) const;
00163 UInt16 &getHor (void);
00164 const UInt16 &getHor (void) const;
00165 UInt16 &getVert (void);
00166 const UInt16 &getVert (void) const;
00167 Int32 &getClearStencilBit(void);
00168 const Int32 &getClearStencilBit(void) const;
00169 Pnt2f &getTexCoords (const UInt32 index);
00170 MFPnt2f &getTexCoords (void);
00171 const MFPnt2f &getTexCoords (void) const;
00172
00174
00178 void setColor ( const Color4f &value );
00179 void setTexture ( const TextureChunkPtr &value );
00180 void setRadialDistortion( const Real32 &value );
00181 void setCenterOfDistortion( const Vec2f &value );
00182 void setHor ( const UInt16 &value );
00183 void setVert ( const UInt16 &value );
00184 void setClearStencilBit( const Int32 &value );
00185
00187
00192
00196 virtual UInt32 getBinSize (const BitVector &whichField);
00197 virtual void copyToBin ( BinaryDataHandler &pMem,
00198 const BitVector &whichField);
00199 virtual void copyFromBin( BinaryDataHandler &pMem,
00200 const BitVector &whichField);
00201
00202
00204
00208 static TextureBackgroundPtr create (void);
00209 static TextureBackgroundPtr createEmpty (void);
00210
00213
00217 virtual FieldContainerPtr shallowCopy (void) const;
00218
00220
00221 protected:
00222
00223
00227 SFColor4f _sfColor;
00228 SFTextureChunkPtr _sfTexture;
00229 MFPnt2f _mfTexCoords;
00230 SFReal32 _sfRadialDistortion;
00231 SFVec2f _sfCenterOfDistortion;
00232 SFUInt16 _sfHor;
00233 SFUInt16 _sfVert;
00234 SFInt32 _sfClearStencilBit;
00235
00237
00241 TextureBackgroundBase(void);
00242 TextureBackgroundBase(const TextureBackgroundBase &source);
00243
00245
00249 virtual ~TextureBackgroundBase(void);
00250
00252
00256 #if !defined(OSG_FIXED_MFIELDSYNC)
00257 void executeSyncImpl( TextureBackgroundBase *pOther,
00258 const BitVector &whichField);
00259
00260 virtual void executeSync( FieldContainer &other,
00261 const BitVector &whichField);
00262 #else
00263 void executeSyncImpl( TextureBackgroundBase *pOther,
00264 const BitVector &whichField,
00265 const SyncInfo &sInfo );
00266
00267 virtual void executeSync( FieldContainer &other,
00268 const BitVector &whichField,
00269 const SyncInfo &sInfo);
00270
00271 virtual void execBeginEdit (const BitVector &whichField,
00272 UInt32 uiAspect,
00273 UInt32 uiContainerSize);
00274
00275 void execBeginEditImpl (const BitVector &whichField,
00276 UInt32 uiAspect,
00277 UInt32 uiContainerSize);
00278
00279 virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00280 #endif
00281
00283
00284 private:
00285
00286 friend class FieldContainer;
00287
00288 static FieldDescription *_desc[];
00289 static FieldContainerType _type;
00290
00291
00292
00293 void operator =(const TextureBackgroundBase &source);
00294 };
00295
00296
00297
00298
00299
00300
00301 typedef TextureBackgroundBase *TextureBackgroundBaseP;
00302
00303 typedef osgIF<TextureBackgroundBase::isNodeCore,
00304 CoredNodePtr<TextureBackground>,
00305 FieldContainer::attempt_to_create_CoredNodePtr_on_non_NodeCore_FC
00306 >::_IRet TextureBackgroundNodePtr;
00307
00308 typedef RefPtr<TextureBackgroundPtr> TextureBackgroundRefPtr;
00309
00310 OSG_END_NAMESPACE
00311
00312 #define OSGTEXTUREBACKGROUNDBASE_HEADER_CVSID "@(#)$Id: OSGTextureBackgroundBase.h,v 1.8 2006/09/08 13:45:30 yjung Exp $"
00313
00314 #endif