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 _OSGLIGHTMODELCHUNKBASE_H_
00055 #define _OSGLIGHTMODELCHUNKBASE_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 <OSGStateChunk.h>
00069
00070 #include <OSGColor4fFields.h>
00071 #include <OSGGLenumFields.h>
00072 #include <OSGBoolFields.h>
00073
00074 #include <OSGLightModelChunkFields.h>
00075
00076 OSG_BEGIN_NAMESPACE
00077
00078 class LightModelChunk;
00079 class BinaryDataHandler;
00080
00082
00083 class OSG_SYSTEMLIB_DLLMAPPING LightModelChunkBase : public StateChunk
00084 {
00085 private:
00086
00087 typedef StateChunk Inherited;
00088
00089
00090 public:
00091
00092 typedef LightModelChunkPtr Ptr;
00093
00094 enum
00095 {
00096 AmbientFieldId = Inherited::NextFieldId,
00097 ColorControlFieldId = AmbientFieldId + 1,
00098 LocalViewerFieldId = ColorControlFieldId + 1,
00099 NextFieldId = LocalViewerFieldId + 1
00100 };
00101
00102 static const OSG::BitVector AmbientFieldMask;
00103 static const OSG::BitVector ColorControlFieldMask;
00104 static const OSG::BitVector LocalViewerFieldMask;
00105
00106
00107 static const OSG::BitVector MTInfluenceMask;
00108
00109
00113 static FieldContainerType &getClassType (void);
00114 static UInt32 getClassTypeId (void);
00115
00117
00121 virtual FieldContainerType &getType (void);
00122 virtual const FieldContainerType &getType (void) const;
00123
00124 virtual UInt32 getContainerSize(void) const;
00125
00127
00131 SFColor4f *getSFAmbient (void);
00132 SFGLenum *getSFColorControl (void);
00133 SFBool *getSFLocalViewer (void);
00134
00135 Color4f &getAmbient (void);
00136 const Color4f &getAmbient (void) const;
00137 GLenum &getColorControl (void);
00138 const GLenum &getColorControl (void) const;
00139 bool &getLocalViewer (void);
00140 const bool &getLocalViewer (void) const;
00141
00143
00147 void setAmbient ( const Color4f &value );
00148 void setColorControl ( const GLenum &value );
00149 void setLocalViewer ( const bool &value );
00150
00152
00157
00161 virtual UInt32 getBinSize (const BitVector &whichField);
00162 virtual void copyToBin ( BinaryDataHandler &pMem,
00163 const BitVector &whichField);
00164 virtual void copyFromBin( BinaryDataHandler &pMem,
00165 const BitVector &whichField);
00166
00167
00169
00173 static LightModelChunkPtr create (void);
00174 static LightModelChunkPtr createEmpty (void);
00175
00178
00182 virtual FieldContainerPtr shallowCopy (void) const;
00183
00185
00186 protected:
00187
00188
00192 SFColor4f _sfAmbient;
00193 SFGLenum _sfColorControl;
00194 SFBool _sfLocalViewer;
00195
00197
00201 LightModelChunkBase(void);
00202 LightModelChunkBase(const LightModelChunkBase &source);
00203
00205
00209 virtual ~LightModelChunkBase(void);
00210
00212
00216 #if !defined(OSG_FIXED_MFIELDSYNC)
00217 void executeSyncImpl( LightModelChunkBase *pOther,
00218 const BitVector &whichField);
00219
00220 virtual void executeSync( FieldContainer &other,
00221 const BitVector &whichField);
00222 #else
00223 void executeSyncImpl( LightModelChunkBase *pOther,
00224 const BitVector &whichField,
00225 const SyncInfo &sInfo );
00226
00227 virtual void executeSync( FieldContainer &other,
00228 const BitVector &whichField,
00229 const SyncInfo &sInfo);
00230
00231 virtual void execBeginEdit (const BitVector &whichField,
00232 UInt32 uiAspect,
00233 UInt32 uiContainerSize);
00234
00235 void execBeginEditImpl (const BitVector &whichField,
00236 UInt32 uiAspect,
00237 UInt32 uiContainerSize);
00238
00239 virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00240 #endif
00241
00243
00244 private:
00245
00246 friend class FieldContainer;
00247
00248 static FieldDescription *_desc[];
00249 static FieldContainerType _type;
00250
00251
00252
00253 void operator =(const LightModelChunkBase &source);
00254 };
00255
00256
00257
00258
00259
00260
00261 typedef LightModelChunkBase *LightModelChunkBaseP;
00262
00263 typedef osgIF<LightModelChunkBase::isNodeCore,
00264 CoredNodePtr<LightModelChunk>,
00265 FieldContainer::attempt_to_create_CoredNodePtr_on_non_NodeCore_FC
00266 >::_IRet LightModelChunkNodePtr;
00267
00268 typedef RefPtr<LightModelChunkPtr> LightModelChunkRefPtr;
00269
00270 OSG_END_NAMESPACE
00271
00272 #define OSGLIGHTMODELCHUNKBASE_HEADER_CVSID "@(#)$Id: OSGLightModelChunkBase.h,v 1.3 2006/02/20 16:54:19 dirk Exp $"
00273
00274 #endif