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 _OSGFRESNELMATERIALBASE_H_
00055 #define _OSGFRESNELMATERIALBASE_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 <OSGChunkMaterial.h>
00069
00070 #include <OSGColor3fFields.h>
00071 #include <OSGColor3fFields.h>
00072 #include <OSGColor3fFields.h>
00073 #include <OSGReal32Fields.h>
00074 #include <OSGColor3fFields.h>
00075 #include <OSGReal32Fields.h>
00076 #include <OSGBoolFields.h>
00077 #include <OSGGLenumFields.h>
00078 #include <OSGReal32Fields.h>
00079 #include <OSGReal32Fields.h>
00080 #include <OSGReal32Fields.h>
00081 #include <OSGImageFields.h>
00082
00083 #include <OSGFresnelMaterialFields.h>
00084
00085 OSG_BEGIN_NAMESPACE
00086
00087 class FresnelMaterial;
00088 class BinaryDataHandler;
00089
00091
00092 class OSG_SYSTEMLIB_DLLMAPPING FresnelMaterialBase : public ChunkMaterial
00093 {
00094 private:
00095
00096 typedef ChunkMaterial Inherited;
00097
00098
00099 public:
00100
00101 typedef FresnelMaterialPtr Ptr;
00102
00103 enum
00104 {
00105 AmbientFieldId = Inherited::NextFieldId,
00106 DiffuseFieldId = AmbientFieldId + 1,
00107 SpecularFieldId = DiffuseFieldId + 1,
00108 ShininessFieldId = SpecularFieldId + 1,
00109 EmissionFieldId = ShininessFieldId + 1,
00110 TransparencyFieldId = EmissionFieldId + 1,
00111 LitFieldId = TransparencyFieldId + 1,
00112 ColorMaterialFieldId = LitFieldId + 1,
00113 IndexFieldId = ColorMaterialFieldId + 1,
00114 ScaleFieldId = IndexFieldId + 1,
00115 BiasFieldId = ScaleFieldId + 1,
00116 ImageFieldId = BiasFieldId + 1,
00117 NextFieldId = ImageFieldId + 1
00118 };
00119
00120 static const OSG::BitVector AmbientFieldMask;
00121 static const OSG::BitVector DiffuseFieldMask;
00122 static const OSG::BitVector SpecularFieldMask;
00123 static const OSG::BitVector ShininessFieldMask;
00124 static const OSG::BitVector EmissionFieldMask;
00125 static const OSG::BitVector TransparencyFieldMask;
00126 static const OSG::BitVector LitFieldMask;
00127 static const OSG::BitVector ColorMaterialFieldMask;
00128 static const OSG::BitVector IndexFieldMask;
00129 static const OSG::BitVector ScaleFieldMask;
00130 static const OSG::BitVector BiasFieldMask;
00131 static const OSG::BitVector ImageFieldMask;
00132
00133
00134 static const OSG::BitVector MTInfluenceMask;
00135
00136
00140 static FieldContainerType &getClassType (void);
00141 static UInt32 getClassTypeId (void);
00142
00144
00148 virtual FieldContainerType &getType (void);
00149 virtual const FieldContainerType &getType (void) const;
00150
00151 virtual UInt32 getContainerSize(void) const;
00152
00154
00158 SFColor3f *getSFAmbient (void);
00159 SFColor3f *getSFDiffuse (void);
00160 SFColor3f *getSFSpecular (void);
00161 SFReal32 *getSFShininess (void);
00162 SFColor3f *getSFEmission (void);
00163 SFReal32 *getSFTransparency (void);
00164 SFBool *getSFLit (void);
00165 SFGLenum *getSFColorMaterial (void);
00166 SFReal32 *getSFIndex (void);
00167 SFReal32 *getSFScale (void);
00168 SFReal32 *getSFBias (void);
00169 SFImagePtr *getSFImage (void);
00170
00171 Color3f &getAmbient (void);
00172 const Color3f &getAmbient (void) const;
00173 Color3f &getDiffuse (void);
00174 const Color3f &getDiffuse (void) const;
00175 Color3f &getSpecular (void);
00176 const Color3f &getSpecular (void) const;
00177 Real32 &getShininess (void);
00178 const Real32 &getShininess (void) const;
00179 Color3f &getEmission (void);
00180 const Color3f &getEmission (void) const;
00181 Real32 &getTransparency (void);
00182 const Real32 &getTransparency (void) const;
00183 bool &getLit (void);
00184 const bool &getLit (void) const;
00185 GLenum &getColorMaterial (void);
00186 const GLenum &getColorMaterial (void) const;
00187 Real32 &getIndex (void);
00188 const Real32 &getIndex (void) const;
00189 Real32 &getScale (void);
00190 const Real32 &getScale (void) const;
00191 Real32 &getBias (void);
00192 const Real32 &getBias (void) const;
00193 ImagePtr &getImage (void);
00194 const ImagePtr &getImage (void) const;
00195
00197
00201 void setAmbient ( const Color3f &value );
00202 void setDiffuse ( const Color3f &value );
00203 void setSpecular ( const Color3f &value );
00204 void setShininess ( const Real32 &value );
00205 void setEmission ( const Color3f &value );
00206 void setTransparency ( const Real32 &value );
00207 void setLit ( const bool &value );
00208 void setColorMaterial ( const GLenum &value );
00209 void setIndex ( const Real32 &value );
00210 void setScale ( const Real32 &value );
00211 void setBias ( const Real32 &value );
00212 void setImage ( const ImagePtr &value );
00213
00215
00220
00224 virtual UInt32 getBinSize (const BitVector &whichField);
00225 virtual void copyToBin ( BinaryDataHandler &pMem,
00226 const BitVector &whichField);
00227 virtual void copyFromBin( BinaryDataHandler &pMem,
00228 const BitVector &whichField);
00229
00230
00232
00236 static FresnelMaterialPtr create (void);
00237 static FresnelMaterialPtr createEmpty (void);
00238
00241
00245 virtual FieldContainerPtr shallowCopy (void) const;
00246
00248
00249 protected:
00250
00251
00255 SFColor3f _sfAmbient;
00256 SFColor3f _sfDiffuse;
00257 SFColor3f _sfSpecular;
00258 SFReal32 _sfShininess;
00259 SFColor3f _sfEmission;
00260 SFReal32 _sfTransparency;
00261 SFBool _sfLit;
00262 SFGLenum _sfColorMaterial;
00263 SFReal32 _sfIndex;
00264 SFReal32 _sfScale;
00265 SFReal32 _sfBias;
00266 SFImagePtr _sfImage;
00267
00269
00273 FresnelMaterialBase(void);
00274 FresnelMaterialBase(const FresnelMaterialBase &source);
00275
00277
00281 virtual ~FresnelMaterialBase(void);
00282
00284
00288 #if !defined(OSG_FIXED_MFIELDSYNC)
00289 void executeSyncImpl( FresnelMaterialBase *pOther,
00290 const BitVector &whichField);
00291
00292 virtual void executeSync( FieldContainer &other,
00293 const BitVector &whichField);
00294 #else
00295 void executeSyncImpl( FresnelMaterialBase *pOther,
00296 const BitVector &whichField,
00297 const SyncInfo &sInfo );
00298
00299 virtual void executeSync( FieldContainer &other,
00300 const BitVector &whichField,
00301 const SyncInfo &sInfo);
00302
00303 virtual void execBeginEdit (const BitVector &whichField,
00304 UInt32 uiAspect,
00305 UInt32 uiContainerSize);
00306
00307 void execBeginEditImpl (const BitVector &whichField,
00308 UInt32 uiAspect,
00309 UInt32 uiContainerSize);
00310
00311 virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00312 #endif
00313
00315
00316 private:
00317
00318 friend class FieldContainer;
00319
00320 static FieldDescription *_desc[];
00321 static FieldContainerType _type;
00322
00323
00324
00325 void operator =(const FresnelMaterialBase &source);
00326 };
00327
00328
00329
00330
00331
00332
00333 typedef FresnelMaterialBase *FresnelMaterialBaseP;
00334
00335 typedef osgIF<FresnelMaterialBase::isNodeCore,
00336 CoredNodePtr<FresnelMaterial>,
00337 FieldContainer::attempt_to_create_CoredNodePtr_on_non_NodeCore_FC
00338 >::_IRet FresnelMaterialNodePtr;
00339
00340 typedef RefPtr<FresnelMaterialPtr> FresnelMaterialRefPtr;
00341
00342 OSG_END_NAMESPACE
00343
00344 #define OSGFRESNELMATERIALBASE_HEADER_CVSID "@(#)$Id: OSGFresnelMaterialBase.h,v 1.5 2005/07/20 00:09:24 vossg Exp $"
00345
00346 #endif