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 _OSGIMAGEBASE_H_
00055 #define _OSGIMAGEBASE_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 <OSGFieldContainerFields.h>
00071 #include <OSGInt32Fields.h>
00072 #include <OSGInt32Fields.h>
00073 #include <OSGInt32Fields.h>
00074 #include <OSGInt32Fields.h>
00075 #include <OSGInt32Fields.h>
00076 #include <OSGInt32Fields.h>
00077 #include <OSGInt32Fields.h>
00078 #include <OSGTimeFields.h>
00079 #include <OSGUInt32Fields.h>
00080 #include <OSGUInt8Fields.h>
00081 #include <OSGInt32Fields.h>
00082 #include <OSGStringFields.h>
00083 #include <OSGInt32Fields.h>
00084 #include <OSGInt32Fields.h>
00085 #include <OSGInt32Fields.h>
00086 #include <OSGInt32Fields.h>
00087 #include <OSGBoolFields.h>
00088 #include <OSGBoolFields.h>
00089 #include <OSGBoolFields.h>
00090 #include <OSGBoolFields.h>
00091 #include <OSGReal32Fields.h>
00092 #include <OSGReal32Fields.h>
00093 #include <OSGUInt16Fields.h>
00094
00095 #include <OSGImageFields.h>
00096
00097 OSG_BEGIN_NAMESPACE
00098
00099 class Image;
00100 class BinaryDataHandler;
00101
00103
00104 class OSG_SYSTEMLIB_DLLMAPPING ImageBase : public AttachmentContainer
00105 {
00106 private:
00107
00108 typedef AttachmentContainer Inherited;
00109
00110
00111 public:
00112
00113 typedef ImagePtr Ptr;
00114
00115 enum
00116 {
00117 ParentsFieldId = Inherited::NextFieldId,
00118 DimensionFieldId = ParentsFieldId + 1,
00119 WidthFieldId = DimensionFieldId + 1,
00120 HeightFieldId = WidthFieldId + 1,
00121 DepthFieldId = HeightFieldId + 1,
00122 BppFieldId = DepthFieldId + 1,
00123 MipMapCountFieldId = BppFieldId + 1,
00124 FrameCountFieldId = MipMapCountFieldId + 1,
00125 FrameDelayFieldId = FrameCountFieldId + 1,
00126 PixelFormatFieldId = FrameDelayFieldId + 1,
00127 PixelFieldId = PixelFormatFieldId + 1,
00128 FrameSizeFieldId = PixelFieldId + 1,
00129 NameFieldId = FrameSizeFieldId + 1,
00130 DataTypeFieldId = NameFieldId + 1,
00131 ComponentSizeFieldId = DataTypeFieldId + 1,
00132 SideCountFieldId = ComponentSizeFieldId + 1,
00133 SideSizeFieldId = SideCountFieldId + 1,
00134 ForceCompressedDataFieldId = SideSizeFieldId + 1,
00135 ForceAlphaChannelFieldId = ForceCompressedDataFieldId + 1,
00136 ForceColorChannelFieldId = ForceAlphaChannelFieldId + 1,
00137 ForceAlphaBinaryFieldId = ForceColorChannelFieldId + 1,
00138 ResXFieldId = ForceAlphaBinaryFieldId + 1,
00139 ResYFieldId = ResXFieldId + 1,
00140 ResUnitFieldId = ResYFieldId + 1,
00141 NextFieldId = ResUnitFieldId + 1
00142 };
00143
00144 static const OSG::BitVector ParentsFieldMask;
00145 static const OSG::BitVector DimensionFieldMask;
00146 static const OSG::BitVector WidthFieldMask;
00147 static const OSG::BitVector HeightFieldMask;
00148 static const OSG::BitVector DepthFieldMask;
00149 static const OSG::BitVector BppFieldMask;
00150 static const OSG::BitVector MipMapCountFieldMask;
00151 static const OSG::BitVector FrameCountFieldMask;
00152 static const OSG::BitVector FrameDelayFieldMask;
00153 static const OSG::BitVector PixelFormatFieldMask;
00154 static const OSG::BitVector PixelFieldMask;
00155 static const OSG::BitVector FrameSizeFieldMask;
00156 static const OSG::BitVector NameFieldMask;
00157 static const OSG::BitVector DataTypeFieldMask;
00158 static const OSG::BitVector ComponentSizeFieldMask;
00159 static const OSG::BitVector SideCountFieldMask;
00160 static const OSG::BitVector SideSizeFieldMask;
00161 static const OSG::BitVector ForceCompressedDataFieldMask;
00162 static const OSG::BitVector ForceAlphaChannelFieldMask;
00163 static const OSG::BitVector ForceColorChannelFieldMask;
00164 static const OSG::BitVector ForceAlphaBinaryFieldMask;
00165 static const OSG::BitVector ResXFieldMask;
00166 static const OSG::BitVector ResYFieldMask;
00167 static const OSG::BitVector ResUnitFieldMask;
00168
00169
00170 static const OSG::BitVector MTInfluenceMask;
00171
00172
00176 static FieldContainerType &getClassType (void);
00177 static UInt32 getClassTypeId (void);
00178
00180
00184 virtual FieldContainerType &getType (void);
00185 virtual const FieldContainerType &getType (void) const;
00186
00187 virtual UInt32 getContainerSize(void) const;
00188
00190
00194 MFFieldContainerPtr *getMFParents (void);
00195 SFInt32 *getSFDimension (void);
00196 SFInt32 *getSFWidth (void);
00197 SFInt32 *getSFHeight (void);
00198 SFInt32 *getSFDepth (void);
00199 SFInt32 *getSFBpp (void);
00200 SFInt32 *getSFMipMapCount (void);
00201 SFInt32 *getSFFrameCount (void);
00202 SFTime *getSFFrameDelay (void);
00203 SFUInt32 *getSFPixelFormat (void);
00204 MFUInt8 *getMFPixel (void);
00205 SFInt32 *getSFFrameSize (void);
00206 SFString *getSFName (void);
00207 SFInt32 *getSFDataType (void);
00208 SFInt32 *getSFSideCount (void);
00209 SFInt32 *getSFSideSize (void);
00210 SFBool *getSFForceCompressedData(void);
00211 SFBool *getSFForceAlphaChannel(void);
00212 SFBool *getSFForceColorChannel(void);
00213 SFBool *getSFForceAlphaBinary(void);
00214 SFReal32 *getSFResX (void);
00215 SFReal32 *getSFResY (void);
00216 SFUInt16 *getSFResUnit (void);
00217
00218 Int32 &getDimension (void);
00219 const Int32 &getDimension (void) const;
00220 Int32 &getWidth (void);
00221 const Int32 &getWidth (void) const;
00222 Int32 &getHeight (void);
00223 const Int32 &getHeight (void) const;
00224 Int32 &getDepth (void);
00225 const Int32 &getDepth (void) const;
00226 Int32 &getBpp (void);
00227 const Int32 &getBpp (void) const;
00228 Int32 &getMipMapCount (void);
00229 const Int32 &getMipMapCount (void) const;
00230 Int32 &getFrameCount (void);
00231 const Int32 &getFrameCount (void) const;
00232 Time &getFrameDelay (void);
00233 const Time &getFrameDelay (void) const;
00234 UInt32 &getPixelFormat (void);
00235 const UInt32 &getPixelFormat (void) const;
00236 Int32 &getFrameSize (void);
00237 const Int32 &getFrameSize (void) const;
00238 std::string &getName (void);
00239 const std::string &getName (void) const;
00240 Int32 &getDataType (void);
00241 const Int32 &getDataType (void) const;
00242 Int32 &getSideCount (void);
00243 const Int32 &getSideCount (void) const;
00244 Int32 &getSideSize (void);
00245 const Int32 &getSideSize (void) const;
00246 bool &getForceCompressedData(void);
00247 const bool &getForceCompressedData(void) const;
00248 bool &getForceAlphaChannel(void);
00249 const bool &getForceAlphaChannel(void) const;
00250 bool &getForceColorChannel(void);
00251 const bool &getForceColorChannel(void) const;
00252 bool &getForceAlphaBinary(void);
00253 const bool &getForceAlphaBinary(void) const;
00254 Real32 &getResX (void);
00255 const Real32 &getResX (void) const;
00256 Real32 &getResY (void);
00257 const Real32 &getResY (void) const;
00258 UInt16 &getResUnit (void);
00259 const UInt16 &getResUnit (void) const;
00260 FieldContainerPtr &getParents (const UInt32 index);
00261 MFFieldContainerPtr &getParents (void);
00262 const MFFieldContainerPtr &getParents (void) const;
00263 UInt8 &getPixel (const UInt32 index);
00264 MFUInt8 &getPixel (void);
00265 const MFUInt8 &getPixel (void) const;
00266
00268
00272 void setDimension ( const Int32 &value );
00273 void setWidth ( const Int32 &value );
00274 void setHeight ( const Int32 &value );
00275 void setDepth ( const Int32 &value );
00276 void setBpp ( const Int32 &value );
00277 void setMipMapCount ( const Int32 &value );
00278 void setFrameCount ( const Int32 &value );
00279 void setFrameDelay ( const Time &value );
00280 void setPixelFormat ( const UInt32 &value );
00281 void setFrameSize ( const Int32 &value );
00282 void setName ( const std::string &value );
00283 void setDataType ( const Int32 &value );
00284 void setSideCount ( const Int32 &value );
00285 void setSideSize ( const Int32 &value );
00286 void setForceCompressedData( const bool &value );
00287 void setForceAlphaChannel( const bool &value );
00288 void setForceColorChannel( const bool &value );
00289 void setForceAlphaBinary( const bool &value );
00290 void setResX ( const Real32 &value );
00291 void setResY ( const Real32 &value );
00292 void setResUnit ( const UInt16 &value );
00293
00295
00300
00304 virtual UInt32 getBinSize (const BitVector &whichField);
00305 virtual void copyToBin ( BinaryDataHandler &pMem,
00306 const BitVector &whichField);
00307 virtual void copyFromBin( BinaryDataHandler &pMem,
00308 const BitVector &whichField);
00309
00310
00312
00316 static ImagePtr create (void);
00317 static ImagePtr createEmpty (void);
00318
00321
00325 virtual FieldContainerPtr shallowCopy (void) const;
00326
00328
00329 protected:
00330
00331
00335 MFFieldContainerPtr _mfParents;
00336 SFInt32 _sfDimension;
00337 SFInt32 _sfWidth;
00338 SFInt32 _sfHeight;
00339 SFInt32 _sfDepth;
00340 SFInt32 _sfBpp;
00341 SFInt32 _sfMipMapCount;
00342 SFInt32 _sfFrameCount;
00343 SFTime _sfFrameDelay;
00344 SFUInt32 _sfPixelFormat;
00345 MFUInt8 _mfPixel;
00346 SFInt32 _sfFrameSize;
00347 SFString _sfName;
00348 SFInt32 _sfDataType;
00349 SFInt32 _sfComponentSize;
00350 SFInt32 _sfSideCount;
00351 SFInt32 _sfSideSize;
00352 SFBool _sfForceCompressedData;
00353 SFBool _sfForceAlphaChannel;
00354 SFBool _sfForceColorChannel;
00355 SFBool _sfForceAlphaBinary;
00356 SFReal32 _sfResX;
00357 SFReal32 _sfResY;
00358 SFUInt16 _sfResUnit;
00359
00361
00365 ImageBase(void);
00366 ImageBase(const ImageBase &source);
00367
00369
00373 virtual ~ImageBase(void);
00374
00376
00380 SFInt32 *getSFComponentSize (void);
00381
00382 Int32 &getComponentSize (void);
00383 const Int32 &getComponentSize (void) const;
00384
00386
00390 void setComponentSize (const Int32 &value);
00391
00393
00397 #if !defined(OSG_FIXED_MFIELDSYNC)
00398 void executeSyncImpl( ImageBase *pOther,
00399 const BitVector &whichField);
00400
00401 virtual void executeSync( FieldContainer &other,
00402 const BitVector &whichField);
00403 #else
00404 void executeSyncImpl( ImageBase *pOther,
00405 const BitVector &whichField,
00406 const SyncInfo &sInfo );
00407
00408 virtual void executeSync( FieldContainer &other,
00409 const BitVector &whichField,
00410 const SyncInfo &sInfo);
00411
00412 virtual void execBeginEdit (const BitVector &whichField,
00413 UInt32 uiAspect,
00414 UInt32 uiContainerSize);
00415
00416 void execBeginEditImpl (const BitVector &whichField,
00417 UInt32 uiAspect,
00418 UInt32 uiContainerSize);
00419
00420 virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00421 #endif
00422
00424
00425 private:
00426
00427 friend class FieldContainer;
00428
00429 static FieldDescription *_desc[];
00430 static FieldContainerType _type;
00431
00432
00433
00434 void operator =(const ImageBase &source);
00435 };
00436
00437
00438
00439
00440
00441
00442 typedef ImageBase *ImageBaseP;
00443
00444 typedef osgIF<ImageBase::isNodeCore,
00445 CoredNodePtr<Image>,
00446 FieldContainer::attempt_to_create_CoredNodePtr_on_non_NodeCore_FC
00447 >::_IRet ImageNodePtr;
00448
00449 typedef RefPtr<ImagePtr> ImageRefPtr;
00450
00451 OSG_END_NAMESPACE
00452
00453 #define OSGIMAGEBASE_HEADER_CVSID "@(#)$Id: FCBaseTemplate_h.h,v 1.40 2005/07/20 00:10:14 vossg Exp $"
00454
00455 #endif